* fix session connecting
authorWilfried Göesgens <willi@citadel.org>
Mon, 18 May 2009 19:05:37 +0000 (19:05 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 18 May 2009 19:05:37 +0000 (19:05 +0000)
* remove double-paste

webcit/auth.c
webcit/serv_func.c

index 863488b8c5dd1223347ecf4bb982d8776677460f..80064a689dd3beacec1cfee6007b81782248bf6e 100644 (file)
@@ -967,11 +967,12 @@ void Header_HandleCookie(StrBuf *Line, ParsedHttpHdrs *hdr)
        hdr->RawCookie = Line;
        if (hdr->DontNeedAuth)
                return;
-/*
-       safestrncpy(c_httpauth_string, "", sizeof c_httpauth_string);
-       c_httpauth_user = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
-       c_httpauth_pass = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
-*/
+       if (hdr->c_username == NULL)
+               hdr->c_username = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_USER));
+       if (hdr->c_password == NULL)
+               hdr->c_password = NewStrBufPlain(HKEY(DEFAULT_HTTPAUTH_PASS));
+       if (hdr->c_roomname == NULL)
+               hdr->c_roomname = NewStrBuf();
        cookie_to_stuff(Line, &hdr->desired_session,
                        hdr->c_username,
                        hdr->c_password,
index 12e4e5d0c33115dc50ec71d5fba6037b90785b6a..221aa84ce585c86e7ee7a14595c00628e3278fc8 100644 (file)
@@ -207,85 +207,6 @@ int GetConnected (void)
                        return 1;
                }
        }
-       if (WCC->ReadBuf == NULL)
-               WCC->ReadBuf = NewStrBuf();
-       if (is_uds)/* unix domain socket */
-               WCC->serv_sock = uds_connectsock(serv_sock_name);
-       else /* tcp socket */
-               WCC->serv_sock = tcp_connectsock(ctdlhost, ctdlport);
-       
-       if (WCC->serv_sock < 0) {
-               do_logout();
-               FreeStrBuf(&WCC->ReadBuf);
-               return 1;
-       }
-       else {
-               long Status;
-               StrBuf *Buf;
-
-               Buf = NewStrBuf();
-               WCC->connected = 1;
-               StrBuf_ServGetln(Buf);
-               GetServerStatus(Buf,&Status);
-               /* get the server greeting */
-               
-               /* Are there too many users already logged in? */
-               if (Status == 571) {
-                       wprintf(_("This server is already serving its maximum number of users and cannot accept any additional logins at this time.  Please try again later or contact your system administrator."));
-                       end_burst();
-                       end_webcit_session();
-                       FreeStrBuf(&Buf);
-                       return 1;
-               }
-
-               /*
-                * From what host is our user connecting?  Go with
-                * the host at the other end of the HTTP socket,
-                * unless we are following X-Forwarded-For: headers
-                * and such a header has already turned up something.
-                */
-               if ( (!follow_xff) || (StrLength(WCC->Hdr->browser_host) == 0) ) {
-                       if (WCC->Hdr->browser_host == NULL) {
-                               WCC->Hdr->browser_host = NewStrBuf();
-                               Put(WCC->Hdr->HTTPHeaders, HKEY("FreeMeWithTheOtherHeaders"), 
-                                   WCC->Hdr->browser_host, HFreeStrBuf);
-                       }
-                       locate_host(WCC->Hdr->browser_host, WCC->Hdr->http_sock);
-               }
-               if (WCC->serv_info == NULL)
-                       WCC->serv_info = get_serv_info(WCC->Hdr->browser_host, WCC->Hdr->user_agent);
-               if (WCC->serv_info == NULL){
-                       begin_burst();
-                       wprintf(_("Received unexpected answer from Citadel "
-                                 "server; bailing out."));
-                       hprintf("HTTP/1.1 200 OK\r\n");
-                       hprintf("Content-type: text/plain; charset=utf-8\r\n");
-                       end_burst();
-                       end_webcit_session();
-                       FreeStrBuf(&Buf);
-                       return 1;
-               }
-               if (WCC->serv_info->serv_rev_level < MINIMUM_CIT_VERSION) {
-                       begin_burst();
-                       wprintf(_("You are connected to a Citadel "
-                                 "server running Citadel %d.%02d. \n"
-                                 "In order to run this version of WebCit "
-                                 "you must also have Citadel %d.%02d or"
-                                 " newer.\n\n\n"),
-                               WCC->serv_info->serv_rev_level / 100,
-                               WCC->serv_info->serv_rev_level % 100,
-                               MINIMUM_CIT_VERSION / 100,
-                               MINIMUM_CIT_VERSION % 100
-                               );
-                       hprintf("HTTP/1.1 200 OK\r\n");
-                       hprintf("Content-type: text/plain; charset=utf-8\r\n");
-                       end_burst();
-                       end_webcit_session();
-                       FreeStrBuf(&Buf);
-                       return 1;
-               }
-               FreeStrBuf(&Buf);
-       }
        return 0;
 }