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
= NtProductWinNt
;
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 PrintMessageString(4381);
40 ConPuts(StdOut
, L
"\n");
41 PrintNetMessage(MSG_ACCOUNTS_SYNTAX
);
45 if (_wcsicmp(argv
[i
], L
"/help") == 0)
47 /* Print full help text*/
48 PrintMessageString(4381);
49 ConPuts(StdOut
, L
"\n");
50 PrintNetMessage(MSG_ACCOUNTS_SYNTAX
);
51 PrintNetMessage(MSG_ACCOUNTS_HELP
);
55 if (_wcsicmp(argv
[i
], L
"/domain") == 0)
57 ConPuts(StdErr
, L
"The /DOMAIN option is not supported yet.\n");
64 Status
= NetUserModalsGet(NULL
, 0, (LPBYTE
*)&Info0
);
65 if (Status
!= NERR_Success
)
68 for (i
= 2; i
< argc
; i
++)
70 if (_wcsnicmp(argv
[i
], L
"/forcelogoff:", 13) == 0)
73 if (wcsicmp(p
, L
"no") == 0)
75 Info0
->usrmod0_force_logoff
= TIMEQ_FOREVER
;
80 value
= wcstoul(p
, &endptr
, 10);
83 PrintMessageStringV(3952, L
"/FORCELOGOFF");
88 Info0
->usrmod0_force_logoff
= value
* 60;
92 else if (_wcsnicmp(argv
[i
], L
"/minpwlen:", 10) == 0)
95 value
= wcstoul(p
, &endptr
, 10);
98 PrintMessageStringV(3952, L
"/MINPWLEN");
103 Info0
->usrmod0_min_passwd_len
= value
;
106 else if (_wcsnicmp(argv
[i
], L
"/maxpwage:", 10) == 0)
110 if (wcsicmp(p
, L
"unlimited"))
112 Info0
->usrmod0_max_passwd_age
= ULONG_MAX
;
117 value
= wcstoul(p
, &endptr
, 10);
120 PrintMessageStringV(3952, L
"/MAXPWLEN");
125 Info0
->usrmod0_max_passwd_age
= value
* 86400;
129 else if (_wcsnicmp(argv
[i
], L
"/minpwage:", 10) == 0)
132 value
= wcstoul(p
, &endptr
, 10);
135 PrintMessageStringV(3952, L
"/MINPWAGE");
140 Info0
->usrmod0_min_passwd_age
= value
* 86400;
143 else if (_wcsnicmp(argv
[i
], L
"/uniquepw:", 10) == 0)
146 value
= wcstoul(p
, &endptr
, 10);
149 PrintMessageStringV(3952, L
"/UNIQUEPW");
154 Info0
->usrmod0_password_hist_len
= value
;
159 if (Modified
== TRUE
)
161 Status
= NetUserModalsSet(NULL
, 0, (LPBYTE
)Info0
, &ParamErr
);
162 if (Status
!= NERR_Success
)
167 Status
= NetUserModalsGet(NULL
, 1, (LPBYTE
*)&Info1
);
168 if (Status
!= NERR_Success
)
171 Status
= NetUserModalsGet(NULL
, 3, (LPBYTE
*)&Info3
);
172 if (Status
!= NERR_Success
)
175 RtlGetNtProductType(&ProductType
);
177 PrintPaddedMessageString(4570, nPaddedLength
);
178 if (Info0
->usrmod0_force_logoff
== TIMEQ_FOREVER
)
179 PrintMessageString(4305);
181 ConPrintf(StdOut
, L
"%lu", Info0
->usrmod0_force_logoff
);
182 ConPuts(StdOut
, L
"\n");
184 PrintPaddedMessageString(4572, nPaddedLength
);
185 ConPrintf(StdOut
, L
"%lu\n", Info0
->usrmod0_min_passwd_age
/ 86400);
187 PrintPaddedMessageString(4573, nPaddedLength
);
188 ConPrintf(StdOut
, L
"%lu\n", Info0
->usrmod0_max_passwd_age
/ 86400);
190 PrintPaddedMessageString(4574, nPaddedLength
);
191 ConPrintf(StdOut
, L
"%lu\n", Info0
->usrmod0_min_passwd_len
);
193 PrintPaddedMessageString(4575, nPaddedLength
);
194 if (Info0
->usrmod0_password_hist_len
== 0)
195 PrintMessageString(4303);
197 ConPrintf(StdOut
, L
"%lu", Info0
->usrmod0_password_hist_len
);
198 ConPuts(StdOut
, L
"\n");
200 PrintPaddedMessageString(4578, nPaddedLength
);
201 if (Info3
->usrmod3_lockout_threshold
== 0)
202 PrintMessageString(4305);
204 ConPrintf(StdOut
, L
"%lu", Info3
->usrmod3_lockout_threshold
);
205 ConPuts(StdOut
, L
"\n");
207 PrintPaddedMessageString(4579, nPaddedLength
);
208 ConPrintf(StdOut
, L
"%lu\n", Info3
->usrmod3_lockout_duration
/ 60);
210 PrintPaddedMessageString(4580, nPaddedLength
);
211 ConPrintf(StdOut
, L
"%lu\n", Info3
->usrmod3_lockout_observation_window
/ 60);
213 PrintPaddedMessageString(4576, nPaddedLength
);
214 if (Info1
->usrmod1_role
== UAS_ROLE_PRIMARY
)
216 if (ProductType
== NtProductLanManNt
)
218 PrintMessageString(5070);
220 else if (ProductType
== NtProductServer
)
222 PrintMessageString(5073);
226 PrintMessageString(5072);
231 PrintMessageString(5071);
233 ConPuts(StdOut
, L
"\n");
238 NetApiBufferFree(Info3
);
241 NetApiBufferFree(Info1
);
244 NetApiBufferFree(Info0
);