* get_serv_info(): evaluate server replies
authorWilfried Göesgens <willi@citadel.org>
Tue, 1 Jun 2010 20:57:18 +0000 (20:57 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 1 Jun 2010 20:57:18 +0000 (20:57 +0000)
webcit/serv_func.c

index 07932ef2a23feb35bb2ed7e615aa5b9575273ba2..493b380f1bad0dcfacbf41fbe3be714aadcf7c73 100644 (file)
@@ -64,6 +64,12 @@ ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent)
                    ChrPtr(browser_host)
        );
        StrBuf_ServGetln(Buf);
+       if (GetServerStatus(Buf, NULL) != 2) {
+               lprintf(0, "get_serv_info(IDEN): unexpected answer [%s]\n",
+                       ChrPtr(Buf));
+               FreeStrBuf(&Buf);
+               return NULL;
+       }
 
        /*
         * Tell the server that when we save a calendar event, we
@@ -72,11 +78,19 @@ ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent)
         */
        serv_puts("ICAL sgi|1");
        StrBuf_ServGetln(Buf);
+       if (GetServerStatus(Buf, NULL) != 2) {
+               lprintf(0, "get_serv_info(ICAL sgi|1): unexpected answer [%s]\n",
+                       ChrPtr(Buf));
+               FreeStrBuf(&Buf);
+               return NULL;
+       }
 
        /** Now ask the server to tell us a little bit about itself... */
        serv_puts("INFO");
        StrBuf_ServGetln(Buf);
        if (GetServerStatus(Buf, NULL) != 1) {
+               lprintf(0, "get_serv_info(INFO sgi|1): unexpected answer [%s]\n",
+                       ChrPtr(Buf));
                FreeStrBuf(&Buf);
                return NULL;
        }