]> andersk Git - moira.git/blobdiff - clients/moira/user.c
tcsh is dead. Long live bash.
[moira.git] / clients / moira / user.c
index 0e5c534a1ba12120b9bb39b374f75b4b23fac245..0ed1762ec22f3a7ff710a5e87b3fd9fd7ed68fbe 100644 (file)
@@ -32,6 +32,8 @@ RCSID("$Header$");
 void CorrectCapitalization(char **name);
 char **AskUserInfo(char **info, Bool name);
 struct mqelem *GetUserInfo(int type, char *name1, char *name2);
+static void PrintLogin(char **info);
+struct mqelem *GetUserBySponsor(char *type, char *name);
 
 #define LOGIN 0
 #define UID   1
@@ -40,13 +42,15 @@ struct mqelem *GetUserInfo(int type, char *name1, char *name2);
 #define ID 4
 
 #ifdef ATHENA
-#define DEFAULT_SHELL "/bin/athena/tcsh"
+#define DEFAULT_SHELL "/bin/athena/bash"
 #else
-#define DEFAULT_SHELL "/bin/csh"
+#define DEFAULT_SHELL "/bin/bash"
 #endif
 #define DEFAULT_CLASS "?"
 
 #define DEFAULT_WINCONSOLESHELL "cmd"
