mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r10606: pdb_*sql patches from
Uli Meis <a.sporto@gmail.com>
Peter Rindfuss <rindfuss@wz-berlin.de>
(This used to be commit 8bf124adaf
)
This commit is contained in:
parent
4850bc6310
commit
dbbaccc2c0
@ -989,7 +989,6 @@ static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINT
|
||||
|
||||
static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
|
||||
{
|
||||
struct talloc_chunk *tc;
|
||||
int len, s_len;
|
||||
va_list ap2;
|
||||
|
||||
@ -997,11 +996,9 @@ static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
|
||||
return talloc_vasprintf(NULL, fmt, ap);
|
||||
}
|
||||
|
||||
tc = talloc_chunk_from_ptr(s);
|
||||
|
||||
VA_COPY(ap2, ap);
|
||||
|
||||
s_len = tc->size - 1;
|
||||
s_len = strlen(s);
|
||||
len = vsnprintf(NULL, 0, fmt, ap2);
|
||||
|
||||
s = talloc_realloc(NULL, s, char, s_len + len+1);
|
||||
|
@ -231,8 +231,6 @@ static NTSTATUS pgsqlsam_setsampwent(struct pdb_methods *methods, BOOL update, u
|
||||
}
|
||||
|
||||
talloc_free(query);
|
||||
if ( data->pwent != NULL )
|
||||
PQclear( data->pwent ) ;
|
||||
return retval ;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
CONFIG_TABLE_DEFAULT));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_ACCTCTRL)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_ACCTCTRL)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_int_field(query,
|
||||
config_value_write(location, "acct ctrl column",
|
||||
@ -326,7 +326,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_acct_ctrl(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_LOGONTIME)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONTIME)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_int_field(query,
|
||||
config_value_write(location,
|
||||
@ -335,7 +335,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_logon_time(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_LOGOFFTIME)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGOFFTIME)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_int_field(query,
|
||||
config_value_write(location,
|
||||
@ -344,7 +344,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_logoff_time(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_KICKOFFTIME)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_KICKOFFTIME)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_int_field(query,
|
||||
config_value_write(location,
|
||||
@ -353,7 +353,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_kickoff_time(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_CANCHANGETIME)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_CANCHANGETIME)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_int_field(query,
|
||||
config_value_write(location,
|
||||
@ -362,7 +362,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_pass_can_change_time(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_MUSTCHANGETIME)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_MUSTCHANGETIME)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_int_field(query,
|
||||
config_value_write(location,
|
||||
@ -371,7 +371,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_pass_must_change_time(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_PASSLASTSET)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_PASSLASTSET)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_int_field(query,
|
||||
config_value_write(location,
|
||||
@ -380,7 +380,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_pass_last_set_time(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_HOURSLEN)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_HOURSLEN)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_int_field(query,
|
||||
config_value_write(location,
|
||||
@ -389,7 +389,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_hours_len(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_LOGONDIVS)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONDIVS)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_int_field(query,
|
||||
config_value_write(location,
|
||||
@ -398,7 +398,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_logon_divs(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_USERSID)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERSID)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location, "user sid column",
|
||||
@ -407,7 +407,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_user_sid(newpwd)));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_GROUPSID)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_GROUPSID)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location, "group sid column",
|
||||
@ -416,7 +416,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_group_sid(newpwd)));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_USERNAME)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERNAME)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location, "username column",
|
||||
@ -424,7 +424,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_username(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_DOMAIN)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_DOMAIN)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location, "domain column",
|
||||
@ -432,7 +432,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_domain(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_USERNAME)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERNAME)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location,
|
||||
@ -441,7 +441,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_nt_username(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_FULLNAME)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_FULLNAME)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location, "fullname column",
|
||||
@ -449,7 +449,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_fullname(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_LOGONSCRIPT)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONSCRIPT)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location,
|
||||
@ -458,7 +458,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_logon_script(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_PROFILE)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_PROFILE)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location,
|
||||
@ -467,7 +467,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_profile_path(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_DRIVE)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_DRIVE)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location, "dir drive column",
|
||||
@ -475,7 +475,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_dir_drive(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_SMBHOME)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_SMBHOME)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location, "home dir column",
|
||||
@ -483,7 +483,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_homedir(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_WORKSTATIONS)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_WORKSTATIONS)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location,
|
||||
@ -492,7 +492,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_workstations(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_UNKNOWNSTR)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_UNKNOWNSTR)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location,
|
||||
@ -501,7 +501,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
pdb_get_workstations(newpwd));
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_LMPASSWD)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LMPASSWD)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sethexpwd(temp, pdb_get_lanman_passwd(newpwd),
|
||||
pdb_get_acct_ctrl(newpwd));
|
||||
@ -511,7 +511,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
CONFIG_LM_PW_DEFAULT), temp);
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_NTPASSWD)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_NTPASSWD)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sethexpwd(temp, pdb_get_nt_passwd(newpwd),
|
||||
pdb_get_acct_ctrl(newpwd));
|
||||
@ -520,7 +520,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const
|
||||
CONFIG_NT_PW_DEFAULT), temp);
|
||||
}
|
||||
|
||||
if (IS_SAM_CHANGED(newpwd, PDB_HOURS)) {
|
||||
if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_HOURS)) {
|
||||
some_field_affected = 1;
|
||||
pdb_sql_string_field(query,
|
||||
config_value_write(location,
|
||||
|
Loading…
Reference in New Issue
Block a user