]> andersk Git - moira.git/blobdiff - clients/moira/user.c
fix a cast to not generate a warning
[moira.git] / clients / moira / user.c
index 5b79fc28373f8f4fa292b2febe71bf699d2591e9..e722b9c9a7f42c04beaa43ffb3bc37e17f2e5090 100644 (file)
@@ -121,7 +121,8 @@ static void PrintUserInfo(char **info)
 #ifdef HAVE_GDSS
   sprintf(buf, "%s:%s", info[U_NAME], info[U_MITID]);
   si.rawsig = NULL;
-  status = GDSS_Verify(buf, strlen(buf), info[U_SIGNATURE], &si);
+  status = GDSS_Verify((unsigned char *)buf, strlen(buf),
+                      (unsigned char *)info[U_SIGNATURE], &si);
 #else /* GDSS */
   status = 0;
 #endif /* GDSS */
@@ -251,8 +252,24 @@ char **AskUserInfo(char **info, Bool name)
           SUB_ERROR)
     return NULL;
 
+  strcpy(temp_buf, info[U_UID]);
   if (GetValueFromUser("User's UID", &info[U_UID]) == SUB_ERROR)
     return NULL;
+  if (strcmp(info[U_UID], UNIQUE_UID) && strcmp(info[U_UID], temp_buf))
+    {
+      struct mqelem *elem = NULL;
+      if (do_mr_query("get_user_account_by_uid", 1, &info[U_UID],
+                     StoreInfo, &elem) == MR_SUCCESS)
+       {
+         Put_message("A user with that uid already exists in the database.");
+         Loop(QueueTop(elem), PrintUserInfo);
+         Loop(QueueTop(elem), FreeInfo);
+         FreeQueue(elem);
+         if (YesNoQuestion("Add new user anyway", TRUE) != TRUE)
+           return NULL;
+       }
+    }
+
   if (GetValueFromUser("User's shell", &info[U_SHELL]) == SUB_ERROR)
     return NULL;
   if (name)
@@ -315,23 +332,25 @@ char **AskUserInfo(char **info, Bool name)
       else
        sprintf(temp_buf, "%s:%s", info[U_NAME], info[U_MITID]);
       si.rawsig = NULL;
-      i = GDSS_Verify(temp_buf, strlen(temp_buf), info[U_SIGNATURE], &si);
+      i = GDSS_Verify((unsigned char *)temp_buf, strlen(temp_buf),
+                     (unsigned char *)info[U_SIGNATURE], &si);
       /* If it's already signed OK, don't resign it. */
       if (i != GDSS_SUCCESS)
        {
          free(info[U_SIGNATURE]);
          info[U_SIGNATURE] = malloc(GDSS_Sig_Size() * 2);
        sign_again:
-         i = GDSS_Sign(temp_buf, strlen(temp_buf), info[U_SIGNATURE]);
+         i = GDSS_Sign((unsigned char *)temp_buf, strlen(temp_buf),
+                       (unsigned char *)info[U_SIGNATURE]);
          if (i != GDSS_SUCCESS)
            com_err(program_name, gdss2et(i), "Failed to create signature");
          else
            {
              unsigned char buf[256];
              si.rawsig = buf;
-             i = GDSS_Verify(temp_buf, strlen(temp_buf),
-                             info[U_SIGNATURE], &si);
-             if (strlen(buf) > 68)
+             i = GDSS_Verify((unsigned char *)temp_buf, strlen(temp_buf),
+                             (unsigned char *)info[U_SIGNATURE], &si);
+             if (strlen((char *)buf) > 68)
                goto sign_again;
            }
        }
This page took 0.306632 seconds and 4 git commands to generate.