Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 24 Apr 2012 09:45:28 +0000 (11:45 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 24 Apr 2012 09:45:28 +0000 (11:45 +0200)
1  2 
citadel/user_ops.c

diff --combined citadel/user_ops.c
index 37cbfcd6464d2c61253f9107865661a94f30021f,370d00811f55022adf025fc9bf89b287597e41aa..7bc53ce36f6488016388c92b3ca68bb5c5dae0a0
@@@ -934,17 -934,16 +934,17 @@@ void start_chkpwd_daemon(void) 
  int CtdlTryPassword(const char *password, long len)
  {
        int code;
 +      CitContext *CCC = CC;
  
 -      if ((CC->logged_in)) {
 +      if ((CCC->logged_in)) {
                syslog(LOG_WARNING, "CtdlTryPassword: already logged in\n");
                return pass_already_logged_in;
        }
 -      if (!strcmp(CC->curr_user, NLI)) {
 +      if (!strcmp(CCC->curr_user, NLI)) {
                syslog(LOG_WARNING, "CtdlTryPassword: no user selected\n");
                return pass_no_user;
        }
 -      if (CtdlGetUser(&CC->user, CC->curr_user)) {
 +      if (CtdlGetUser(&CCC->user, CCC->curr_user)) {
                syslog(LOG_ERR, "CtdlTryPassword: internal error\n");
                return pass_internal_error;
        }
        }
        code = (-1);
  
 -      if (CC->is_master) {
 +      if (CCC->is_master) {
                code = strcmp(password, config.c_master_pass);
        }
  
  
                /* host auth mode */
  
 -              if (validpw(CC->user.uid, password)) {
 +              if (validpw(CCC->user.uid, password)) {
                        code = 0;
  
                        /*
                         * this is a security hazard, comment it out.
                         */
  
 -                      CtdlGetUserLock(&CC->user, CC->curr_user);
 -                      safestrncpy(CC->user.password, password, sizeof CC->user.password);
 -                      CtdlPutUserLock(&CC->user);
 +                      CtdlGetUserLock(&CCC->user, CCC->curr_user);
 +                      safestrncpy(CCC->user.password, password, sizeof CCC->user.password);
 +                      CtdlPutUserLock(&CCC->user);
  
                        /*
                         * (sooper-seekrit hack ends here)
  
                /* LDAP auth mode */
  
 -              if ((CC->ldap_dn) && (!CtdlTryPasswordLDAP(CC->ldap_dn, password))) {
 +              if ((CCC->ldap_dn) && (!CtdlTryPasswordLDAP(CCC->ldap_dn, password))) {
                        code = 0;
                }
                else {
                pw = (char*) malloc(len + 1);
                memcpy(pw, password, len + 1);
                strproc(pw);
 -              strproc(CC->user.password);
 -              code = strcasecmp(CC->user.password, pw);
 +              strproc(CCC->user.password);
 +              code = strcasecmp(CCC->user.password, pw);
                strproc(pw);
 -              strproc(CC->user.password);
 -              code = strcasecmp(CC->user.password, pw);
 +              strproc(CCC->user.password);
 +              code = strcasecmp(CCC->user.password, pw);
                free (pw);
        }
  
                do_login();
                return pass_ok;
        } else {
 -              syslog(LOG_WARNING, "Bad password specified for <%s>\n", CC->curr_user);
 +              syslog(LOG_WARNING, "Bad password specified for <%s> Service <%s> Port <%ld> Remote <%s / %s>\n",
 +                     CCC->curr_user,
 +                     CCC->ServiceName,
 +                     CCC->tcp_port,
 +                     CCC->cs_host,
 +                     CCC->cs_addr);
 +
 +
 +//citserver[5610]: Bad password specified for <willi> Service <citadel-TCP> Remote <PotzBlitz / >
 +
                return pass_wrong_password;
        }
  }
@@@ -1587,7 -1577,8 +1587,8 @@@ int CtdlInvtKick(char *iuser, int op) 
                iuser,
                ((op == 1) ? "invited to" : "kicked out of"),
                CC->room.QRname,
-               CC->user.fullname);
+               (CC->logged_in ? CC->user.fullname : "an administrator")
+       );
        CtdlAideMessage(bbb,"User Admin Message");
  
        return(0);
@@@ -1966,7 -1957,9 +1967,9 @@@ void cmd_asup(char *cmdbuf
        if (deleted) {
                snprintf(notify, SIZ, 
                         "User \"%s\" has been deleted by %s.\n",
-                        usbuf.fullname, CC->user.fullname);
+                        usbuf.fullname,
+                       (CC->logged_in ? CC->user.fullname : "an administrator")
+               );
                CtdlAideMessage(notify, "User Deletion Message");
        }