2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS net command
4 * FILE: base/applications/network/net/cmdAccounts.c
7 * PROGRAMMERS: Eric Kohl
17 PUSER_MODALS_INFO_0 Info0
= NULL
;
18 PUSER_MODALS_INFO_1 Info1
= NULL
;
19 PUSER_MODALS_INFO_3 Info3
= NULL
;
20 NT_PRODUCT_TYPE ProductType
;
26 BOOL Modified
= FALSE
;
30 INT nPaddedLength
= 58;
31 NET_API_STATUS Status
;
34 for (i
= 2; i
< argc
; i
++)
36 if (_wcsicmp(argv
[i
], L
"help") == 0)
38 /* Print short syntax help */
39 ConResPuts(StdOut
, IDS_GENERIC_SYNTAX
);
40 PrintNetMessage(MSG_ACCOUNTS_SYNTAX
);
44 if (_wcsicmp(argv
[i
], L
"/help") == 0)
46 /* Print full help text*/
47 ConResPuts(StdOut
, IDS_GENERIC_SYNTAX
);
48 PrintNetMessage(MSG_ACCOUNTS_SYNTAX
);
49 PrintNetMessage(MSG_ACCOUNTS_HELP
);
53 if (_wcsicmp(argv
[i
], L
"/domain") == 0)
55 ConResPrintf(StdErr
, IDS_ERROR_OPTION_NOT_SUPPORTED
, L
"/DOMAIN");
62 Status
= NetUserModalsGet(NULL
, 0, (LPBYTE
*)&Info0
);
63 if (Status
!= NERR_Success
)
66 for (i
= 2; i
< argc
; i
++)
68 if (_wcsnicmp(argv
[i
], L
"/forcelogoff:", 13) == 0)
71 if (wcsicmp(p
, L
"no"))
73 Info0
->usrmod0_force_logoff
= TIMEQ_FOREVER
;
78 value
= wcstoul(p
, &endptr
, 10);
81 ConResPrintf(StdErr
, IDS_ERROR_INVALID_OPTION_VALUE
, L
"/FORCELOGOFF");
86 Info0
->usrmod0_force_logoff
= value
* 60;
90 else if (_wcsnicmp(argv
[i
], L
"/minpwlen:", 10) == 0)
93 value
= wcstoul(p
, &endptr
, 10);
96 ConResPrintf(StdErr
, IDS_ERROR_INVALID_OPTION_VALUE
, L
"/MINPWLEN");
101 Info0
->usrmod0_min_passwd_len
= value
;
104 else if (_wcsnicmp(argv
[i
], L
"/maxpwage:", 10) == 0)
108 if (wcsicmp(p
, L
"unlimited"))
110 Info0
->usrmod0_max_passwd_age
= ULONG_MAX
;
115 value
= wcstoul(p
, &endptr
, 10);
118 ConResPrintf(StdErr
, IDS_ERROR_INVALID_OPTION_VALUE
, L
"/MAXPWLEN");
123 Info0
->usrmod0_max_passwd_age
= value
* 86400;
127 else if (_wcsnicmp(argv
[i
], L
"/minpwage:", 10) == 0)
130 value
= wcstoul(p
, &endptr
, 10);
133 ConResPrintf(StdErr
, IDS_ERROR_INVALID_OPTION_VALUE
, L
"/MINPWAGE");
138 Info0
->usrmod0_min_passwd_age
= value
* 86400;
141 else if (_wcsnicmp(argv
[i
], L
"/uniquepw:", 10) == 0)
144 value
= wcstoul(p
, &endptr
, 10);
147 ConResPrintf(StdErr
, IDS_ERROR_INVALID_OPTION_VALUE
, L
"/UNIQUEPW");
152 Info0
->usrmod0_password_hist_len
= value
;
157 if (Modified
== TRUE
)
159 Status
= NetUserModalsSet(NULL
, 0, (LPBYTE
)Info0
, &ParamErr
);
160 if (Status
!= NERR_Success
)
165 Status
= NetUserModalsGet(NULL
, 1, (LPBYTE
*)&Info1
);
166 if (Status
!= NERR_Success
)
169 Status
= NetUserModalsGet(NULL
, 3, (LPBYTE
*)&Info3
);
170 if (Status
!= NERR_Success
)
173 RtlGetNtProductType(&ProductType
);
175 PrintPaddedResourceString(IDS_ACCOUNTS_FORCE_LOGOFF
, nPaddedLength
);
176 if (Info0
->usrmod0_force_logoff
== TIMEQ_FOREVER
)
177 ConResPuts(StdOut
, IDS_GENERIC_NEVER
);
179 ConResPrintf(StdOut
, IDS_ACCOUNTS_LOGOFF_SECONDS
, Info0
->usrmod0_force_logoff
);
180 ConPuts(StdOut
, L
"\n");
182 PrintPaddedMessageString(4572, nPaddedLength
);
183 ConPrintf(StdOut
, L
"%lu\n", Info0
->usrmod0_min_passwd_age
/ 86400);
185 PrintPaddedMessageString(4573, nPaddedLength
);
186 ConPrintf(StdOut
, L
"%lu\n", Info0
->usrmod0_max_passwd_age
/ 86400);
188 PrintPaddedMessageString(4574, nPaddedLength
);
189 ConPrintf(StdOut
, L
"%lu\n", Info0
->usrmod0_min_passwd_len
);
191 PrintPaddedMessageString(4575, nPaddedLength
);
192 if (Info0
->usrmod0_password_hist_len
== 0)
193 ConResPuts(StdOut
, IDS_GENERIC_NONE
);
195 ConPrintf(StdOut
, L
"%lu", Info0
->usrmod0_password_hist_len
);
196 ConPuts(StdOut
, L
"\n");
198 PrintPaddedMessageString(4578, nPaddedLength
);
199 if (Info3
->usrmod3_lockout_threshold
== 0)
200 ConResPuts(StdOut
, IDS_GENERIC_NEVER
);
202 ConPrintf(StdOut
, L
"%lu", Info3
->usrmod3_lockout_threshold
);
203 ConPuts(StdOut
, L
"\n");
205 PrintPaddedMessageString(4579, nPaddedLength
);
206 ConPrintf(StdOut
, L
"%lu\n", Info3
->usrmod3_lockout_duration
/ 60);
208 PrintPaddedMessageString(4580, nPaddedLength
);
209 ConPrintf(StdOut
, L
"%lu\n", Info3
->usrmod3_lockout_observation_window
/ 60);
211 PrintPaddedMessageString(4576, nPaddedLength
);
212 if (Info1
->usrmod1_role
== UAS_ROLE_PRIMARY
)
214 if (ProductType
== NtProductLanManNt
)
216 ConResPuts(StdOut
, IDS_ACCOUNTS_PRIMARY_SERVER
);
218 else if (ProductType
== NtProductServer
)
220 ConResPuts(StdOut
, IDS_ACCOUNTS_STANDALONE_SERVER
);
224 ConResPuts(StdOut
, IDS_ACCOUNTS_WORKSTATION
);
229 ConResPuts(StdOut
, IDS_ACCOUNTS_BACKUP_SERVER
);
231 ConPuts(StdOut
, L
"\n");
236 NetApiBufferFree(Info3
);
239 NetApiBufferFree(Info1
);
242 NetApiBufferFree(Info0
);