Operating System - OpenVMS
1831450 Members
3051 Online
110025 Solutions
New Discussion

System Management Utilities Reference (UAI$_PWD_LIFETIME)

 
SOLVED
Go to solution
Sentosa
Frequent Advisor

System Management Utilities Reference (UAI$_PWD_LIFETIME)

Hi folks,

When i used System Management Utilities Reference (UAI$_PWD_LIFETIME) in the C program to get the value of pwdlifetime from sysuaf, i can get the value (1 00:00:00.005:23.98) for specific user if pwdlifetime is set to 1.

However, i can get the value (17-NOV-1858 00:00:00.00) if the pwdlifetime is set to (NONE).

I don't know why the value has been changed to date format.

Is it 17-Nov-1858 represents (none) in the sysuaf? if yes, Why?


Thank you very much for answer !

Regards,
Sentosa



9 REPLIES 9
Wim Van den Wyngaert
Honored Contributor

Re: System Management Utilities Reference (UAI$_PWD_LIFETIME)

FWIW : I have a pascal program that also requests the lifetime and it returns "(None)". It doesn't do any processing on the return value (in a string).

Wim

Wim
Hein van den Heuvel
Honored Contributor
Solution

Re: System Management Utilities Reference (UAI$_PWD_LIFETIME)

Sentosa,

Yes, 17-Nov-1858 is special.
It is the 'null' date for OpenVMS.
Just google for further details... or... get this... read the OpenVMS Documentatio... or, read teh OpenVMS FAQ!

Positive Time values are DATE+TIME in OpenVMS
Negative values are DELTA TIMES.

You need to special case 0.

There are lots of existing tools in this space. Google for them!

I posted one of those tools in a prior post on this subject i made:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=819355

Hope this helps,
Hein.
HvdH Performance Consulting.
Thomas Ritter
Respected Contributor

Re: System Management Utilities Reference (UAI$_PWD_LIFETIME)

Sentosa, as the others wrote we also just change the field. Looks much better in reports and saves questions.


if ( strstr(ascii_lastlogin_i,"17-NOV-1858") ) strcpy(ascii_lastlogin_i,"NEVER");

Sentosa
Frequent Advisor

Re: System Management Utilities Reference (UAI$_PWD_LIFETIME)

Hi Hein.,

How to set negative values in the pwdlifetime in the mc authorize?

Could you explain the meaning of "You need to special case 0"?

How can i check the existing tools in the space?

Thank you for your help

Sentosa

Re: System Management Utilities Reference (UAI$_PWD_LIFETIME)

The "problem" is not in uaf access routine.

The "problem" is, that the value for the pwd lifetime is a DELTA time. Delta times are represented as negative quadword values in memory.

When you ask for the uaf value, you cal get
-) a value of zero (binary 0) or
-) a negative binary quadword value

When you use any routine to format the uad time into an ascii representation the zerop value is translated into 17-Nov-1858 (the famous vms null date :-) ). A negative value is formatted as a delta time (time intervall) string (n nn:nn:...)

As there is no representation for a negative 0 VMS cannot detect the formatting you would expect (either date or delta time with all values 0).

Its up to you to check for 0 and process it directly.

An for the question how to enter:
-) using DCL you do not enter negative values, you enter delte time values which are represented as negative values
-) using some code this should be transparent to you too if you use some of the standard conversion routines.

Hope that helps

Martin
Thomas Ritter
Respected Contributor

Re: System Management Utilities Reference (UAI$_PWD_LIFETIME)

We convert the time format

For examaple

if (((status = SYS$ASCTIM(0, &lastlogin_i_desc, lastlogin_i, 0)) &1) != 1)
LIB$STOP(status);

Re: System Management Utilities Reference (UAI$_PWD_LIFETIME)

Thomas,

I think there is a small difference between your example and the original question.

PWD_LIFETIME is a delta time (time interval) while the last login time is always a date time (a positive value in memory).

Martin
Sentosa
Frequent Advisor

Re: System Management Utilities Reference (UAI$_PWD_LIFETIME)

Hi folks,

What is the meaning of positive time values & negative time values in the memory?
If pwdlifetime set to 0, (none) will display in mc authorize sh command.
So, 0 is positive or negative values?

Thanks for your answer

Sentosa
Hein van den Heuvel
Honored Contributor

Re: System Management Utilities Reference (UAI$_PWD_LIFETIME)

Sentosa,

You really need to make a quick read through:
"OpenVMS Programming Concepts Manual"
"27.1 System Time Format"
27.1 System Time Format
http://h71000.www7.hp.com/doc/731FINAL/5841/5841pro_070.html#111_thesystemtimeformat

>> What is the meaning of positive time values & negative time values in the memory?

Time is stored as a 64 bite signed int.
Negative values have the MSB bit set.

>> If pwdlifetime set to 0, (none) will display in mc authorize sh command.

That's because authorize special cases the binary value 0.
You should probably also do that.
Somethig along the lines of...
if (time == 0) {
offset++ = sprintf (&display_buffer[offset], "(none)");
} else {
stat = sys$asctim ....

>> So, 0 is positive or negative values?

VMS displays a date. Ergo: Positive!
IMHO this in unfortunate, as a 0 delta time is much more useful than a 17-Nov-1858 date.

Cheers,
Hein.