summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-10-10 00:58:12 +0000
committerLuke Leighton <lkcl@samba.org>1998-10-10 00:58:12 +0000
commiteb70607c864d3d7d03a01fa39c3716a75db2c3db (patch)
tree7847a537259eefb14ab68ab0d22e39aa8e365ef9
parent827a9d862ebe3d5ce1853999d16bd121fddcc796 (diff)
downloadsamba-eb70607c864d3d7d03a01fa39c3716a75db2c3db.tar.gz
samba-eb70607c864d3d7d03a01fa39c3716a75db2c3db.tar.bz2
samba-eb70607c864d3d7d03a01fa39c3716a75db2c3db.zip
dce/rpc
(This used to be commit b0af7cfd9dea8d286f430c51456b5f67d5e0658a)
-rw-r--r--source3/include/proto.h5
-rw-r--r--source3/rpcclient/cmd_samr.c60
-rw-r--r--source3/rpcclient/rpcclient.c1
3 files changed, 54 insertions, 12 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9e2d4d33b0..e594780535 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1732,8 +1732,8 @@ void make_enc_hash(SAMR_ENC_HASH *hsh, char hash[16]);
void samr_io_enc_hash(char *desc, SAMR_ENC_HASH *hsh, prs_struct *ps, int depth);
void make_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u,
char *dest_host, char *user_name,
- char lm_newpass[516], char nt_oldhash[16],
- char nt_newpass[516], char lm_oldhash[16]);
+ char nt_newpass[516], char nt_oldhash[16],
+ char lm_newpass[516], char lm_oldhash[16]);
void samr_io_q_chgpasswd_user(char *desc, SAMR_Q_CHGPASSWD_USER *q_u, prs_struct *ps, int depth);
void samr_io_r_chgpasswd_user(char *desc, SAMR_R_CHGPASSWD_USER *r_u, prs_struct *ps, int depth);
@@ -1904,6 +1904,7 @@ void cmd_lsa_lookup_sids(struct client_info *info);
/*The following definitions come from rpcclient/cmd_samr.c */
+void cmd_sam_ntchange_pwd(struct client_info *info);
void cmd_sam_test(struct client_info *info);
void cmd_sam_enum_users(struct client_info *info);
void cmd_sam_query_user(struct client_info *info);
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 86a5619540..81fd373613 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -39,9 +39,9 @@ extern FILE* out_hnd;
/****************************************************************************
-experimental SAM encryted rpc test connection
+SAM password change
****************************************************************************/
-void cmd_sam_test(struct client_info *info)
+void cmd_sam_ntchange_pwd(struct client_info *info)
{
fstring srv_name;
fstring domain;
@@ -60,23 +60,17 @@ void cmd_sam_test(struct client_info *info)
fstrcpy(sid , info->dom.level5_sid);
fstrcpy(domain, info->dom.level5_dom);
- if (strlen(sid) == 0)
- {
- fprintf(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n");
- return;
- }
-
fstrcpy(srv_name, "\\\\");
fstrcat(srv_name, info->dest_host);
strupper(srv_name);
- fprintf(out_hnd, "SAM Encryption Test\n");
+ fprintf(out_hnd, "SAM NT Password Change\n");
#if 0
struct pwd_info new_pwd;
pwd_read(&new_pwd, "New Password (ONCE: this is test code!):", True);
#endif
- new_passwd = (char*)getpass("New Password (ONCE: this is test code!):");
+ new_passwd = (char*)getpass("New Password (ONCE ONLY - get it right :-)");
nt_lm_owf_gen(new_passwd, lm_newhash, nt_newhash);
pwd_get_lm_nt_16(&(smb_cli->pwd), lm_oldhash, nt_oldhash );
@@ -102,6 +96,52 @@ void cmd_sam_test(struct client_info *info)
if (res)
{
+ DEBUG(5,("cmd_sam_ntpasswd_chg: succeeded\n"));
+ }
+ else
+ {
+ DEBUG(5,("cmd_sam_ntpasswd_chg: failed\n"));
+ }
+}
+
+
+/****************************************************************************
+experimental SAM encryted rpc test connection
+****************************************************************************/
+void cmd_sam_test(struct client_info *info)
+{
+ fstring srv_name;
+ fstring domain;
+ fstring sid;
+ char *new_passwd;
+ BOOL res = True;
+
+ fstrcpy(sid , info->dom.level5_sid);
+ fstrcpy(domain, info->dom.level5_dom);
+
+ if (strlen(sid) == 0)
+ {
+ fprintf(out_hnd, "please use 'lsaquery' first, to ascertain the SID\n");
+ return;
+ }
+
+ fstrcpy(srv_name, "\\\\");
+ fstrcat(srv_name, info->dest_host);
+ strupper(srv_name);
+
+ fprintf(out_hnd, "SAM Encryption Test\n");
+
+ /* open SAMR session. */
+ res = res ? cli_nt_session_open(smb_cli, PIPE_SAMR, True) : False;
+
+ /* establish a connection. */
+ res = res ? do_samr_unknown_38(smb_cli, srv_name) : False;
+
+ /* close the session */
+ cli_nt_session_close(smb_cli);
+
+ if (res)
+ {
DEBUG(5,("cmd_sam_test: succeeded\n"));
}
else
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 9d657e923d..a31fd60b0c 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -117,6 +117,7 @@ struct
{"lsaquery", cmd_lsa_query_info, "Query Info Policy (domain member or server)"},
{"lookupsids", cmd_lsa_lookup_sids, "Resolve names from SIDs"},
{"enumusers", cmd_sam_enum_users, "SAM User Database Query (experimental!)"},
+ {"ntpass", cmd_sam_ntchange_pwd, "NT SAM Password Change"},
{"samuser", cmd_sam_query_user, "<username> SAM User Query (experimental!)"},
{"samtest", cmd_sam_test , "SAM User Encrypted RPC test (experimental!)"},
{"enumaliases",cmd_sam_enum_aliases, "SAM Aliases Database Query (experimental!)"},