From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078612210439.tru64-unix-managers.marc@archive.invalid> From: "Pam Woods, Systems Manager" Date: Fri, 16 May 1997 18:02:13 +0000 To: tru64-unix-managers Subject: SUMM:Re: removing u_expdates (new) X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078612210439 Someone complained I didn't post the source code as part of the solution. Here it is. I used the .c example instead of the Awk ... Be warned the C code should be using the expire dates from the default account - /etc/auth/system/default - in theory. If it doesn't behave as you expect, check the default template settings. For me, it removed the field entirely which is what I wanted. Talk to Fxjwk@aurora.alaska.edu for more info as he's sent this c program. ----------------------------------- Date: Wed, 14 May 1997 08:24:24 -0400 (EDT) From: alpha-osf-manager email acct To: "Pam Woods, Systems Manager" Subject: Re: removing u_expdates awk -F':' '{print $1":"$2":"$3":"$4":"}' INPUTFILE > OUTPUTFILE the -F defines the seperator the $1,$2,... are the elements just omit the element you don't wish to include ---------------------------------------------- cat set_expire_current.c /* From: FXJWK@AURORA.ALASKA.EDU Uaf Systems */ #include #include #include #include #include #include #include #include /* This retrieves protected password database entry for user given as argument, and sets that user's expire flag & date to the system defaults... * / main(argc, argv) int argc; char *argv[]; { struct pr_passwd *pr; /* returned value */ struct pr_passwd pwbuf; /* buffer for saved values */ char tstr[80], strng[80], str2[80]; int i, error(), my_t(); time_t now; struct stat fbuf; /* file buffer */ set_auth_parameters(); /* Retrieve the user's protected password database entry */ pr = getprpwnam( argv[1] ); if (!pr) error( "getprpwnam failed to retrieve specified user's db entry." ); /* store values of entry to a local buffer */ pwbuf = *pr; pwbuf.uflg.fg_expdate = pwbuf.sflg.fg_expdate; pwbuf.ufld.fd_expdate = pwbuf.sfld.fd_expdate; if( !putprpwnam( argv[1], &pwbuf ) ) error( "putprpwnam failed to update protect ed password entry!\n" ); exit(0); } int error( why ) char *why; { printf( "Error: %s\n", why ); exit( -1 ); } /* cc set_expire_current.c -lsecurity -o setexpcur */ ----------- and here's a script to use that c program ---- #! /bin/ksh # # For all users in ids_fix_expire, set expire date to current system default # for User in `cat ids_fix_expire` do echo $User >>set_expire_current.log ./setexpcur $User >>set_expire_current.log done (I put the echo in there so I 'd know what user it was on when it burped.) ________ Pam Woods - axsymgr@uaa.alaska.edu