]> code.citadel.org Git - citadel.git/commitdiff
* user_ops.c: do not attempt to save the loaded user record into the
authorArt Cancro <ajc@citadel.org>
Fri, 23 Apr 2004 17:27:50 +0000 (17:27 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 23 Apr 2004 17:27:50 +0000 (17:27 +0000)
  supplied buffer, when the supplied buffer is NULL.  (This calling
  syntax is used to check for the existence of a user without storing it.)

citadel/ChangeLog
citadel/user_ops.c

index f5c35897cacf10d0a4bc29a68bbe1538eaad07ba..01373a9dd6a0d97a9c524234cf01f7d59c80ac20 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 620.22  2004/04/23 17:27:50  ajc
+ * user_ops.c: do not attempt to save the loaded user record into the
+   supplied buffer, when the supplied buffer is NULL.  (This calling
+   syntax is used to check for the existence of a user without storing it.)
+
  Revision 620.21  2004/04/21 03:44:50  ajc
  * serv_crypto.c: small fix to make self-signed certs no longer invalid
 
@@ -5715,3 +5720,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 5fe6172bc2b835ba317acce5759666e5bbf77602..8eb43b794a5cd31ea5415ca07ed3869051ffb97e 100644 (file)
@@ -79,7 +79,9 @@ int getuser(struct ctdluser *usbuf, char name[])
        struct cdbdata *cdbus;
        int using_sysuser = 0;
 
-       memset(usbuf, 0, sizeof(struct ctdluser));
+       if (usbuf != NULL) {
+               memset(usbuf, 0, sizeof(struct ctdluser));
+       }
 
 #ifdef ENABLE_AUTOLOGIN
        if (CtdlAssociateSystemUser(sysuser_name, name) == 0) {
@@ -98,9 +100,11 @@ int getuser(struct ctdluser *usbuf, char name[])
        if (cdbus == NULL) {    /* user not found */
                return(1);
        }
-       memcpy(usbuf, cdbus->ptr,
+       if (usbuf != NULL) {
+               memcpy(usbuf, cdbus->ptr,
                        ((cdbus->len > sizeof(struct ctdluser)) ?
                         sizeof(struct ctdluser) : cdbus->len));
+       }
        cdb_free(cdbus);
 
        return (0);