1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

Re-add support for the samr parameters string.

(dialin settings, terminal server settings, etc.)

Guenther
(This used to be commit c4f248df8e34c6a028bf8d789fe9763b0ea063fe)
This commit is contained in:
Günther Deschner 2008-03-31 20:43:18 +02:00
parent 09ab0d11e5
commit 4369c14a66
4 changed files with 50 additions and 44 deletions

View File

@ -308,9 +308,9 @@ void init_samr_user_info18(struct samr_UserInfo18 *r,
********************************************************************/ ********************************************************************/
void init_samr_user_info20(struct samr_UserInfo20 *r, void init_samr_user_info20(struct samr_UserInfo20 *r,
const char *munged_dial) struct lsa_BinaryString *parameters)
{ {
init_lsa_String(&r->parameters, munged_dial); r->parameters = *parameters;
} }
/************************************************************************* /*************************************************************************
@ -333,7 +333,7 @@ void init_samr_user_info21(struct samr_UserInfo21 *r,
const char *description, const char *description,
const char *workstations, const char *workstations,
const char *comment, const char *comment,
const char *parameters, struct lsa_BinaryString *parameters,
uint32_t rid, uint32_t rid,
uint32_t primary_gid, uint32_t primary_gid,
uint32_t acct_flags, uint32_t acct_flags,
@ -362,7 +362,7 @@ void init_samr_user_info21(struct samr_UserInfo21 *r,
init_lsa_String(&r->description, description); init_lsa_String(&r->description, description);
init_lsa_String(&r->workstations, workstations); init_lsa_String(&r->workstations, workstations);
init_lsa_String(&r->comment, comment); init_lsa_String(&r->comment, comment);
init_lsa_String(&r->parameters, parameters); r->parameters = *parameters;
r->rid = rid; r->rid = rid;
r->primary_gid = primary_gid; r->primary_gid = primary_gid;
r->acct_flags = acct_flags; r->acct_flags = acct_flags;
@ -397,7 +397,7 @@ void init_samr_user_info23(struct samr_UserInfo23 *r,
const char *description, const char *description,
const char *workstations, const char *workstations,
const char *comment, const char *comment,
const char *parameters, struct lsa_BinaryString *parameters,
uint32_t rid, uint32_t rid,
uint32_t primary_gid, uint32_t primary_gid,
uint32_t acct_flags, uint32_t acct_flags,

View File

@ -2368,8 +2368,9 @@ static NTSTATUS get_user_info_20(TALLOC_CTX *mem_ctx,
struct samu *sampass=NULL; struct samu *sampass=NULL;
bool ret; bool ret;
const char *munged_dial = NULL; const char *munged_dial = NULL;
const char *munged_dial_decoded = NULL;
DATA_BLOB blob; DATA_BLOB blob;
NTSTATUS status;
struct lsa_BinaryString *parameters = NULL;
ZERO_STRUCTP(r); ZERO_STRUCTP(r);
@ -2391,28 +2392,23 @@ static NTSTATUS get_user_info_20(TALLOC_CTX *mem_ctx,
samr_clear_sam_passwd(sampass); samr_clear_sam_passwd(sampass);
DEBUG(3,("User:[%s]\n", pdb_get_username(sampass) )); DEBUG(3,("User:[%s] has [%s] (length: %d)\n", pdb_get_username(sampass),
munged_dial, strlen(munged_dial)));
if (munged_dial) { if (munged_dial) {
blob = base64_decode_data_blob(munged_dial); blob = base64_decode_data_blob(munged_dial);
munged_dial_decoded = talloc_strndup(mem_ctx, } else {
(const char *)blob.data, blob = data_blob_string_const("");
blob.length);
data_blob_free(&blob);
if (!munged_dial_decoded) {
TALLOC_FREE(sampass);
return NT_STATUS_NO_MEMORY;
}
} }
#if 0 status = init_samr_parameters_string(mem_ctx, &blob, &parameters);
init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
data_blob_free(&blob); data_blob_free(&blob);
#endif
init_samr_user_info20(r, munged_dial_decoded);
TALLOC_FREE(sampass); TALLOC_FREE(sampass);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
init_samr_user_info20(r, parameters);
return NT_STATUS_OK; return NT_STATUS_OK;
} }
@ -2427,6 +2423,7 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx,
DOM_SID *user_sid, DOM_SID *user_sid,
DOM_SID *domain_sid) DOM_SID *domain_sid)
{ {
NTSTATUS status;
struct samu *pw = NULL; struct samu *pw = NULL;
bool ret; bool ret;
const DOM_SID *sid_user, *sid_group; const DOM_SID *sid_user, *sid_group;
@ -2437,8 +2434,9 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx,
uint8_t password_expired; uint8_t password_expired;
const char *account_name, *full_name, *home_directory, *home_drive, const char *account_name, *full_name, *home_directory, *home_drive,
*logon_script, *profile_path, *description, *logon_script, *profile_path, *description,
*workstations, *comment, *parameters; *workstations, *comment;
struct samr_LogonHours logon_hours; struct samr_LogonHours logon_hours;
struct lsa_BinaryString *parameters = NULL;
const char *munged_dial = NULL; const char *munged_dial = NULL;
DATA_BLOB blob; DATA_BLOB blob;
@ -2508,16 +2506,16 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx,
munged_dial = pdb_get_munged_dial(pw); munged_dial = pdb_get_munged_dial(pw);
if (munged_dial) { if (munged_dial) {
blob = base64_decode_data_blob(munged_dial); blob = base64_decode_data_blob(munged_dial);
parameters = talloc_strndup(mem_ctx, (const char *)blob.data, blob.length);
data_blob_free(&blob);
if (!parameters) {
TALLOC_FREE(pw);
return NT_STATUS_NO_MEMORY;
}
} else { } else {
parameters = NULL; blob = data_blob_string_const("");
} }
status = init_samr_parameters_string(mem_ctx, &blob, &parameters);
data_blob_free(&blob);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(pw);
return status;
}
account_name = talloc_strdup(mem_ctx, pdb_get_username(pw)); account_name = talloc_strdup(mem_ctx, pdb_get_username(pw));
full_name = talloc_strdup(mem_ctx, pdb_get_fullname(pw)); full_name = talloc_strdup(mem_ctx, pdb_get_fullname(pw));
@ -2542,11 +2540,6 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx,
-- Volker -- Volker
*/ */
#if 0
init_unistr2_from_datablob(&usr->uni_munged_dial, &munged_dial_blob);
init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
data_blob_free(&munged_dial_blob);
#endif
#endif #endif
init_samr_user_info21(r, init_samr_user_info21(r,

View File

@ -50,11 +50,10 @@ void copy_id20_to_sam_passwd(struct samu *to,
return; return;
} }
if (from->parameters.string) { if (from->parameters.array) {
old_string = pdb_get_munged_dial(to); old_string = pdb_get_munged_dial(to);
mung.length = from->parameters.length; mung = data_blob_const(from->parameters.array,
mung.data = (uint8_t *)from->parameters.string; from->parameters.length);
mung.free = NULL;
new_string = (mung.length == 0) ? new_string = (mung.length == 0) ?
NULL : base64_encode_data_blob(talloc_tos(), mung); NULL : base64_encode_data_blob(talloc_tos(), mung);
DEBUG(10,("INFO_20 PARAMETERS: %s -> %s\n", DEBUG(10,("INFO_20 PARAMETERS: %s -> %s\n",
@ -77,7 +76,6 @@ void copy_id21_to_sam_passwd(const char *log_prefix,
{ {
time_t unix_time, stored_time; time_t unix_time, stored_time;
const char *old_string, *new_string; const char *old_string, *new_string;
DATA_BLOB mung;
const char *l; const char *l;
if (from == NULL || to == NULL) { if (from == NULL || to == NULL) {
@ -234,12 +232,13 @@ void copy_id21_to_sam_passwd(const char *log_prefix,
} }
if ((from->fields_present & SAMR_FIELD_PARAMETERS) && if ((from->fields_present & SAMR_FIELD_PARAMETERS) &&
(from->parameters.string)) { (from->parameters.array)) {
char *newstr; char *newstr;
DATA_BLOB mung;
old_string = pdb_get_munged_dial(to); old_string = pdb_get_munged_dial(to);
mung.length = from->parameters.length;
mung.data = (uint8_t *)from->parameters.string; mung = data_blob_const(from->parameters.array,
mung.free = NULL; from->parameters.length);
newstr = (mung.length == 0) ? newstr = (mung.length == 0) ?
NULL : base64_encode_data_blob(talloc_tos(), mung); NULL : base64_encode_data_blob(talloc_tos(), mung);
DEBUG(10,("%s SAMR_FIELD_PARAMETERS: %s -> %s\n", l, DEBUG(10,("%s SAMR_FIELD_PARAMETERS: %s -> %s\n", l,

View File

@ -51,6 +51,16 @@ static void display_samr_user_info_16(struct samr_UserInfo16 *r)
printf("\tAcct Flags :\tox%x\n", r->acct_flags); printf("\tAcct Flags :\tox%x\n", r->acct_flags);
} }
/****************************************************************************
display samr_user_info_20 structure
****************************************************************************/
static void display_samr_user_info_20(struct samr_UserInfo20 *r)
{
printf("\tRemote Dial :\n");
dump_data(0, (uint8_t *)r->parameters.array, r->parameters.length*2);
}
/**************************************************************************** /****************************************************************************
display samr_user_info_21 structure display samr_user_info_21 structure
****************************************************************************/ ****************************************************************************/
@ -65,7 +75,8 @@ static void display_samr_user_info_21(struct samr_UserInfo21 *r)
printf("\tDescription :\t%s\n", r->description.string); printf("\tDescription :\t%s\n", r->description.string);
printf("\tWorkstations:\t%s\n", r->workstations.string); printf("\tWorkstations:\t%s\n", r->workstations.string);
printf("\tComment :\t%s\n", r->comment.string); printf("\tComment :\t%s\n", r->comment.string);
printf("\tRemote Dial :\t%s\n", r->parameters.string); printf("\tRemote Dial :\n");
dump_data(0, (uint8_t *)r->parameters.array, r->parameters.length*2);
printf("\tLogon Time :\t%s\n", printf("\tLogon Time :\t%s\n",
http_timestring(nt_time_to_unix(r->last_logon))); http_timestring(nt_time_to_unix(r->last_logon)));
@ -374,6 +385,9 @@ static NTSTATUS cmd_samr_query_user(struct rpc_pipe_client *cli,
case 16: case 16:
display_samr_user_info_16(&info->info16); display_samr_user_info_16(&info->info16);
break; break;
case 20:
display_samr_user_info_20(&info->info20);
break;
case 21: case 21:
display_samr_user_info_21(&info->info21); display_samr_user_info_21(&info->info21);
break; break;