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_at_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 <osf_at_python.corning.com>
To: "Pam Woods, Systems Manager" <axsymgr_at_UAA.ALASKA.EDU>
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_at_AURORA.ALASKA.EDU Uaf Systems */
#include <stdio.h>
#include <time.h>
#include <locale.h>
#include <sys/types.h>
#include <sys/security.h>
#include <prot.h>
#include <sys/stat.h>
#include <errno.h>
/* 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_at_uaa.alaska.edu
Received on Fri May 16 1997 - 20:22:09 NZST