svn commit: samba r9525 - in branches/SOC/SAMBA_3_0/source:
libmsrpc libmsrpc/test libmsrpc/test/sam rpcclient
skel at samba.org
skel at samba.org
Tue Aug 23 15:59:26 GMT 2005
Author: skel
Date: 2005-08-23 15:59:25 +0000 (Tue, 23 Aug 2005)
New Revision: 9525
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9525
Log:
fixed bug in cac_SamSetUserInfo() - it was sending the wrong flags
Modified:
branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c
branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c
branches/SOC/SAMBA_3_0/source/rpcclient/cmd_samr.c
Changeset:
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c 2005-08-23 14:09:42 UTC (rev 9524)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/libmsrpc_internal.c 2005-08-23 15:59:25 UTC (rev 9525)
@@ -346,35 +346,35 @@
SAM_USERINFO_CTR *cac_MakeUserInfoCtr(TALLOC_CTX *mem_ctx, CacUserInfo *info) {
SAM_USERINFO_CTR *ctr = NULL;
+ /*the flags we are 'setting'- include/passdb.h*/
+ uint32 flags = ACCT_USERNAME | ACCT_FULL_NAME | ACCT_PRIMARY_GID | ACCT_ADMIN_DESC | ACCT_DESCRIPTION |
+ ACCT_HOME_DIR | ACCT_HOME_DRIVE | ACCT_LOGON_SCRIPT | ACCT_PROFILE | ACCT_WORKSTATIONS |
+ ACCT_FLAGS;
+
NTTIME logon_time;
NTTIME logoff_time;
NTTIME kickoff_time;
NTTIME pass_last_set_time;
NTTIME pass_can_change_time;
NTTIME pass_must_change_time;
- UNISTR2 user_name;
- UNISTR2 full_name;
- UNISTR2 home_dir;
- UNISTR2 dir_drive;
- UNISTR2 log_scr;
- UNISTR2 prof_path;
- UNISTR2 desc;
- UNISTR2 wkstas;
- UNISTR2 unk_str;
- UNISTR2 mung_dial;
+
char pw[516];
+ char dummy[1] = "\0";
ctr = talloc(mem_ctx, SAM_USERINFO_CTR);
if(!ctr)
return NULL;
+ ZERO_STRUCTP(ctr->info.id23);
+
ctr->info.id23 = talloc(mem_ctx, SAM_USER_INFO_23);
if(!ctr->info.id23)
return NULL;
- ZERO_STRUCTP(ctr->info.id23);
ctr->switch_value = 23;
+ ZERO_STRUCTP(ctr->info.id23);
+
unix_to_nt_time(&logon_time, info->logon_time);
unix_to_nt_time(&logoff_time, info->logoff_time);
unix_to_nt_time(&kickoff_time, info->kickoff_time);
@@ -382,7 +382,7 @@
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);
+ encode_pw_buffer(pw, dummy, STR_UNICODE);
/*manually set passmustchange*/
@@ -408,12 +408,12 @@
info->rid,
info->group_rid,
info->acb_mask,
- ACCT_FLAGS,
+ flags,
168, /*logon divs*/
info->logon_hours,
info->bad_passwd_count,
info->logon_count,
- pw);
+ (char *)pw);
return ctr;
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c 2005-08-23 14:09:42 UTC (rev 9524)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/sam/samuser.c 2005-08-23 15:59:25 UTC (rev 9525)
@@ -8,17 +8,21 @@
TALLOC_CTX *mem_ctx = NULL;
- struct SamOpenUser ou;
- struct SamEnumUsers eu;
- struct SamCreateUser cu;
+ struct SamOpenUser ou;
+ struct SamEnumUsers eu;
+ struct SamCreateUser cu;
struct SamGetUserInfo gi;
struct SamSetUserInfo si;
- struct SamRenameUser ru;
+ struct SamRenameUser ru;
+ struct SamSetPassword sp;
POLICY_HND *user_hnd = NULL;
fstring tmp;
fstring input;
+
+ char *pass1 = NULL;
+ char *pass2 = NULL;
int i;
@@ -55,6 +59,7 @@
printf("[g]et user info\n");
printf("[e]dit user info\n");
printf("[r]ename user\n");
+ printf("reset [p]assword\n");
printf("[n] close user\n");
printf("[q]uit\n\n");
@@ -237,6 +242,35 @@
break;
+ case 'p': /*reset password*/
+
+ if(!user_hnd) {
+ printf("Must open user first!\n");
+ break;
+ }
+
+ do {
+ if(pass1 && pass2) {
+ printf("Passwords do not match. Please try again\n");
+ }
+
+ pass1 = getpass("Enter new password: ");
+ pass2 = getpass("Re-enter new password: ");
+ } while(strncmp(pass1, pass2, MAX_PASS_LEN));
+
+ ZERO_STRUCT(sp);
+ sp.in.user_hnd = user_hnd;
+ sp.in.password = talloc_strdup(mem_ctx, pass1);
+
+ if(!cac_SamSetPassword(hnd, mem_ctx, &sp)) {
+ printf("Could not set password. Error: %s\n", nt_errstr(hnd->status));
+ }
+ else {
+ printf("Done.\n");
+ }
+
+ break;
+
case 'q':
break;
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c 2005-08-23 14:09:42 UTC (rev 9524)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/test/test_util.c 2005-08-23 15:59:25 UTC (rev 9525)
@@ -46,6 +46,11 @@
i++;
}
+ else if(strncmp(argv[i], "-d", sizeof(fstring)) == 0) {
+ sscanf(argv[i+1], "%d", &hnd->debug);
+ i++;
+ }
+
else { /*assume this is the server name*/
hnd->server = SMB_MALLOC_ARRAY(char, sizeof(fstring));
strncpy(hnd->server, argv[i], sizeof(fstring));
@@ -315,7 +320,7 @@
}
void print_cac_group_info(CacGroupInfo *info) {
- printf(" Group Name : %s\n", info->group_name);
+ printf(" Group Name : %s\n", info->name);
printf(" Description : %s\n", info->description);
printf(" Num Members : %d\n", info->num_members);
}
@@ -323,10 +328,10 @@
void edit_cac_group_info(TALLOC_CTX *mem_ctx, CacGroupInfo *info) {
fstring tmp;
- printf("Group Name [%s]: ", info->group_name);
+ printf("Group Name [%s]: ", info->name);
edit_readline(tmp);
if(tmp[0] != '\0')
- info->group_name = talloc_strdup(mem_ctx, tmp);
+ info->name = talloc_strdup(mem_ctx, tmp);
printf("Description [%s]: ", info->description);
edit_readline(tmp);
Modified: branches/SOC/SAMBA_3_0/source/rpcclient/cmd_samr.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/rpcclient/cmd_samr.c 2005-08-23 14:09:42 UTC (rev 9524)
+++ branches/SOC/SAMBA_3_0/source/rpcclient/cmd_samr.c 2005-08-23 15:59:25 UTC (rev 9525)
@@ -44,7 +44,6 @@
static void display_sam_user_info_21(SAM_USER_INFO_21 *usr)
{
fstring temp;
- int i;
unistr2_to_ascii(temp, &usr->uni_user_name, sizeof(temp)-1);
printf("\tUser Name :\t%s\n", temp);
@@ -104,9 +103,6 @@
if (usr->ptr_logon_hrs) {
printf("\tlogon_hrs[0..%d]...\n", usr->logon_hrs.len);
- for(i = 0; i < usr->logon_hrs.len; i++) {
- printf("\t hours[%d] => 0x%x\n", i, usr->logon_hrs.hours[i]);
- }
}
}
More information about the samba-cvs
mailing list