+#define DEFAULT_WINHOMEDIR "[DFS]"
+#define DEFAULT_WINPROFILEDIR "[DFS]"
 
 /*     Function Name: UserState
  *     Description: Convert a numeric state into a descriptive string.
@@ -62,7 +66,9 @@ static char *states[] = {
   "Not registerable (4)",
   "Enrolled/Registerable (5)",
   "Enrolled/Not Registerable (6)",
-  "Half Enrolled (7)"
+  "Half Enrolled (7)",
+  "Registerable, Kerberos only (8)",
+  "Active, Kerberos only (9)"
 };
 
 static char *UserState(int state)
@@ -101,7 +107,7 @@ static void PrintUserName(char **info)
 
 static void PrintUserInfo(char **info)
 {
-  char name[BUFSIZ], buf[BUFSIZ];
+  char name[BUFSIZ], buf[BUFSIZ], sponsor[BUFSIZ];
   int status;
 
   sprintf(name, "%s, %s %s", info[U_LAST], info[U_FIRST], info[U_MIDDLE]);
@@ -113,9 +119,16 @@ static void PrintUserInfo(char **info)
   sprintf(buf, "Class: %-25s Windows Console Shell: %-10s",
          info[U_CLASS], info[U_WINCONSOLESHELL]);
   Put_message(buf);
+  sprintf(sponsor, "%s %s", info[U_SPONSOR_TYPE], info[U_SPONSOR_NAME]);
+  sprintf(buf, "Sponsor: %-23s Expiration date: %s", sponsor,  info[U_EXPIRATION]);
+  Put_message(buf);
   sprintf(buf, "Account is: %-20s MIT ID number: %s",
          UserState(atoi(info[U_STATE])), info[U_MITID]);
   Put_message(buf);
+  sprintf(buf, "Windows Home Directory: %s", info[U_WINHOMEDIR]);
+  Put_message(buf);
+  sprintf(buf, "Windows Profile Directory: %s", info[U_WINPROFILEDIR]);
+  Put_message(buf);
   status = atoi(info[U_STATE]);
   if (status == 0 || status == 2)
     {
@@ -152,6 +165,11 @@ static char **SetUserDefaults(char **info)
   info[U_COMMENT] = strdup("");
   info[U_SIGNATURE] = strdup("");
   info[U_SECURE] = strdup("0");
+  info[U_WINHOMEDIR] = strdup(DEFAULT_WINHOMEDIR);
+  info[U_WINPROFILEDIR] = strdup(DEFAULT_WINPROFILEDIR);
+  info[U_SPONSOR_TYPE] = strdup("NONE");
+  info[U_SPONSOR_NAME] = strdup("NONE");
+  info[U_EXPIRATION] = strdup("");
   info[U_MODTIME] = info[U_MODBY] = info[U_MODWITH] = info[U_END] = NULL;
   info[U_CREATED] = info[U_CREATOR] = NULL;
   return info;
@@ -298,6 +316,24 @@ char **AskUserInfo(char **info, Bool name)
   if (GetValueFromUser("Comments", &info[U_COMMENT]) == SUB_ERROR)
     return NULL;
 
+  if (GetValueFromUser("Windows Home Directory", &info[U_WINHOMEDIR]) ==
+      SUB_ERROR)
+    return NULL;
+
+  if (GetValueFromUser("Windows Profile Directory", &info[U_WINPROFILEDIR]) ==
+      SUB_ERROR)
+    return NULL;
+
+  if (GetTypeFromUser("User's sponsor type", "ace_type", &info[U_SPONSOR_TYPE])
+      == SUB_ERROR)
+    return NULL;
+  if (strcmp(info[U_SPONSOR_TYPE], "NONE") &&
+      GetValueFromUser("Sponsor's Name", &info[U_SPONSOR_NAME]) == SUB_ERROR)
+    return NULL;
+
+  if (GetValueFromUser("Expiration date", &info[U_EXPIRATION]) == SUB_ERROR)
+    return NULL;
+
   state = atoi(info[U_STATE]);
   if (!name || state == 0 || state == 2)
     {
@@ -607,7 +643,7 @@ int RegisterUser(int argc, char **argv)
       FreeInfo(args);
       return DM_NORMAL;
     }
-  if (strcmp(potype, "POP") && strcmp(potype, "IMAP"))
+  if (strcmp(potype, "POP") && strcmp(potype, "IMAP") && strcmp(potype, "EXCHANGE"))
     {
       sprintf(temp_buf, "Unknown P.O. Box type.");
       Put_message(temp_buf);
@@ -1139,3 +1175,61 @@ void PrintReservationTypes(void)
   FreeQueue(QueueTop(top));  
 }
 
+int UserBySponsor(int argc, char **argv)
+{
+  char buf[BUFSIZ], temp_buf[BUFSIZ], *type, *name;
+  struct mqelem *top;
+
+  type = strdup("USER");
+  if (GetTypeFromUser("Type of sponsor", "search_ace_type", &type) == SUB_ERROR)
+    return DM_NORMAL;
+
+  sprintf(buf, "Name of %s", type);
+  name = strdup(user);
+  if (GetValueFromUser(buf, &name) == SUB_ERROR)
+    return DM_NORMAL;
+
+  switch (YesNoQuestion("Do you want a recursive search (y/n)", FALSE))
+    {
+    case TRUE:
+      sprintf(temp_buf, "R%s", type);     /* "USER to "RUSER", etc. */
+      free(type);
+      type = strdup(temp_buf);
+      break;
+    case FALSE:
+      break;
+    default:
+      return DM_NORMAL;
+    }
+
+  top = GetUserBySponsor(type, name);
+  Loop(top, PrintLogin);
+
+  FreeQueue(top);
+  return DM_NORMAL;
+}
+
+static void PrintLogin(char **info)
+{
+     char buf[BUFSIZ];
+
+     sprintf(buf, "Login: %s", info[U_NAME]);
+     Put_message(buf);
+}
+
+struct mqelem *GetUserBySponsor(char *type, char *name)
+{
+  char *args[2];
+  struct mqelem *elem = NULL;
+  int status;
+
+  args[0] = type;
+  args[1] = name;
+  if ((status = do_mr_query("get_user_account_by_sponsor", 2, args, StoreInfo,
+                           &elem)))
+    {
+      com_err(program_name, status, " in get_user_account_by_sponsor");
+      return NULL;
+    }
+  return QueueTop(elem);
+}
This page took 0.082964 seconds and 4 git commands to generate.