Author: skel
Date: 2005-08-29 23:03:14 +0000 (Mon, 29 Aug 2005)
New Revision: 9764

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9764

Log:
cac_SamSetUserInfo() now works with a SAM_USER_INFO_21 instead of 
SAM_USER_INFO_23


Modified:
   branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
   branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
   branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c


Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===================================================================
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h    2005-08-29 22:04:11 UTC 
(rev 9763)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h    2005-08-29 23:03:14 UTC 
(rev 9764)
@@ -254,9 +254,6 @@
    /**Possible logon hours*/
    LOGON_HRS *logon_hours;
 
-   /**this must be set when calling cac_SamSetUserInfo()*/
-   char *new_password;
-   
 } CacUserInfo;
 
 typedef struct _CACGROUPINFO {

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-29 22:04:11 UTC 
(rev 9763)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c   2005-08-29 23:03:14 UTC 
(rev 9764)
@@ -1776,11 +1776,11 @@
    srv->cli.pipe_idx = PI_SAMR;
 
    if(hnd->_internal.srv_level >= SRV_WIN_NT4) {
-      hnd->status = cli_samr_set_userinfo2( &(srv->cli), mem_ctx, 
op->in.user_hnd, 23, &(srv->cli.user_session_key), ctr);
+      hnd->status = cli_samr_set_userinfo2( &(srv->cli), mem_ctx, 
op->in.user_hnd, 21, &(srv->cli.user_session_key), ctr);
    }
 
    if(hnd->_internal.srv_level < SRV_WIN_NT4 || !NT_STATUS_IS_OK(hnd->status)) 
{
-      hnd->status = cli_samr_set_userinfo( &(srv->cli), mem_ctx, 
op->in.user_hnd, 23, &(srv->cli.user_session_key), ctr);
+      hnd->status = cli_samr_set_userinfo( &(srv->cli), mem_ctx, 
op->in.user_hnd, 21, &(srv->cli.user_session_key), ctr);
 
       if(NT_STATUS_IS_OK(hnd->status) && hnd->_internal.srv_level > 
SRV_WIN_NT4) {
          hnd->_internal.srv_level = SRV_WIN_NT4;

Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c  2005-08-29 
22:04:11 UTC (rev 9763)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c  2005-08-29 
23:03:14 UTC (rev 9764)
@@ -310,7 +310,16 @@
    NTTIME pass_can_change_time;
    NTTIME pass_must_change_time;
 
-   uchar pw[516];
+   UNISTR2 user_name;
+   UNISTR2 full_name;
+   UNISTR2 home_dir;
+   UNISTR2 dir_drive;
+   UNISTR2 log_scr;
+   UNISTR2 prof_path;
+   UNISTR2 desc;
+   UNISTR2 wkstas;
+   UNISTR2 mung_dial;
+   UNISTR2 unk;
 
    ctr = talloc(mem_ctx, SAM_USERINFO_CTR);
    if(!ctr)
@@ -318,13 +327,13 @@
 
    ZERO_STRUCTP(ctr->info.id23);
 
-   ctr->info.id23 = talloc(mem_ctx, SAM_USER_INFO_23);
-   if(!ctr->info.id23)
+   ctr->info.id21 = talloc(mem_ctx, SAM_USER_INFO_21);
+   if(!ctr->info.id21)
       return NULL;
 
-   ctr->switch_value = 23;
+   ctr->switch_value = 21;
 
-   ZERO_STRUCTP(ctr->info.id23);
+   ZERO_STRUCTP(ctr->info.id21);
 
    unix_to_nt_time(&logon_time, info->logon_time);
    unix_to_nt_time(&logoff_time, info->logoff_time);
@@ -333,28 +342,40 @@
    unix_to_nt_time(&pass_can_change_time, info->pass_can_change_time);
    unix_to_nt_time(&pass_must_change_time, info->pass_must_change_time);
 
-   encode_pw_buffer(pw, info->new_password, STR_UNICODE);
-   
+   /*initialize the strings*/
+   init_unistr2(&user_name, info->username, STR_TERMINATE);
+   init_unistr2(&full_name, info->full_name, STR_TERMINATE);
+   init_unistr2(&home_dir, info->home_dir, STR_TERMINATE);
+   init_unistr2(&dir_drive, info->home_drive, STR_TERMINATE);
+   init_unistr2(&log_scr, info->logon_script, STR_TERMINATE);
+   init_unistr2(&prof_path, info->profile_path, STR_TERMINATE);
+   init_unistr2(&desc, info->description, STR_TERMINATE);
+   init_unistr2(&wkstas, info->workstations, STR_TERMINATE);
+   init_unistr2(&unk, "\0", STR_TERMINATE);
+   init_unistr2(&mung_dial, info->dial, STR_TERMINATE);
+
    /*manually set passmustchange*/
-   ctr->info.id23->passmustchange = (info->pass_must_change) ? 0x01 : 0x00;
+   ctr->info.id21->passmustchange = (info->pass_must_change) ? 0x01 : 0x00;
 
-   init_sam_user_info23A(ctr->info.id23,
+   init_sam_user_info21W(ctr->info.id21,
                          &logon_time,
                          &logoff_time,
                          &kickoff_time,
                          &pass_last_set_time,
                          &pass_can_change_time,
                          &pass_must_change_time,
-                         info->username,
-                         info->full_name,
-                         info->home_dir,
-                         info->home_drive,
-                         info->logon_script,
-                         info->profile_path,
-                         info->description,
-                         info->workstations,
-                         "\0",
-                         info->dial,
+                         &user_name,
+                         &full_name,
+                         &home_dir,
+                         &dir_drive,
+                         &log_scr,
+                         &prof_path,
+                         &desc,
+                         &wkstas,
+                         &unk,
+                         &mung_dial,
+                         info->lm_password,
+                         info->nt_password,
                          info->rid,
                          info->group_rid,
                          info->acb_mask,
@@ -362,9 +383,8 @@
                          168, /*logon divs*/
                          info->logon_hours,
                          info->bad_passwd_count,
-                         info->logon_count,
-                         (char *)pw);
- 
+                         info->logon_count);
+
    return ctr;
    
 }

Reply via email to