Caldav: Improve principal error handling

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@467 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-03-19 14:07:49 +00:00
parent 0410b144d9
commit 6726a464fb
1 changed files with 33 additions and 26 deletions

View File

@ -529,6 +529,11 @@ public class CaldavConnection extends AbstractConnection {
actualPrincipal = session.getEmail();
}
if (!session.getEmail().equals(principal)) {
String message = "Invalid principal path, try /principals/users/" + session.getEmail();
DavGatewayTray.error(message);
sendErr(HttpStatus.SC_NOT_FOUND, message);
} else {
CaldavResponse response = new CaldavResponse(HttpStatus.SC_MULTI_STATUS);
response.startMultistatus();
response.startResponse("/principals/users/" + principal);
@ -561,6 +566,7 @@ public class CaldavConnection extends AbstractConnection {
response.endMultistatus();
response.close();
}
}
public void sendFreeBusy(String body) throws IOException {
HashMap<String, String> valueMap = new HashMap<String, String>();
@ -832,6 +838,7 @@ public class CaldavConnection extends AbstractConnection {
public void write(int b) throws IOException {
throw new UnsupportedOperationException();
}
@Override
public void close() throws IOException {
sendClient("0");