From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078613510399.tru64-unix-managers.marc@archive.invalid> From: "Paul N. Youngblood" Date: Wed, 11 Jun 1997 21:38:40 +0000 To: tru64-unix-managers Subject: C program won't run on DU 4.0B X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078613510399 Hello Managers, I run DU 4.0B on one AlphaServer 2100 and DU 3.2d-1 on another. Both run C2 Security. I have a handy little C program that I use to set the expiration date on a user's account. (Somebody on this listserver gave me a copy of it quite a while ago.) On the 4.0B machine, I can compile it just fine, but when I run the program I get a core dump: # ./expireone someuser Memory fault - core dumped The only way I can get this program to run successfully on the 4.0B machine is to do the actual compiling on the 3.2d-1 machine, and then copy the resulting binary over to the 4.0B machine: # ./expireone someuser someuser will expire on Mon Jun 30 01:00:00 1997 I've installed the second major patch for 4.0B that Digital has made available, but not the third. I'll be installing that third patch within a week or two just to stay current, but I don't have any reason to suspect that this will fix my problem. Has anyone got any ideas on what may be wrong? I'll summarize any help I get. I've included a copy of my small c program below. Please note that the original program was interactive and that I changed it. It is crude (the date of expiration is now hard-coded!) but does what I need. Thanks for any help you can give me! Paul Youngblood University of Alabama in Huntsville e-mail: youngbloodp@uah.edu ------------ cut ---------- cut ----------- cut ---------- /* Usage: expireone USERNAME This program expires one user at a time. It is no longer interactive, so you can use it in a shell script, within a loop construct to expire a list of users. Just hard code the date for expiration in the code below, recompile, and you are ready to use this program. To compile: cc expireone.c -o expireone -lsecurity */ #include #include #include #include #include #include void error( why ) char *why; { printf( "Error: %s\n", why ); exit(1); } struct pr_passwd *temp; struct pr_passwd ent; main(int argc, char *argv[]) { struct tm timp={0,0,0,0,0,0,}; time_t tp; int i,j; int month,day,year; char instr[200]; set_auth_parameters(); /* This must be done first! */ if (argc == 1) error( "Usage: expire \n" ); temp = getprpwnam(argv[1]); if ( temp==NULL ) error( "Can't find user\n" ); ent=*temp; /*printf("Username: %s\n",ent.ufld.fd_name);*/ /*printf("Date to expire %s? (mm/dd/yy)> ",argv[1]);*/ /*gets( instr );*/ /*if( !instr[0] ) exit( 0 );*/ /*sscanf( instr, "%d/%d/%d", &month, &day, &year );*/ month = 6; day = 30; year = 97; if (month<1 || month>12) error( "Invalid month.\n" ); if (day<1 || day>31) error( "Invalid day.\n" ); if (year<70) error( "Invalid year.\n" ); month--; timp.tm_mon = month; timp.tm_mday = day; timp.tm_year = year; tp=mktime(&timp); ent.ufld.fd_expdate=tp; ent.uflg.fg_expdate=1; printf("%s will expire on %s\n",argv[1],asctime(localtime(&tp))); putprpwnam(argv[1],&ent); }