svn commit: samba r20970 - in branches: SAMBA_3_0/source/rpc_client
SAMBA_3_0/source/rpcclient SAMBA_3_0_24/source/rpc_client
SAMBA_3_0_24/source/rpcclient
gd at samba.org
gd at samba.org
Tue Jan 23 10:51:35 GMT 2007
Author: gd
Date: 2007-01-23 10:51:35 +0000 (Tue, 23 Jan 2007)
New Revision: 20970
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20970
Log:
Allow to define workstation for samlogon in rpcclient (for testing).
Guenther
Modified:
branches/SAMBA_3_0/source/rpc_client/cli_netlogon.c
branches/SAMBA_3_0/source/rpcclient/cmd_netlogon.c
branches/SAMBA_3_0_24/source/rpc_client/cli_netlogon.c
branches/SAMBA_3_0_24/source/rpcclient/cmd_netlogon.c
Changeset:
Modified: branches/SAMBA_3_0/source/rpc_client/cli_netlogon.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_client/cli_netlogon.c 2007-01-23 10:37:36 UTC (rev 20969)
+++ branches/SAMBA_3_0/source/rpc_client/cli_netlogon.c 2007-01-23 10:51:35 UTC (rev 20970)
@@ -733,6 +733,7 @@
const char *domain,
const char *username,
const char *password,
+ const char *workstation,
int logon_type)
{
prs_struct qbuf, rbuf;
@@ -750,7 +751,11 @@
ZERO_STRUCT(r);
ZERO_STRUCT(ret_creds);
- fstr_sprintf( clnt_name_slash, "\\\\%s", global_myname() );
+ if (workstation) {
+ fstr_sprintf( clnt_name_slash, "\\\\%s", workstation );
+ } else {
+ fstr_sprintf( clnt_name_slash, "\\\\%s", global_myname() );
+ }
/* Initialise input parameters */
Modified: branches/SAMBA_3_0/source/rpcclient/cmd_netlogon.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/cmd_netlogon.c 2007-01-23 10:37:36 UTC (rev 20969)
+++ branches/SAMBA_3_0/source/rpcclient/cmd_netlogon.c 2007-01-23 10:51:35 UTC (rev 20970)
@@ -338,11 +338,12 @@
const char *username, *password;
int auth_level = 2;
uint32 logon_param = 0;
+ const char *workstation = NULL;
/* Check arguments */
if (argc < 3 || argc > 6) {
- fprintf(stderr, "Usage: samlogon <username> <password> "
+ fprintf(stderr, "Usage: samlogon <username> <password> [workstation]"
"[logon_type (1 or 2)] [auth level (2 or 3)] [logon_parameter]\n");
return NT_STATUS_OK;
}
@@ -350,18 +351,21 @@
username = argv[1];
password = argv[2];
- if (argc >= 4)
- sscanf(argv[3], "%i", &logon_type);
+ if (argc >= 4)
+ workstation = argv[3];
if (argc >= 5)
- sscanf(argv[4], "%i", &auth_level);
+ sscanf(argv[4], "%i", &logon_type);
- if (argc == 6)
- sscanf(argv[5], "%x", &logon_param);
+ if (argc >= 6)
+ sscanf(argv[5], "%i", &auth_level);
+ if (argc == 7)
+ sscanf(argv[6], "%x", &logon_param);
+
/* Perform the sam logon */
- result = rpccli_netlogon_sam_logon(cli, mem_ctx, logon_param, lp_workgroup(), username, password, logon_type);
+ result = rpccli_netlogon_sam_logon(cli, mem_ctx, logon_param, lp_workgroup(), username, password, workstation, logon_type);
if (!NT_STATUS_IS_OK(result))
goto done;
Modified: branches/SAMBA_3_0_24/source/rpc_client/cli_netlogon.c
===================================================================
--- branches/SAMBA_3_0_24/source/rpc_client/cli_netlogon.c 2007-01-23 10:37:36 UTC (rev 20969)
+++ branches/SAMBA_3_0_24/source/rpc_client/cli_netlogon.c 2007-01-23 10:51:35 UTC (rev 20970)
@@ -695,6 +695,7 @@
const char *domain,
const char *username,
const char *password,
+ const char *workstation,
int logon_type)
{
prs_struct qbuf, rbuf;
@@ -712,7 +713,11 @@
ZERO_STRUCT(r);
ZERO_STRUCT(ret_creds);
- fstr_sprintf( clnt_name_slash, "\\\\%s", global_myname() );
+ if (workstation) {
+ fstr_sprintf( clnt_name_slash, "\\\\%s", workstation );
+ } else {
+ fstr_sprintf( clnt_name_slash, "\\\\%s", global_myname() );
+ }
/* Initialise input parameters */
Modified: branches/SAMBA_3_0_24/source/rpcclient/cmd_netlogon.c
===================================================================
--- branches/SAMBA_3_0_24/source/rpcclient/cmd_netlogon.c 2007-01-23 10:37:36 UTC (rev 20969)
+++ branches/SAMBA_3_0_24/source/rpcclient/cmd_netlogon.c 2007-01-23 10:51:35 UTC (rev 20970)
@@ -301,11 +301,12 @@
const char *username, *password;
int auth_level = 2;
uint32 logon_param = 0;
+ const char *workstation = NULL;
/* Check arguments */
if (argc < 3 || argc > 6) {
- fprintf(stderr, "Usage: samlogon <username> <password> "
+ fprintf(stderr, "Usage: samlogon <username> <password> [workstation]"
"[logon_type (1 or 2)] [auth level (2 or 3)] [logon_parameter]\n");
return NT_STATUS_OK;
}
@@ -313,18 +314,21 @@
username = argv[1];
password = argv[2];
- if (argc >= 4)
- sscanf(argv[3], "%i", &logon_type);
+ if (argc >= 4)
+ workstation = argv[3];
if (argc >= 5)
- sscanf(argv[4], "%i", &auth_level);
+ sscanf(argv[4], "%i", &logon_type);
- if (argc == 6)
- sscanf(argv[5], "%x", &logon_param);
+ if (argc >= 6)
+ sscanf(argv[5], "%i", &auth_level);
+ if (argc == 7)
+ sscanf(argv[6], "%x", &logon_param);
+
/* Perform the sam logon */
- result = rpccli_netlogon_sam_logon(cli, mem_ctx, logon_param, lp_workgroup(), username, password, logon_type);
+ result = rpccli_netlogon_sam_logon(cli, mem_ctx, logon_param, lp_workgroup(), username, password, workstation, logon_type);
if (!NT_STATUS_IS_OK(result))
goto done;
More information about the samba-cvs
mailing list