authuserdb: Fix treatment of integers as strings in my previous patch.
authorMichael W. Olson <mwolson@gnu.org>
Sun, 27 Jan 2008 21:16:47 +0000 (16:16 -0500)
committerMichael W. Olson <mwolson@gnu.org>
Sun, 27 Jan 2008 21:16:47 +0000 (16:16 -0500)
authuserdb.c

index 166d7ab..8ea2692 100644 (file)
@@ -73,7 +73,6 @@ char  *u;
 char   *udbs;
 char   *passwords;
 char   *services;
-char   *token_cmd;
 struct userdbs *udb;
 struct cram_callback_info cci;
 
@@ -163,12 +162,19 @@ int       rc;
        aa.maildir=udb->udb_mailbox;
        aa.options=udb->udb_options;
 
-       /* Get tokens for AFS */
-       if ((token_cmd=malloc(sizeof(TOKEN_CMD)+strlen(aa.sysuserid))))
-       {
-               strcat(strcpy(token_cmd, TOKEN_CMD),aa.sysuserid);
-               system(token_cmd);
-               free(token_cmd);
+        /* Get tokens for AFS */
+        { char uidstr[32] = "<null>";
+          char *token_cmd;
+          if (aa.sysuserid)
+            {
+              snprintf(uidstr, sizeof(uidstr), "%ld", (long)*aa.sysuserid);
+              if ((token_cmd=malloc(sizeof(TOKEN_CMD)+strlen(uidstr))))
+                {
+                  strcat(strcpy(token_cmd, TOKEN_CMD),uidstr);
+                  system(token_cmd);
+                  free(token_cmd);
+                }
+            }
         }
 
        rc=(*callback_func)(&aa, callback_arg);