-/* $Header$
+/* $Id $
*
- * Program to add users en batch to the moira database
+ * Program to add users en masse to the moira database
*
* by Mark Rosenstein, July 1992.
*
- * Copyright 1992 by the Massachusetts Institute of Technology.
- *
- * (c) Copyright 1992 by the Massachusetts Institute of Technology.
+ * Copyright (C) 1992-1998 by the Massachusetts Institute of Technology.
* For copying and distribution information, please see the file
* <mit-copyright.h>.
*/
#include <mit-copyright.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <des.h>
-#include <krb.h>
#include <moira.h>
#include <moira_site.h>
-#ifndef LINT
-static char adduser_rcsid[] = "$Header$";
-#endif
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+
+RCSID("$Header$");
#ifdef ATHENA
#define DEFAULT_SHELL "/bin/athena/tcsh"
char *whoami;
int duplicate, errors;
-extern char *FixCase(), *RemoveHyphens(), *strtrim();
-extern int errno;
-int usercheck(), scream();
+extern int ureg_init(void);
+extern int grab_login(char *first, char *last, char *idnumber,
+ char *hashidnumber, char *login);
+extern int set_password(char *first, char *last, char *idnumber,
+ char *hashidnumber, char *password);
+
+void usage(char **argv);
+int usercheck(int argc, char **argv, void *qargv);
int main(int argc, char **argv)
{
dargv[1] = qargv[U_LAST];
duplicate = 0;
status = mr_query("get_user_account_by_name", 2, dargv,
- usercheck, (char *) qargv);
+ usercheck, qargv);
if (status && status != MR_NO_MATCH)
{
com_err(whoami, status,
}
}
status = mr_query("add_user_account", U_SECURE + 1, qargv,
- scream, NULL);
+ NULL, NULL);
if (status)
{
com_err(whoami, status, "adding user %s %s", first, last);
}
-usage(char **argv)
+void usage(char **argv)
{
fprintf(stderr, "Usage: %s [options]\n", argv[0]);
fprintf(stderr, "Options are\n");
}
-/* Called only if a query returns a value that we weren't expecting */
-
-scream(void)
-{
- fprintf(stderr, "Programmer botch\n");
- exit(3);
-}
-
-
/* query callback routine to check for duplicate users */
-usercheck(int argc, char **argv, char **qargv)
+int usercheck(int argc, char **argv, void *qargv)
{
- if (!strcmp(argv[U_MITID], qargv[U_MITID]))
+ if (!strcmp(argv[U_MITID], ((char **)qargv)[U_MITID]))
duplicate++;
else
duplicate--;
+
+ return MR_CONT;
}