tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "Paul N. Youngblood" <youngbp () email ! uah ! edu>
To: tru64-unix-managers
Subject: SUMMARY: C program won't run on DU 4.0B
Date: Thu, 12 Jun 1997 22:25:34 +0000	[thread overview]
Message-ID: <96078613510423.tru64-unix-managers.marc@archive.invalid> (raw)

Hello Managers,

This list is terrific as usual!  Fast answers to 
my problem came from:
 
 Randy M. Hayman <haymanr@icefog.sois.alaska.edu>
 Marco Campani <campa@ge.INFM.it>

Both said that I should change this line in my program:
   set_auth_parameters();	
to this:           
   set_auth_parameters(argc, argv);
This solved my problem.  Thanks, Randy and Marco!
Now when I compile it on DU 4.0B it runs fine.

Also, very helpful were:
 Pam Woods, Systems Manager <axsymgr@UAA.ALASKA.EDU>
 John P. Speno <speno@swarthmore.edu>
 Jo Knox <fxjwk@aurora.alaska.edu
Thank you all for responding.  My original post is below.

Paul Youngblood
University of Alabama in Huntsville

------- Original Post ---------------------------------

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 <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/security.h>
#include <prot.h>

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 <username>\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);

}

                 reply	other threads:[~1997-06-12 22:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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