BOOL ldap_allocaterid(uint32 *rid);
struct smb_passdb_ops *ldap_initialise_password_db(void);
+/*The following definitions come from passdb/mysqlpass.c */
+
+int mysql_db_lock_connect( MYSQL *handle );
+void *mysql_startpwent( BOOL update );
+void mysql_endpwent( void *ptr );
+SMB_BIG_UINT mysql_getpwpos(void *vp);
+BOOL mysql_setpwpos(void *vp, SMB_BIG_UINT pos);
+void *mysql_fill_smb_passwd( MYSQL_ROW *row );
+struct smb_passwd *mysql_getsmbpwent(void *vp);
+void *mysql_fetch_passwd( void *(*filler)(MYSQL_ROW*), char *where );
+void *mysql_getpwuid(void *(*filler)(MYSQL_ROW *), uid_t uid);
+struct smb_passwd *mysql_getsmbpwuid(uid_t uid);
+void *mysql_getpwnam(void *(*filler)(MYSQL_ROW *), char *field, const char *name);
+struct smb_passwd *mysql_getsmbpwnam(const char *unix_name);
+BOOL mysql_del_smb( MYSQL *handle, char *unix_name );
+BOOL mysql_add_smb( MYSQL *handle, struct smb_passwd *smb );
+BOOL mysql_mod_smb( MYSQL *handle, struct smb_passwd *smb, BOOL override );
+BOOL mysql_add_smbpwd_entry(struct smb_passwd *smb);
+BOOL mysql_mod_smbpwd_entry(struct smb_passwd *smb, BOOL override);
+struct smb_passdb_ops *mysql_initialise_password_db(void);
+
+/*The following definitions come from passdb/mysqlsampass.c */
+
+void *mysql_fill_sam_passwd( MYSQL_ROW *row );
+struct sam_passwd *mysql_getsampwent(void *vp);
+struct sam_passwd *mysql_getsampwrid(uint32 rid);
+struct sam_passwd *mysql_getsampwuid(uid_t uid);
+struct sam_passwd *mysql_getsampwntnam(const char *nt_name);
+struct sam_disp_info *mysql_getsamdispntnam(const char *nt_name);
+struct sam_disp_info *mysql_getsamdisprid(uint32 rid);
+struct sam_disp_info *mysql_getsamdispent(void *vp);
+BOOL mysql_add_sampwd_entry(struct sam_passwd *sam);
+BOOL mysql_mod_sampwd_entry(struct sam_passwd *sam, BOOL override);
+struct sam_passdb_ops *mysql_initialise_sam_password_db(void);
+
/*The following definitions come from passdb/nispass.c */
struct passdb_ops *nisplus_initialise_password_db(void);
void smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth);
void make_strhdr2(STRHDR2 *hdr, uint32 max_len, uint32 len, uint32 buffer);
void smb_io_strhdr2(char *desc, STRHDR2 *hdr, prs_struct *ps, int depth);
-void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint32 buffer);
+void make_uni_hdr(UNIHDR *hdr, int len);
void smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth);
void make_buf_hdr(BUFHDR *hdr, int max_len, int len);
void smb_io_hdrbuf_pre(char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset);
void smb_io_hdrbuf_post(char *desc, BUFHDR *hdr, prs_struct *ps, int depth,
uint32 ptr_hdrbuf, uint32 max_len, uint32 len);
void smb_io_hdrbuf(char *desc, BUFHDR *hdr, prs_struct *ps, int depth);
-void make_uni_hdr2(UNIHDR2 *hdr, int max_len, int len, uint16 terminate);
+void make_uni_hdr2(UNIHDR2 *hdr, int len);
void smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth);
void make_unistr(UNISTR *str, char *buf);
void smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth);
len = dom_name != NULL ? strlen(dom_name) : 0;
- make_uni_hdr(&(ref->hdr_ref_dom[num].hdr_dom_name), len, len, len != 0 ? 1 : 0);
+ make_uni_hdr(&(ref->hdr_ref_dom[num].hdr_dom_name), len);
ref->hdr_ref_dom[num].ptr_dom_sid = dom_sid != NULL ? 1 : 0;
make_unistr2 (&(ref->ref_dom[num].uni_dom_name), dom_name, len);
int len_name = strlen(name);
trn->sid_name_use = sid_name_use;
- make_uni_hdr(&(trn->hdr_name), len_name, len_name, 1);
+ make_uni_hdr(&(trn->hdr_name), len_name);
make_unistr2(uni_name, name, len_name);
trn->domain_idx = idx;
}
memcpy(&(q_o->pol), pol_hnd, sizeof(q_o->pol));
- make_uni_hdr(&(q_o->hdr_secret), len, len, 1);
+ make_uni_hdr(&(q_o->hdr_secret), len);
make_unistr2(&(q_o->uni_secret), secret_name, len);
q_o->des_access = desired_access;
r_e->ptr_enum_domains = 1;
r_e->num_domains2 = 1;
- make_uni_hdr2(&(r_e->hdr_domain_name ), len_domain_name, len_domain_name, 4);
+ make_uni_hdr2(&(r_e->hdr_domain_name ), len_domain_name);
make_unistr2 (&(r_e->uni_domain_name ), domain_name, len_domain_name);
make_dom_sid2(&(r_e->other_domain_sid), domain_sid);
}
{
const char* name = names[i];
int len = strlen(name);
- make_uni_hdr(&q_l->hdr_name[i], len, len, len != 0);
+ make_uni_hdr(&q_l->hdr_name[i], len);
make_unistr2(&q_l->uni_name[i], name, len);
}
/*******************************************************************
creates a UNIHDR structure.
********************************************************************/
-void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint32 buffer)
+void make_uni_hdr(UNIHDR *hdr, int len)
{
hdr->uni_str_len = 2 * len;
- hdr->uni_max_len = 2 * max_len;
- hdr->buffer = buffer;
+ hdr->uni_max_len = 2 * len;
+ hdr->buffer = len != 0 ? 1 : 0;
}
/*******************************************************************
/*******************************************************************
creates a UNIHDR2 structure.
********************************************************************/
-void make_uni_hdr2(UNIHDR2 *hdr, int max_len, int len, uint16 terminate)
+void make_uni_hdr2(UNIHDR2 *hdr, int len)
{
- make_uni_hdr(&(hdr->unihdr), max_len, len, terminate);
+ make_uni_hdr(&(hdr->unihdr), len);
hdr->buffer = len > 0 ? 1 : 0;
}
id->ptr_id_info1 = 1;
- make_uni_hdr(&(id->hdr_domain_name), len_domain_name, len_domain_name, 4);
+ make_uni_hdr(&(id->hdr_domain_name), len_domain_name);
id->param_ctrl = param_ctrl;
make_logon_id(&(id->logon_id), log_id_low, log_id_high);
- make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4);
- make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4);
+ make_uni_hdr(&(id->hdr_user_name ), len_user_name );
+ make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name );
if (lm_cypher && nt_cypher)
{
id->ptr_id_info2 = 1;
- make_uni_hdr(&(id->hdr_domain_name), len_domain_name, len_domain_name, 4);
+ make_uni_hdr(&(id->hdr_domain_name), len_domain_name);
id->param_ctrl = param_ctrl;
make_logon_id(&(id->logon_id), log_id_low, log_id_high);
- make_uni_hdr(&(id->hdr_user_name ), len_user_name , len_user_name , 4);
- make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name , len_wksta_name , 4);
+ make_uni_hdr(&(id->hdr_user_name ), len_user_name );
+ make_uni_hdr(&(id->hdr_wksta_name ), len_wksta_name );
if (nt_chal_resp)
{
usr->pass_can_change_time = *pass_can_change_time;
usr->pass_must_change_time = *pass_must_change_time;
- make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , 4);
- make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , 4);
- make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, 4);
- make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, 4);
- make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , 4);
- make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , 4);
+ make_uni_hdr(&(usr->hdr_user_name ), len_user_name );
+ make_uni_hdr(&(usr->hdr_full_name ), len_full_name );
+ make_uni_hdr(&(usr->hdr_logon_script), len_logon_script);
+ make_uni_hdr(&(usr->hdr_profile_path), len_profile_path);
+ make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir );
+ make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive );
usr->logon_count = logon_count;
usr->bad_pw_count = bad_pw_count;
bzero(usr->user_sess_key, sizeof(usr->user_sess_key));
}
- make_uni_hdr(&(usr->hdr_logon_srv), len_logon_srv, len_logon_srv, 4);
- make_uni_hdr(&(usr->hdr_logon_dom), len_logon_dom, len_logon_dom, 4);
+ make_uni_hdr(&(usr->hdr_logon_srv), len_logon_srv);
+ make_uni_hdr(&(usr->hdr_logon_dom), len_logon_dom);
usr->buffer_dom_id = dom_sid ? 1 : 0; /* yes, we're bothering to put a domain SID in */
memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol));
- make_uni_hdr(&(q_c->hdr_name), len_name, len_name, 1);
+ make_uni_hdr(&(q_c->hdr_name), len_name);
make_unistr2(&(q_c->uni_name), name, len_name);
- make_uni_hdr(&(q_c->hdr_class), len_class, len_class, 1);
+ make_uni_hdr(&(q_c->hdr_class), len_class);
make_unistr2(&(q_c->uni_class), class, len_class);
q_c->reserved = 0x00000000;
memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol));
- make_uni_hdr(&(q_c->hdr_name), len_name, len_name, 1);
+ make_uni_hdr(&(q_c->hdr_name), len_name);
make_unistr2(&(q_c->uni_name), name, len_name);
}
memcpy(&(q_c->pnt_pol), hnd, sizeof(q_c->pnt_pol));
- make_uni_hdr(&(q_c->hdr_name), len_name, len_name, 1);
+ make_uni_hdr(&(q_c->hdr_name), len_name);
make_unistr2(&(q_c->uni_name), name, len_name);
}
ZERO_STRUCTP(q_o);
memcpy(&(q_o->pol), hnd, sizeof(q_o->pol));
- make_uni_hdr(&q_o->hdr_class, max_class_len, 0, max_class_len > 0 ? 1 : 0);
+ q_o->hdr_class.uni_str_len = 0;
+ q_o->hdr_class.uni_max_len = max_class_len * 2;
+ q_o->hdr_class.buffer = max_class_len > 0 ? 1 : 0;
q_o->uni_class.uni_max_len = max_class_len;
}
memcpy(&(q_i->pol), pol, sizeof(q_i->pol));
- make_uni_hdr(&(q_i->hdr_type), len_type, len_type, 1);
+ make_uni_hdr(&(q_i->hdr_type), len_type);
make_unistr2(&(q_i->uni_type), product_type, len_type);
q_i->ptr1 = 1;
memcpy(&(q_i->pol), pol, sizeof(q_i->pol));
q_i->val_index = val_idx;
- make_uni_hdr(&q_i->hdr_name, max_val_len, 0, 1);
+ q_i->hdr_name.uni_str_len = 0;
+ q_i->hdr_name.uni_max_len = max_val_len * 2;
+ q_i->hdr_name.buffer = max_val_len > 0 ? 1 : 0;
q_i->uni_name.uni_max_len = max_val_len;
q_i->ptr_type = 1;
memcpy(&(q_i->pol), pol, sizeof(q_i->pol));
- make_uni_hdr(&q_i->hdr_name, val_len, val_len, 1);
+ make_uni_hdr(&q_i->hdr_name, val_len);
make_unistr2(&(q_i->uni_name), val_name, val_len);
q_i->type = type;
memcpy(&(r_q->pol), pol, sizeof(r_q->pol));
- make_uni_hdr(&(r_q->hdr_name), len_name, len_name, 1);
+ make_uni_hdr(&(r_q->hdr_name), len_name);
make_unistr2(&(r_q->uni_name), key_name, len_name);
r_q->unknown_0 = 0x00000000;
q_i->ptr_1 = 1;
q_i->ptr_2 = 1;
- make_uni_hdr(&q_i->hdr_msg, len, len, 1);
+ make_uni_hdr(&q_i->hdr_msg, len);
make_unistr2(&(q_i->uni_msg), msg, len);
q_i->timeout = timeout;
memcpy(&(q_u->connect_pol), pol, sizeof(*pol));
- make_uni_hdr(&(q_u->hdr_domain), len_name, len_name, 1);
+ make_uni_hdr(&(q_u->hdr_domain), len_name);
make_unistr2(&(q_u->uni_domain), dom_name, len_name);
}
u_2->unknown_2 = 0x00000000;
u_2->ptr_0 = 1;
- make_uni_hdr(&(u_2->hdr_domain), len_domain, len_domain, 1);
- make_uni_hdr(&(u_2->hdr_server), len_server, len_server, 1);
+ make_uni_hdr(&(u_2->hdr_domain), len_domain);
+ make_uni_hdr(&(u_2->hdr_server), len_server);
u_2->seq_num = 0x10000000;
u_2->unknown_3 = 0x00000000;
sam->acb_info = acb_info;
sam->pad = 0;
- make_uni_hdr(&(sam->hdr_acct_name), len_sam_name, len_sam_name, len_sam_name != 0);
- make_uni_hdr(&(sam->hdr_user_name), len_sam_full, len_sam_full, len_sam_full != 0);
- make_uni_hdr(&(sam->hdr_user_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0);
+ make_uni_hdr(&(sam->hdr_acct_name), len_sam_name);
+ make_uni_hdr(&(sam->hdr_user_name), len_sam_full);
+ make_uni_hdr(&(sam->hdr_user_desc), len_sam_desc);
}
/*******************************************************************
sam->acb_info = acb_info;
sam->pad = 0;
- make_uni_hdr(&(sam->hdr_srv_name), len_sam_name, len_sam_name, len_sam_name != 0);
- make_uni_hdr(&(sam->hdr_srv_desc), len_sam_desc, len_sam_desc, len_sam_desc != 0);
+ make_uni_hdr(&(sam->hdr_srv_name), len_sam_name);
+ make_uni_hdr(&(sam->hdr_srv_desc), len_sam_desc);
}
/*******************************************************************
sam->rid_grp = rid_grp;
sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */
- make_uni_hdr(&(sam->hdr_grp_name), len_grp_name, len_grp_name, len_grp_name != 0);
- make_uni_hdr(&(sam->hdr_grp_desc), len_grp_desc, len_grp_desc, len_grp_desc != 0);
+ make_uni_hdr(&(sam->hdr_grp_name), len_grp_name);
+ make_uni_hdr(&(sam->hdr_grp_desc), len_grp_desc);
}
/*******************************************************************
DEBUG(5,("make_sam_entry\n"));
sam->rid = rid;
- make_uni_hdr(&(sam->hdr_name), len_sam_name, len_sam_name, len_sam_name != 0);
+ make_uni_hdr(&(sam->hdr_name), len_sam_name);
}
/*******************************************************************
DEBUG(5,("make_samr_group_info1\n"));
- make_uni_hdr(&(gr1->hdr_acct_name), acct_len , acct_len, acct_name ? 1 : 0);
+ make_uni_hdr(&(gr1->hdr_acct_name), acct_len);
gr1->unknown_1 = 0x3;
gr1->unknown_2 = 0x3;
- make_uni_hdr(&(gr1->hdr_acct_desc), desc_len , desc_len, acct_desc ? 1 : 0);
+ make_uni_hdr(&(gr1->hdr_acct_desc), desc_len);
make_unistr2(&(gr1->uni_acct_name), acct_name, acct_len);
make_unistr2(&(gr1->uni_acct_desc), acct_desc, desc_len);
DEBUG(5,("make_samr_group_info4\n"));
- make_uni_hdr(&(gr4->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
+ make_uni_hdr(&(gr4->hdr_acct_desc), acct_len);
make_unistr2(&(gr4->uni_acct_desc), acct_desc, acct_len);
}
memcpy(&(q_e->pol), pol, sizeof(*pol));
- make_uni_hdr(&(q_e->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
+ make_uni_hdr(&(q_e->hdr_acct_desc), acct_len);
make_unistr2(&(q_e->uni_acct_desc), acct_desc, acct_len);
q_e->unknown_1 = 0x0002;
DEBUG(5,("make_samr_alias_info3\n"));
- make_uni_hdr(&(al3->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
+ make_uni_hdr(&(al3->hdr_acct_desc), acct_len);
make_unistr2(&(al3->uni_acct_desc), acct_desc, acct_len);
}
for (i = 0; i < num_names; i++)
{
int len = name[i] != NULL ? strlen(name[i]) : 0;
- make_uni_hdr(&(r_u->hdr_name[i]), len , len, name[i] ? 1 : 0);
+ make_uni_hdr(&(r_u->hdr_name[i]), len);
make_unistr2(&(r_u->uni_name[i]), name[i], len);
r_u->type[i] = type[i];
}
memcpy(&(q_u->dom_pol), hnd, sizeof(q_u->dom_pol));
- make_uni_hdr(&(q_u->hdr_acct_desc), acct_len , acct_len, acct_desc ? 1 : 0);
+ make_uni_hdr(&(q_u->hdr_acct_desc), acct_len);
make_unistr2(&(q_u->uni_acct_desc), acct_desc, acct_len);
q_u->unknown_1 = 0x001f;
for (i = 0; i < num_names; i++)
{
int len_name = name[i] != NULL ? strlen(name[i]) : 0;
- make_uni_hdr(&(q_u->hdr_name[i]), len_name, len_name, name[i] != NULL); /* unicode header for user_name */
+ make_uni_hdr(&(q_u->hdr_name[i]), len_name); /* unicode header for user_name */
make_unistr2(&(q_u->uni_name[i]), name[i], len_name); /* unicode string for machine account */
}
}
memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol));
- make_uni_hdr(&(q_u->hdr_name), len_name, len_name, 1);
+ make_uni_hdr(&(q_u->hdr_name), len_name);
make_unistr2(&(q_u->uni_name), name, len_name);
q_u->acb_info = acb_info;
memcpy(&(usr->expiry),expiry, sizeof(usr->expiry)); /* expiry time or something? */
bzero(usr->padding_1, sizeof(usr->padding_1)); /* 0 - padding 24 bytes */
- make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct, len_mach_acct, 4); /* unicode header for machine account */
+ make_uni_hdr(&(usr->hdr_mach_acct), len_mach_acct); /* unicode header for machine account */
usr->padding_2 = 0; /* 0 - padding 4 bytes */
usr->ptr_1 = 1; /* pointer */
usr->pass_can_change_time = *pass_can_change_time;
usr->pass_must_change_time = *pass_must_change_time;
- make_uni_hdr(&(usr->hdr_user_name ), len_user_name , len_user_name , 1);
- make_uni_hdr(&(usr->hdr_full_name ), len_full_name , len_full_name , 1);
- make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir , len_home_dir , 1);
- make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive , len_dir_drive , 1);
- make_uni_hdr(&(usr->hdr_logon_script), len_logon_script, len_logon_script, 1);
- make_uni_hdr(&(usr->hdr_profile_path), len_profile_path, len_profile_path, 1);
- make_uni_hdr(&(usr->hdr_acct_desc ), len_description , len_description , 1);
- make_uni_hdr(&(usr->hdr_workstations), len_workstations, len_workstations, 1);
- make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str , len_unknown_str , 1);
- make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial , len_munged_dial , 1);
+ make_uni_hdr(&(usr->hdr_user_name ), len_user_name );
+ make_uni_hdr(&(usr->hdr_full_name ), len_full_name );
+ make_uni_hdr(&(usr->hdr_home_dir ), len_home_dir );
+ make_uni_hdr(&(usr->hdr_dir_drive ), len_dir_drive );
+ make_uni_hdr(&(usr->hdr_logon_script), len_logon_script);
+ make_uni_hdr(&(usr->hdr_profile_path), len_profile_path);
+ make_uni_hdr(&(usr->hdr_acct_desc ), len_description );
+ make_uni_hdr(&(usr->hdr_workstations), len_workstations);
+ make_uni_hdr(&(usr->hdr_unknown_str ), len_unknown_str );
+ make_uni_hdr(&(usr->hdr_munged_dial ), len_munged_dial );
bzero(usr->nt_pwd, sizeof(usr->nt_pwd));
bzero(usr->lm_pwd, sizeof(usr->lm_pwd));
DEBUG(5,("make_samr_q_unknown_38\n"));
q_u->ptr = 1;
- make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name, len_srv_name, len_srv_name != 0);
+ make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name);
make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name);
}
DEBUG(5,("make_samr_q_chgpasswd_user\n"));
q_u->ptr_0 = 1;
- make_uni_hdr(&(q_u->hdr_dest_host), len_dest_host, len_dest_host, len_dest_host != 0);
+ make_uni_hdr(&(q_u->hdr_dest_host), len_dest_host);
make_unistr2(&(q_u->uni_dest_host), dest_host, len_dest_host);
- make_uni_hdr(&(q_u->hdr_user_name), len_user_name, len_user_name, len_user_name != 0);
+ make_uni_hdr(&(q_u->hdr_user_name), len_user_name);
make_unistr2(&(q_u->uni_user_name), user_name, len_user_name);
make_enc_passwd(&(q_u->nt_newpass), nt_newpass);
len = dom_name != NULL ? strlen(dom_name) : 0;
- make_uni_hdr(&(ref->hdr_ref_dom[num].hdr_dom_name), len, len, len != 0 ? 1 : 0);
+ make_uni_hdr(&(ref->hdr_ref_dom[num].hdr_dom_name), len);
ref->hdr_ref_dom[num].ptr_dom_sid = dom_sid != NULL ? 1 : 0;
make_unistr2 (&(ref->ref_dom[num].uni_dom_name), dom_name, len);
user_name_len = strlen(pwd->nt_name);
make_unistr2(&(pw_buf[(*num_entries)].uni_user_name), pwd->nt_name, user_name_len);
- make_uni_hdr(&(pw_buf[(*num_entries)].hdr_user_name), user_name_len,
- user_name_len, 1);
+ make_uni_hdr(&(pw_buf[(*num_entries)].hdr_user_name), user_name_len);
pw_buf[(*num_entries)].user_rid = pwd->user_rid;
bzero( pw_buf[(*num_entries)].nt_pwd , 16);