This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
lm_passwd,
nt_passwd,
pdb_encode_acct_ctrl(pdb_get_acct_ctrl(sam_pwent),NEW_PW_FORMAT_SPACE_PADDED_LEN),
- (uint32)pdb_get_pass_last_set_time(sam_pwent));
+ (uint32)convert_time_t_to_uint32(pdb_get_pass_last_set_time(sam_pwent)));
} else {
uid = nametouid(pdb_get_username(sam_pwent));
printf ("%s:%lu:%s\n", pdb_get_username(sam_pwent), (unsigned long)uid,
pdb_get_fullname(sam_pwent));
}
- return 0;
+ return 0;
}
/*********************************************************
fstrcpy(machineaccount, machinename);
fstrcat(machineaccount, "$");
- if ((pwd = getpwnam_alloc(NULL, machineaccount))) {
-
- if ( (sam_pwent = samu_new( NULL )) == NULL ) {
- fprintf(stderr, "Memory allocation error!\n");
- TALLOC_FREE(pwd);
- return -1;
- }
+ if ( !(pwd = getpwnam_alloc( NULL, machineaccount )) ) {
+ DEBUG(0,("Cannot locate Unix account for %s\n", machineaccount));
+ return -1;
+ }
- if ( !NT_STATUS_IS_OK(samu_set_unix(sam_pwent, pwd )) ) {
- fprintf(stderr, "Could not init sam from pw\n");
- TALLOC_FREE(pwd);
- return -1;
- }
+ if ( (sam_pwent = samu_new( NULL )) == NULL ) {
+ fprintf(stderr, "Memory allocation error!\n");
+ TALLOC_FREE(pwd);
+ return -1;
+ }
+ if ( !NT_STATUS_IS_OK(samu_alloc_rid_unix(sam_pwent, pwd )) ) {
+ fprintf(stderr, "Could not init sam from pw\n");
TALLOC_FREE(pwd);
- } else {
- if ( (sam_pwent = samu_new( NULL )) == NULL ) {
- fprintf(stderr, "Could not init sam from pw\n");
- return -1;
- }
+ return -1;
}
+ TALLOC_FREE(pwd);
+
pdb_set_plaintext_passwd (sam_pwent, machinename);
pdb_set_username (sam_pwent, machineaccount, PDB_CHANGED);
pdb_set_acct_ctrl (sam_pwent, ACB_WSTRUST, PDB_CHANGED);