2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afs/param.h>
15 #include <WINNT/afsevent.h>
19 #include <afs/cellconfig.h>
20 #include <afs/afsutil.h>
25 /* OK, this REALLY sucks bigtime, but I can't tell who is calling
26 * afsconf_CheckAuth easily, and only *SERVERS* should be calling osi_audit
27 * anyway. It's gonna give somebody fits to debug, I know, I know.
32 #include "AFS_component_version_number.c"
39 register afs_int32 code;
40 char name[PR_MAXNAMELEN];
49 afs_int32 verbose = 0;
53 fprintf(stderr,"Usage: readpwd [-v] [-c cellname] passwdfile.\n");
57 for (i = 1;i<argc;i++) {
58 if (!strcmp(argv[i],"-v"))
61 if (!strcmp(argv[i],"-c")) {
62 cellname = (char *)malloc(100);
63 strncpy(cellname,argv[++i],100);
66 strncpy(buf,argv[i],150);
69 code = pr_Initialize(2, AFSDIR_CLIENT_ETC_DIRPATH, cellname);
71 fprintf(stderr,"pr_Initialize failed, code %d.\n",code);
76 if ((fp= fopen(buf,"r")) == NULL) {
77 fprintf(stderr,"Couldn't open %s.\n",argv[1]);
80 while ((tmp = fgets(buf,150,fp)) != NULL) {
81 bzero(name,PR_MAXNAMELEN);
84 strncpy(name,buf,ptr-buf);
85 aptr = index(++ptr,':');
86 ptr = index(++aptr,':');
87 strncpy(uid,aptr,ptr-aptr);
90 printf("Adding %s with id %d.\n",name,id);
91 code = pr_CreateUser(name,&id);
93 fprintf(stderr,"Failed to add user %s with id %d!\n",name,id);
94 fprintf(stderr,"%s (%d).\n",pr_ErrorMsg(code),code);