Article 156472 of comp.os.vms:
In article <32555550.359@Shsu.edu>, "James T. Horn" <Horn@Shsu.edu> writes:
> Karsten Nyblad wrote:
>> 
>> A McIntosh <a.mcintosh@lilly.com> writes:
>> 
>> >Hi
>> >I want to extract the expiry date from a sysuaf and display it
>> >in a readable form (Without doing a 'mc authorize list')
>>
> 
> Look at getting the program UAF 
> (nic.switch.ch/mirror/vms/DECUS/vms94b/tk/uaf.zip)
> 
> which will give you expiration date in a symbol.
and here is another, which lets you take action if that date is less than
one month away (inspired by Carl Lydick, since I do not really know C).
Sorry, can't remember if I posted this recently, or just sent it to someone.
========================
#include uaidef
#include jpidef
#include descrip
#define ckstat(x) if (((stat = x) & 7) != 1) SYS$EXIT(stat)

main()
{	unsigned long stat, SYS$EXIT(), SYS$GETTIM(), SYS$ASCTIM(),
		SYS$BINTIM(), SYS$GETJPIW(), SYS$GETUAI();
	static long timadr[2], expiration[2], month[2], timetogo[2], expmm[2];
	static char nambuf[33], buffer[33];
	static $DESCRIPTOR(timbuf, buffer);
	static $DESCRIPTOR(usrnam, nambuf);
	$DESCRIPTOR(monthbuf, "0030 00:00:00.00");
	unsigned short timlen, dummy;
	struct ITEM_LIST_3
	{	unsigned short buflen, itmcod;
		unsigned long bufadr, rsladr;
	} jpilst[] =
	{	{	32, JPI$_USERNAME, nambuf, &usrnam.dsc$w_length },
		{	0, 0, 0, 0 }
	}, uailst[] =
	{	{	8, UAI$_EXPIRATION, expiration, 0 },
		{	0, 0, 0, 0 }
	};
	void puts();
	unsigned short iosb[4];

	ckstat(SYS$GETJPIW(0, 0, 0, jpilst, iosb, 0, 0));
	ckstat(iosb[0]);
	ckstat(SYS$GETUAI(0, 0, &usrnam, uailst, 0, 0, 0));

/*	dummy = expiration[0];
	printf("expiration0= %x\n", dummy);
	dummy = expiration[1];
	printf("expiration1= %x\n", dummy);
   Jump out if unlimited account (i.e., expiration = 0)                    */
	if((expiration[0] == 0) && (expiration[1] == 0))   SYS$EXIT(1);

/*	ckstat(SYS$ASCTIM(&timlen, &timbuf, expiration, 0));
	buffer[timlen] = '\0';
	printf("timlen= %d\n", timlen);
	printf("This account will expire on %s\n", buffer);               

    expmm = expiration - 1 month                                          */

	ckstat(SYS$BINTIM(&monthbuf, month));
	ckstat(LIB$SUB_TIMES(expiration, month, expmm));
/*	dummy = expmm[0];
	printf("new expmm0= %x\n", dummy);
	dummy = expmm[1];
	printf("new expmm1= %x\n", dummy);
*/
	ckstat(SYS$ASCTIM(&timlen, &timbuf, expmm, 0));
/*	buffer[timlen] = '\0';
	printf("timlen= %d\n", timlen);
	printf("new expiration = expir-month %s\n", buffer);
*/
	ckstat(SYS$GETTIM(timadr));
	ckstat(LIB$SUBX(expmm, timadr, timetogo ));
/*	dummy = timetogo[0];
	printf("timetogo0 hex= %x\n", dummy);
	printf("timetogo0 dec= %d\n", dummy);
	dummy = timetogo[1];
	printf("timetogo1 hex= %x\n", dummy);
	printf("timetogo1 dec= %d\n", dummy);

   Jump out if expiration is more than a month away                    */
	if((timetogo[1] & 0x80000000) == 0)   SYS$EXIT(1);

/*	ckstat(SYS$ASCTIM(&timlen, &timbuf, timetogo, 0));
	buffer[timlen] = '\0';
	printf("timlen= %d\n", timlen);
	printf("Your account has this much timetogo %s\n", buffer);
*/

	ckstat(SYS$ASCTIM(&timlen, &timbuf, expiration, 0));
	buffer[timlen] = '\0';
/*	printf("timlen= %d\n", timlen);                                */

	printf("  \n");
	printf("  \n");
	printf("  \n");
	printf("  ================================================== \n");
       printf("Please note that your account is due to expire on %s\n", buffer);
	printf("Backup your files, if desired, before this date. \n");
	printf("Your files WILL BE DELETED. \n");
	printf("  \n");
printf("Contact OPTEAM by email if you believe your account should not expire.\n");
	printf("  ================================================== \n");
	printf("  \n");

	SYS$EXIT(1);
}


-- 
Brendan Welch, system analyst, UMass/Lowell, W1LPG,  welchb@woods.uml.edu


