tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* V5.1 problems with putespwnam()
@ 2001-05-25  2:36 Tom Leffingwell
  0 siblings, 0 replies; only message in thread
From: Tom Leffingwell @ 2001-05-25  2:36 UTC (permalink / raw)
  To: tru64-unix-managers


Hello,

	I recently updated a system from V4.0D to V5.1.  Actually, V5.1
was a clean install.  I wrote a program in V4.0 to automate some of our
account creation needs, and it worked great, however, in 5.1 putespwnam()
returns 0, and fails.  I tried recompiling, but that didn't help.  The
source chunk below shows the what we did with the structure, pr1.  I can
include more if anyone is interested.  The program hasn't been touched
between versions.  Anyway, there is some change in behaviour between 4.0D
and V5.1 that seems to be causing the problem.  Has anyone had similiar
problems?

Source:

/* Set tcb tags for user */

pr1=malloc(sizeof(*pr1));
pr1->ufld=malloc(sizeof(*pr1->ufld));
pr1->uflg=malloc(sizeof(*pr1->uflg));
pr1->sfld=NULL;
pr1->sflg=NULL;
pr1->ubuf=NULL;
pr1->fieldlen=sizeof(*pr1->ufld);
pr1->ufld->fd_name=malloc(sizeof(username));

bzero((char *) pr1->ufld,sizeof(*pr1->ufld));
bzero((char *) pr1->uflg,sizeof(*pr1->uflg));
pr1->ufld->fd_name=malloc(sizeof(username));

strcpy(pr1->ufld->fd_name,username);		/* Set username */
pr1->uflg->fg_name=1;

pr1->ufld->fd_uid=uid;				/* Set uid	*/
pr1->uflg->fg_uid=1;

pr1->ufld->fd_encrypt=big_crypt(password);	/* Set password */
pr1->uflg->fg_encrypt=1;

pr1->ufld->fd_lock=0;				/* Unlock account */
pr1->uflg->fg_lock=1;

pr1->ufld->fd_psw_chg_reqd=1;			/* Require password change */
pr1->uflg->fg_psw_chg_reqd=1;

pr1->ufld->fd_restrict=1;			/* Prevent user from using */
pr1->uflg->fg_restrict=1;			/* stupid passwords */

/* Add user account to protected password database. */

printf("%s\n",username);

if (0 == putespwnam(username, pr1))
	{
	fprintf(stderr, "Failed to add %s to the protected password database.\n",username);
	endprpwent();
	exit(1);
	}
else
	{
	fprintf(stdout, "Added %s to the protected password database.\n",username);
	endprpwent();
	}


Thanks,

Tom

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-25  2:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-25  2:36 V5.1 problems with putespwnam() Tom Leffingwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox