mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
Adapt to latest pdb API changes - only thing left is group support
This commit is contained in:
parent
c13ed6c866
commit
99a2e7fde1
@ -656,7 +656,6 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
|
||||
const SAM_ACCOUNT * newpwd, char isupdate)
|
||||
{
|
||||
pstring temp;
|
||||
uint32 store = pdb_get_init_flag(newpwd);
|
||||
struct pdb_mysql_data *data;
|
||||
pdb_mysql_query query;
|
||||
fstring sid_str;
|
||||
@ -695,7 +694,7 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
|
||||
CONFIG_ACCT_CTRL_DEFAULT),
|
||||
pdb_get_acct_ctrl(newpwd));
|
||||
|
||||
if (store & PDB_LOGONTIME) {
|
||||
if (pdb_get_init_flags(newpwd, PDB_LOGONTIME) != PDB_DEFAULT) {
|
||||
pdb_mysql_int_field(methods, &query,
|
||||
config_value_write(data,
|
||||
"logon time column",
|
||||
@ -703,7 +702,7 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
|
||||
pdb_get_logon_time(newpwd));
|
||||
}
|
||||
|
||||
if (store & PDB_LOGOFFTIME) {
|
||||
if (pdb_get_init_flags(newpwd, PDB_LOGOFFTIME) != PDB_DEFAULT) {
|
||||
pdb_mysql_int_field(methods, &query,
|
||||
config_value_write(data,
|
||||
"logoff time column",
|
||||
@ -711,7 +710,7 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
|
||||
pdb_get_logoff_time(newpwd));
|
||||
}
|
||||
|
||||
if (store & PDB_KICKOFFTIME) {
|
||||
if (pdb_get_init_flags(newpwd, PDB_KICKOFFTIME) != PDB_DEFAULT) {
|
||||
pdb_mysql_int_field(methods, &query,
|
||||
config_value_write(data,
|
||||
"kickoff time column",
|
||||
@ -719,7 +718,7 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
|
||||
pdb_get_kickoff_time(newpwd));
|
||||
}
|
||||
|
||||
if (store & PDB_CANCHANGETIME) {
|
||||
if (pdb_get_init_flags(newpwd, PDB_CANCHANGETIME) != PDB_DEFAULT) {
|
||||
pdb_mysql_int_field(methods, &query,
|
||||
config_value_write(data,
|
||||
"pass can change time column",
|
||||
@ -727,7 +726,7 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
|
||||
pdb_get_pass_can_change_time(newpwd));
|
||||
}
|
||||
|
||||
if (store & PDB_MUSTCHANGETIME) {
|
||||
if (pdb_get_init_flags(newpwd, PDB_MUSTCHANGETIME) != PDB_DEFAULT) {
|
||||
pdb_mysql_int_field(methods, &query,
|
||||
config_value_write(data,
|
||||
"pass must change time column",
|
||||
@ -759,14 +758,14 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
|
||||
pdb_get_logon_divs(newpwd));
|
||||
}
|
||||
|
||||
if (store & PDB_UID) {
|
||||
if (pdb_get_init_flags(newpwd, PDB_UID) != PDB_DEFAULT) {
|
||||
pdb_mysql_int_field(methods, &query,
|
||||
config_value_write(data, "uid column",
|
||||
CONFIG_UID_DEFAULT),
|
||||
pdb_get_uid(newpwd));
|
||||
}
|
||||
|
||||
if (store & PDB_GID) {
|
||||
if (pdb_get_init_flags(newpwd, PDB_GID) != PDB_DEFAULT) {
|
||||
pdb_mysql_int_field(methods, &query,
|
||||
config_value_write(data, "gid column",
|
||||
CONFIG_GID_DEFAULT),
|
||||
@ -776,13 +775,13 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
|
||||
pdb_mysql_string_field(methods, &query,
|
||||
config_value_write(data, "user sid column",
|
||||
CONFIG_USER_SID_DEFAULT),
|
||||
sid_to_string(sid_str, (DOM_SID *)
|
||||
sid_to_string(sid_str,
|
||||
pdb_get_user_sid(newpwd)));
|
||||
|
||||
pdb_mysql_string_field(methods, &query,
|
||||
config_value_write(data, "group sid column",
|
||||
CONFIG_GROUP_SID_DEFAULT),
|
||||
sid_to_string(sid_str, (DOM_SID *)
|
||||
sid_to_string(sid_str,
|
||||
pdb_get_group_sid(newpwd)));
|
||||
|
||||
pdb_mysql_string_field(methods, &query,
|
||||
@ -861,9 +860,7 @@ static NTSTATUS mysqlsam_replace_sam_account(struct pdb_methods *methods,
|
||||
config_value_read(data,
|
||||
"user sid column",
|
||||
CONFIG_USER_SID_DEFAULT),
|
||||
sid_to_string(sid_str, (DOM_SID *)
|
||||
pdb_get_user_sid
|
||||
(newpwd)));
|
||||
sid_to_string(sid_str, pdb_get_user_sid (newpwd)));
|
||||
} else {
|
||||
query.part2[strlen(query.part2) - 1] = ')';
|
||||
query.part1[strlen(query.part1) - 1] = ')';
|
||||
|
@ -381,7 +381,6 @@ static NTSTATUS xmlsam_add_sam_account(struct pdb_methods *methods, SAM_ACCOUNT
|
||||
fstring sid_str;
|
||||
xmlNodePtr cur, user, pass, root;
|
||||
pdb_xml *data;
|
||||
uint32 store = pdb_get_init_flag(u);
|
||||
|
||||
DEBUG(10, ("xmlsam_add_sam_account called!\n"));
|
||||
|
||||
@ -409,7 +408,7 @@ static NTSTATUS xmlsam_add_sam_account(struct pdb_methods *methods, SAM_ACCOUNT
|
||||
user = xmlNewChild(data->users, data->ns, "user", NULL);
|
||||
xmlNewProp(user, "sid",
|
||||
sid_to_string(sid_str, pdb_get_user_sid(u)));
|
||||
if (store & PDB_UID)
|
||||
if (pdb_get_init_flags(u, PDB_UID) != PDB_DEFAULT)
|
||||
xmlNewProp(user, "uid", iota(pdb_get_uid(u)));
|
||||
|
||||
if (pdb_get_username(u) && strcmp(pdb_get_username(u), ""))
|
||||
@ -419,18 +418,18 @@ static NTSTATUS xmlsam_add_sam_account(struct pdb_methods *methods, SAM_ACCOUNT
|
||||
|
||||
xmlNewProp(cur, "sid",
|
||||
sid_to_string(sid_str, pdb_get_group_sid(u)));
|
||||
if (store & PDB_GID)
|
||||
if (pdb_get_init_flags(u, PDB_GID) != PDB_DEFAULT)
|
||||
xmlNewProp(cur, "gid", iota(pdb_get_gid(u)));
|
||||
|
||||
if (store & PDB_LOGONTIME)
|
||||
if (pdb_get_init_flags(u, PDB_LOGONTIME) != PDB_DEFAULT)
|
||||
xmlNewChild(user, data->ns, "login_time",
|
||||
iota(pdb_get_logon_time(u)));
|
||||
|
||||
if (store & PDB_LOGOFFTIME)
|
||||
if (pdb_get_init_flags(u, PDB_LOGOFFTIME) != PDB_DEFAULT)
|
||||
xmlNewChild(user, data->ns, "logoff_time",
|
||||
iota(pdb_get_logoff_time(u)));
|
||||
|
||||
if (store & PDB_KICKOFFTIME)
|
||||
if (pdb_get_init_flags(u, PDB_KICKOFFTIME) != PDB_DEFAULT)
|
||||
xmlNewChild(user, data->ns, "kickoff_time",
|
||||
iota(pdb_get_kickoff_time(u)));
|
||||
|
||||
@ -475,11 +474,11 @@ static NTSTATUS xmlsam_add_sam_account(struct pdb_methods *methods, SAM_ACCOUNT
|
||||
pass = xmlNewChild(user, data->ns, "password", NULL);
|
||||
if (pdb_get_pass_last_set_time(u))
|
||||
xmlNewProp(pass, "last_set", iota(pdb_get_pass_last_set_time(u)));
|
||||
if (store & PDB_CANCHANGETIME)
|
||||
if (pdb_get_init_flags(u, PDB_CANCHANGETIME) != PDB_DEFAULT)
|
||||
xmlNewProp(pass, "can_change",
|
||||
iota(pdb_get_pass_can_change_time(u)));
|
||||
|
||||
if (store & PDB_MUSTCHANGETIME)
|
||||
if (pdb_get_init_flags(u, PDB_MUSTCHANGETIME) != PDB_DEFAULT)
|
||||
xmlNewProp(pass, "must_change",
|
||||
iota(pdb_get_pass_must_change_time(u)));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user