From b03e162127c0420cb2a0e978433d2dd439b0231f Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Wed, 21 Nov 2001 23:25:30 +0000 Subject: samr_querydom_info level 1: found the meaning of the unknow fields. And discovered that our reply is short by 4 bytes since day 1 of this code. Added a decode function to rpcclient too. splitted the STRING2 fields filling while trying to understand the win9x userlist bug. (didn't fix the bug, but the reply looks closer to NT). J.F. (This used to be commit bfbe7f377e5fcb09e87bfc866196dfc51a8fe64d) --- source3/rpcclient/cmd_samr.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 68a75a70c9..ece2e2a4bd 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -95,6 +95,54 @@ static void display_sam_user_info_21(SAM_USER_INFO_21 *usr) } } +static char *display_time(NTTIME nttime) +{ + static fstring string; + + float high; + float low; + int sec; + int days, hours, mins, secs; + + if (nttime.high==0 && nttime.low==0) + return "Now"; + + if (nttime.high==0x80000000 && nttime.low==0) + return "Never"; + + high = 65536; + high = high/10000; + high = high*65536; + high = high/1000; + high = high * (~nttime.high); + + low = ~nttime.low; + low = low/(1000*1000*10); + + sec=high+low; + + days=sec/(60*60*24); + hours=(sec - (days*60*60*24)) / (60*60); + mins=(sec - (days*60*60*24) - (hours*60*60) ) / 60; + secs=sec - (days*60*60*24) - (hours*60*60) - (mins*60); + + snprintf(string, sizeof(string)-1, "%u days, %u hours, %u minutes, %u seconds", days, hours, mins, secs); + return (string); +} + +static void display_sam_unk_info_1(SAM_UNK_INFO_1 *info1) +{ + + printf("Minimum password length: %d\n", info1->min_length_password); + printf("Password uniqueness (remember x passwords): %d\n", info1->password_history); + printf("flag: "); + if(info1->flag&&2==2) printf("users must open a session to change password "); + printf("\n"); + + printf("password expire in: %s\n", display_time(info1->expire)); + printf("Min password age (allow changing in x days): %s\n", display_time(info1->min_passwordage)); +} + static void display_sam_unk_info_2(SAM_UNK_INFO_2 *info2) { fstring name; @@ -656,6 +704,9 @@ static NTSTATUS cmd_samr_query_dominfo(struct cli_state *cli, /* Display domain info */ switch (switch_value) { + case 1: + display_sam_unk_info_1(&ctr.info.inf1); + break; case 2: display_sam_unk_info_2(&ctr.info.inf2); break; -- cgit