[PATCH] TSE / Munged dial
Aurélien Degrémont
adegremont at idealx.com
Wed Nov 5 14:26:31 GMT 2003
Hi,
Here is a patch which ables Samba to manage some Windows TSE as member
servers.
The unique problem was to store the munged_dial field as a Blob and not
a string.
To do this, I made some changes to rpc parse functions. After the munged
dial field is parsed as a UNISTR2, I convert it into base64 format in
order to store it as a string inside SAM_ACCOUNT, as Simo advised me.
This works fine ! :)
The patch is ready for Samba 3.0.1.
Waiting for your comments.
Aurélien Degrémont
-------------- next part --------------
diff -ruN samba-3.0.1pre1/source/rpc_server/srv_samr_nt.c samba-tse-3.0.1pre1/source/rpc_server/srv_samr_nt.c
--- samba-3.0.1pre1/source/rpc_server/srv_samr_nt.c 2003-10-10 20:08:36.000000000 +0200
+++ samba-tse-3.0.1pre1/source/rpc_server/srv_samr_nt.c 2003-11-04 18:30:49.000000000 +0100
@@ -2789,6 +2789,38 @@
/*******************************************************************
+ set_user_info_20
+ ********************************************************************/
+
+static BOOL set_user_info_20(SAM_USER_INFO_20 *id20, DOM_SID *sid)
+{
+ SAM_ACCOUNT *pwd = NULL;
+
+ if (id20 == NULL) {
+ DEBUG(5, ("set_user_info_20: NULL id20\n"));
+ return False;
+ }
+
+ pdb_init_sam(&pwd);
+
+ if (!pdb_getsampwsid(pwd, sid)) {
+ pdb_free_sam(&pwd);
+ return False;
+ }
+
+ copy_id20_to_sam_passwd(pwd, id20);
+
+ /* write the change out */
+ if(!pdb_update_sam_account(pwd)) {
+ pdb_free_sam(&pwd);
+ return False;
+ }
+
+ pdb_free_sam(&pwd);
+
+ return True;
+}
+/*******************************************************************
set_user_info_21
********************************************************************/
@@ -3091,6 +3123,10 @@
if (!set_user_info_21(ctr->info.id21, &sid))
return NT_STATUS_ACCESS_DENIED;
break;
+ case 20:
+ if (!set_user_info_20(ctr->info.id20, &sid))
+ return NT_STATUS_ACCESS_DENIED;
+ break;
case 16:
if (!set_user_info_10(ctr->info.id10, &sid))
return NT_STATUS_ACCESS_DENIED;
@@ -4537,4 +4573,3 @@
return r_u->status;
}
-
diff -ruN samba-3.0.1pre1/source/rpc_server/srv_samr_util.c samba-tse-3.0.1pre1/source/rpc_server/srv_samr_util.c
--- samba-3.0.1pre1/source/rpc_server/srv_samr_util.c 2003-10-10 20:08:36.000000000 +0200
+++ samba-tse-3.0.1pre1/source/rpc_server/srv_samr_util.c 2003-11-05 15:00:44.000000000 +0100
@@ -32,6 +32,31 @@
(old_string && new_string && (strcmp(old_string, new_string) != 0))
/*************************************************************
+ Copies a SAM_USER_INFO_20 to a SAM_ACCOUNT
+**************************************************************/
+
+void copy_id20_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_20 *from)
+{
+ const char *old_string, *new_string;
+ DATA_BLOB mung;
+
+ if (from == NULL || to == NULL)
+ return;
+
+ if (from->hdr_munged_dial.buffer) {
+ old_string = pdb_get_munged_dial(to);
+ mung.length = from->hdr_munged_dial.uni_str_len;
+ mung.data = (uint8 *) from->uni_munged_dial.buffer;
+ new_string = base64_encode_data_blob(mung);
+ DEBUG(10,("INFO_20 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string));
+ if (STRING_CHANGED)
+ pdb_set_munged_dial(to , new_string, PDB_CHANGED);
+ }
+
+}
+
+
+/*************************************************************
Copies a SAM_USER_INFO_21 to a SAM_ACCOUNT
**************************************************************/
@@ -39,6 +64,7 @@
{
time_t unix_time, stored_time;
const char *old_string, *new_string;
+ DATA_BLOB mung;
if (from == NULL || to == NULL)
return;
@@ -163,7 +189,9 @@
if (from->hdr_munged_dial.buffer) {
old_string = pdb_get_munged_dial(to);
- new_string = unistr2_static(&from->uni_munged_dial);
+ mung.length = from->hdr_munged_dial.uni_str_len;
+ mung.data = (uint8 *) from->uni_munged_dial.buffer;
+ new_string = base64_encode_data_blob(mung);
DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_munged_dial(to , new_string, PDB_CHANGED);
@@ -250,6 +278,7 @@
{
time_t unix_time, stored_time;
const char *old_string, *new_string;
+ DATA_BLOB mung;
if (from == NULL || to == NULL)
return;
@@ -374,7 +403,9 @@
if (from->hdr_munged_dial.buffer) {
old_string = pdb_get_munged_dial(to);
- new_string = unistr2_static(&from->uni_munged_dial);
+ mung.length = from->hdr_munged_dial.uni_str_len;
+ mung.data = (uint8 *) from->uni_munged_dial.buffer;
+ new_string = base64_encode_data_blob(mung);
DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_munged_dial(to , new_string, PDB_CHANGED);
@@ -450,5 +481,3 @@
DEBUG(10,("INFO_23 PADDING_4: %08X\n",from->padding4));
}
-
-
More information about the samba-technical
mailing list