summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-03-31 20:43:18 +0200
committerGünther Deschner <gd@samba.org>2008-03-31 20:55:40 +0200
commit4369c14a66060021259308d1c42372e75455953f (patch)
tree3a3e871821710f4df8d79b8cbbe8253205168b00 /source3/rpc_server
parent09ab0d11e5634ed7b20a5b02f0d9dbe71ed3f1a0 (diff)
downloadsamba-4369c14a66060021259308d1c42372e75455953f.tar.gz
samba-4369c14a66060021259308d1c42372e75455953f.tar.bz2
samba-4369c14a66060021259308d1c42372e75455953f.zip
Re-add support for the samr parameters string.
(dialin settings, terminal server settings, etc.) Guenther (This used to be commit c4f248df8e34c6a028bf8d789fe9763b0ea063fe)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_samr_nt.c51
-rw-r--r--source3/rpc_server/srv_samr_util.c17
2 files changed, 30 insertions, 38 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 034392ed21..0f4a5b9ae1 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -2368,8 +2368,9 @@ static NTSTATUS get_user_info_20(TALLOC_CTX *mem_ctx,
struct samu *sampass=NULL;
bool ret;
const char *munged_dial = NULL;
- const char *munged_dial_decoded = NULL;
DATA_BLOB blob;
+ NTSTATUS status;
+ struct lsa_BinaryString *parameters = NULL;
ZERO_STRUCTP(r);
@@ -2391,28 +2392,23 @@ static NTSTATUS get_user_info_20(TALLOC_CTX *mem_ctx,
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) {
blob = base64_decode_data_blob(munged_dial);
- munged_dial_decoded = talloc_strndup(mem_ctx,
- (const char *)blob.data,
- blob.length);
- data_blob_free(&blob);
- if (!munged_dial_decoded) {
- TALLOC_FREE(sampass);
- return NT_STATUS_NO_MEMORY;
- }
+ } else {
+ blob = data_blob_string_const("");
}
-#if 0
- init_unistr2_from_datablob(&usr->uni_munged_dial, &blob);
- init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
+ status = init_samr_parameters_string(mem_ctx, &blob, &parameters);
data_blob_free(&blob);
-#endif
- init_samr_user_info20(r, munged_dial_decoded);
-
TALLOC_FREE(sampass);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ init_samr_user_info20(r, parameters);
return NT_STATUS_OK;
}
@@ -2427,6 +2423,7 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx,
DOM_SID *user_sid,
DOM_SID *domain_sid)
{
+ NTSTATUS status;
struct samu *pw = NULL;
bool ret;
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;
const char *account_name, *full_name, *home_directory, *home_drive,
*logon_script, *profile_path, *description,
- *workstations, *comment, *parameters;
+ *workstations, *comment;
struct samr_LogonHours logon_hours;
+ struct lsa_BinaryString *parameters = NULL;
const char *munged_dial = NULL;
DATA_BLOB blob;
@@ -2508,16 +2506,16 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx,
munged_dial = pdb_get_munged_dial(pw);
if (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 {
- 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));
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
*/
-#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
init_samr_user_info21(r,
diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c
index 688d72064f..74daf46e84 100644
--- a/source3/rpc_server/srv_samr_util.c
+++ b/source3/rpc_server/srv_samr_util.c
@@ -50,11 +50,10 @@ void copy_id20_to_sam_passwd(struct samu *to,
return;
}
- if (from->parameters.string) {
+ if (from->parameters.array) {
old_string = pdb_get_munged_dial(to);
- mung.length = from->parameters.length;
- mung.data = (uint8_t *)from->parameters.string;
- mung.free = NULL;
+ mung = data_blob_const(from->parameters.array,
+ from->parameters.length);
new_string = (mung.length == 0) ?
NULL : base64_encode_data_blob(talloc_tos(), mung);
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;
const char *old_string, *new_string;
- DATA_BLOB mung;
const char *l;
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) &&
- (from->parameters.string)) {
+ (from->parameters.array)) {
char *newstr;
+ DATA_BLOB mung;
old_string = pdb_get_munged_dial(to);
- mung.length = from->parameters.length;
- mung.data = (uint8_t *)from->parameters.string;
- mung.free = NULL;
+
+ mung = data_blob_const(from->parameters.array,
+ from->parameters.length);
newstr = (mung.length == 0) ?
NULL : base64_encode_data_blob(talloc_tos(), mung);
DEBUG(10,("%s SAMR_FIELD_PARAMETERS: %s -> %s\n", l,