*/
#include "includes.h"
+#include "popt_common.h"
+#include "../librpc/gen_ndr/samr.h"
+#include "../libcli/security/security.h"
+#include "passdb.h"
#define BIT_BACKEND 0x00000004
#define BIT_VERBOSE 0x00000008
#define MASK_ALWAYS_GOOD 0x0000001F
#define MASK_USER_GOOD 0x60405FE0
-static int get_sid_from_cli_string(DOM_SID *sid, const char *str_sid)
+static int get_sid_from_cli_string(struct dom_sid *sid, const char *str_sid)
{
uint32_t rid;
while (u_search->next_entry(u_search, &userentry)) {
struct samu *user;
struct samu *account;
- DOM_SID user_sid;
+ struct dom_sid user_sid;
DEBUG(4, ("Processing account %s\n", userentry.account_name));
static int export_groups (struct pdb_methods *in, struct pdb_methods *out)
{
- GROUP_MAP *maps = NULL;
+ GROUP_MAP **maps = NULL;
size_t i, entries = 0;
NTSTATUS status;
}
for (i=0; i<entries; i++) {
- out->add_group_mapping_entry(out, &(maps[i]));
+ out->add_group_mapping_entry(out, maps[i]);
}
- SAFE_FREE( maps );
+ TALLOC_FREE(maps);
return 0;
}
int i;
for (i=1; decode_account_policy_name(i) != NULL; i++) {
- uint32 policy_value;
+ uint32_t policy_value;
if (!account_policy_get_default(i, &policy_value)) {
fprintf(stderr, "Can't get default account policy\n");
return -1;
int i;
for ( i=1; decode_account_policy_name(i) != NULL; i++ ) {
- uint32 policy_value;
+ uint32_t policy_value;
NTSTATUS status;
status = in->get_account_policy(in, i, &policy_value);
if (verbosity) {
char temp[44];
- const uint8 *hours;
+ const uint8_t *hours;
printf ("Unix username: %s\n", pdb_get_username(sam_pwent));
printf ("NT username: %s\n", pdb_get_nt_username(sam_pwent));
lm_passwd,
nt_passwd,
pdb_encode_acct_ctrl(pdb_get_acct_ctrl(sam_pwent),NEW_PW_FORMAT_SPACE_PADDED_LEN),
- (uint32)convert_time_t_to_uint32(pdb_get_pass_last_set_time(sam_pwent)));
+ (uint32)convert_time_t_to_uint32_t(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,
struct samr_displayentry userentry;
struct samu *sam_pwent;
TALLOC_CTX *tosctx;
- DOM_SID user_sid;
+ struct dom_sid user_sid;
bool bret;
int ret;
struct samr_displayentry userentry;
struct samu *sam_pwent;
TALLOC_CTX *tosctx;
- DOM_SID user_sid;
+ struct dom_sid user_sid;
NTSTATUS status;
bool bret;
int ret;
uint32_t acb_flags;
uint32_t not_settable;
uint32_t new_flags;
- DOM_SID u_sid;
+ struct dom_sid u_sid;
bool ret;
sam_pwent = samu_new(NULL);
hours_len = pdb_get_hours_len(sam_pwent);
memset(hours_array, 0xff, hours_len);
- pdb_set_hours(sam_pwent, hours_array, PDB_CHANGED);
+ pdb_set_hours(sam_pwent, hours_array, hours_len, PDB_CHANGED);
}
if (!pdb_update_autolock_flag(sam_pwent, &updated_autolock)) {
return -1;
}
- value = convert_uint32_to_time_t(num);
+ value = convert_uint32_t_to_time_t(num);
}
pdb_set_kickoff_time(sam_pwent, value, PDB_CHANGED);
uint32_t acb_flags;
uint32_t not_settable;
uint32_t new_flags;
- DOM_SID m_sid;
+ struct dom_sid m_sid;
char *name;
int len;
bool ret;
return -1;
}
- strlower_m(name);
+ if (!strlower_m(name)) {
+ fprintf(stderr, "strlower_m %s failed\n", name);
+ TALLOC_FREE(sam_pwent);
+ return -1;
+ }
ret = pdb_getsampwnam(sam_pwent, name);
if (!ret) {
struct samu *sam_pwent = NULL;
TALLOC_CTX *tosctx;
NTSTATUS status;
- DOM_SID u_sid;
+ struct dom_sid u_sid;
int flags;
int ret;
struct samu *sam_pwent = NULL;
TALLOC_CTX *tosctx;
NTSTATUS status;
- DOM_SID m_sid;
+ struct dom_sid m_sid;
char *compatpwd;
char *name;
int flags;
return -1;
}
- strlower_m(name);
+ if (!strlower_m(name)) {
+ fprintf(stderr, "strlower_m %s failed\n", name);
+ return -1;
+ }
flags = LOCAL_ADD_USER | LOCAL_TRUST_ACCOUNT | LOCAL_SET_PASSWORD;
if (!pdb_getsampwnam(samaccount, name)) {
fprintf (stderr,
"machine %s does not exist in the passdb\n", name);
- return -1;
TALLOC_FREE(samaccount);
+ return -1;
}
if (!NT_STATUS_IS_OK(pdb_delete_sam_account(samaccount))) {
load_case_tables();
- setup_logging("pdbedit", True);
+ setup_logging("pdbedit", DEBUG_STDOUT);
pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
if (user_name == NULL)
user_name = poptGetArg(pc);
- if (!lp_load(get_dyn_CONFIGFILE(),True,False,False,True)) {
+ if (!lp_load_global(get_dyn_CONFIGFILE())) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", get_dyn_CONFIGFILE());
exit(1);
}
/* HACK: set the global passdb backend by overwriting globals.
* This way we can use regular pdb functions for default
* operations that do not involve passdb migrations */
- lp_set_passdb_backend(backend);
+ lp_set_cmdline("passdb backend", backend);
} else {
backend = lp_passdb_backend();
}
/* account policy operations */
if ((checkparms & BIT_ACCPOLICY) && !(checkparms & ~(BIT_ACCPOLICY + BIT_ACCPOLVAL))) {
- uint32 value;
+ uint32_t value;
enum pdb_policy_type field = account_policy_name_to_typenum(account_policy);
if (field == 0) {
const char **names;
int count;
int i;
- account_policy_names_list(&names, &count);
+ account_policy_names_list(talloc_tos(), &names, &count);
fprintf(stderr, "No account policy by that name!\n");
if (count !=0) {
fprintf(stderr, "Account policy names are:\n");
d_fprintf(stderr, "%s\n", names[i]);
}
}
- SAFE_FREE(names);
+ TALLOC_FREE(names);
exit(1);
}
if (!pdb_get_account_policy(field, &value)) {