summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-12 23:15:52 +0000
committerJeremy Allison <jra@samba.org>2002-11-12 23:15:52 +0000
commit250c9801197ea1c949bd94c1c891f81ab118b130 (patch)
tree3a0ec79c71a010961d78726e223a70e1bc75c73f /source3/libsmb
parent477025a6f628fd1a8d3bfacd30726e7a41819e50 (diff)
downloadsamba-250c9801197ea1c949bd94c1c891f81ab118b130.tar.gz
samba-250c9801197ea1c949bd94c1c891f81ab118b130.tar.bz2
samba-250c9801197ea1c949bd94c1c891f81ab118b130.zip
Removed global_myworkgroup, global_myname, global_myscope. Added liberal
dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit 82b8f749a36b42e22186297482aad2abb04fab8a)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c51
-rw-r--r--source3/libsmb/namequery.c17
-rw-r--r--source3/libsmb/nmblib.c31
-rw-r--r--source3/libsmb/passchange.c5
-rw-r--r--source3/libsmb/pwd_cache.c14
-rw-r--r--source3/libsmb/trust_passwd.c6
6 files changed, 54 insertions, 70 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index ee311932a7..584ad15174 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -44,8 +44,8 @@ static const struct {
Do an old lanman2 style session setup.
****************************************************************************/
-static BOOL cli_session_setup_lanman2(struct cli_state *cli, char *user,
- char *pass, int passlen, const char *workgroup)
+static BOOL cli_session_setup_lanman2(struct cli_state *cli, const char *user,
+ const char *pass, int passlen, const char *workgroup)
{
fstring pword;
char *p;
@@ -183,8 +183,8 @@ static BOOL cli_session_setup_guest(struct cli_state *cli)
Do a NT1 plaintext session setup.
****************************************************************************/
-static BOOL cli_session_setup_plaintext(struct cli_state *cli, char *user,
- char *pass, char *workgroup)
+static BOOL cli_session_setup_plaintext(struct cli_state *cli, const char *user,
+ const char *pass, const char *workgroup)
{
uint32 capabilities = cli_session_setup_capabilities(cli);
char *p;
@@ -228,7 +228,7 @@ static BOOL cli_session_setup_plaintext(struct cli_state *cli, char *user,
return True;
}
-static void set_signing_on_cli (struct cli_state *cli, char* pass, uint8 response[24])
+static void set_signing_on_cli (struct cli_state *cli, const char* pass, uint8 response[24])
{
uint8 zero_sig[8];
ZERO_STRUCT(zero_sig);
@@ -264,10 +264,10 @@ static void set_temp_signing_on_cli(struct cli_state *cli)
@param workgroup The user's domain.
****************************************************************************/
-static BOOL cli_session_setup_nt1(struct cli_state *cli, char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *workgroup)
+static BOOL cli_session_setup_nt1(struct cli_state *cli, const char *user,
+ const char *pass, int passlen,
+ const char *ntpass, int ntpasslen,
+ const char *workgroup)
{
uint32 capabilities = cli_session_setup_capabilities(cli);
uchar pword[24];
@@ -423,7 +423,7 @@ static DATA_BLOB cli_session_setup_blob(struct cli_state *cli, DATA_BLOB blob)
Do a spnego/kerberos encrypted session setup.
****************************************************************************/
-static BOOL cli_session_setup_kerberos(struct cli_state *cli, char *principal, char *workgroup)
+static BOOL cli_session_setup_kerberos(struct cli_state *cli, const char *principal, const char *workgroup)
{
DATA_BLOB blob2, negTokenTarg;
@@ -453,8 +453,8 @@ static BOOL cli_session_setup_kerberos(struct cli_state *cli, char *principal, c
Do a spnego/NTLMSSP encrypted session setup.
****************************************************************************/
-static BOOL cli_session_setup_ntlmssp(struct cli_state *cli, char *user,
- char *pass, char *workgroup)
+static BOOL cli_session_setup_ntlmssp(struct cli_state *cli, const char *user,
+ const char *pass, const char *workgroup)
{
DATA_BLOB msg1, struct_blob;
DATA_BLOB blob, chal1, chal2, auth, challenge_blob;
@@ -581,8 +581,8 @@ static BOOL cli_session_setup_ntlmssp(struct cli_state *cli, char *user,
Do a spnego encrypted session setup.
****************************************************************************/
-static BOOL cli_session_setup_spnego(struct cli_state *cli, char *user,
- char *pass, char *workgroup)
+static BOOL cli_session_setup_spnego(struct cli_state *cli, const char *user,
+ const char *pass, const char *workgroup)
{
char *principal;
char *OIDs[ASN1_MAX_OIDS];
@@ -646,10 +646,10 @@ ntlmssp:
****************************************************************************/
BOOL cli_session_setup(struct cli_state *cli,
- char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *workgroup)
+ const char *user,
+ const char *pass, int passlen,
+ const char *ntpass, int ntpasslen,
+ const char *workgroup)
{
char *p;
fstring user2;
@@ -1130,8 +1130,8 @@ BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip)
Initialise client credentials for authenticated pipe access.
****************************************************************************/
-static void init_creds(struct ntuser_creds *creds, char* username,
- char* domain, char* password)
+static void init_creds(struct ntuser_creds *creds, const char* username,
+ const char* domain, const char* password)
{
ZERO_STRUCTP(creds);
@@ -1163,9 +1163,9 @@ NTSTATUS cli_full_connection(struct cli_state **output_cli,
const char *my_name,
const char *dest_host,
struct in_addr *dest_ip, int port,
- char *service, char *service_type,
- char *user, char *domain,
- char *password, int flags,
+ const char *service, const char *service_type,
+ const char *user, const char *domain,
+ const char *password, int flags,
BOOL *retry)
{
struct ntuser_creds creds;
@@ -1174,13 +1174,12 @@ NTSTATUS cli_full_connection(struct cli_state **output_cli,
struct nmb_name called;
struct cli_state *cli;
struct in_addr ip;
- extern pstring global_myname;
if (retry)
*retry = False;
if (!my_name)
- my_name = global_myname;
+ my_name = global_myname();
if (!(cli = cli_initialise(NULL)))
return NT_STATUS_NO_MEMORY;
@@ -1258,7 +1257,7 @@ again:
if (service) {
if (!cli_send_tconX(cli, service, service_type,
- (char*)password, strlen(password)+1)) {
+ password, strlen(password)+1)) {
DEBUG(1,("failed tcon_X with %s\n", nt_errstr(nt_status)));
nt_status = cli_nt_error(cli);
cli_shutdown(cli);
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 8fdf145625..5c3d942b90 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -471,7 +471,8 @@ BOOL getlmhostsent( XFILE *fp, pstring name, int *name_type, struct in_addr *ipa
while(!x_feof(fp) && !x_ferror(fp)) {
pstring ip,flags,extra;
- char *ptr;
+ const char *ptr;
+ char *ptr1;
int count = 0;
*name_type = -1;
@@ -524,20 +525,20 @@ BOOL getlmhostsent( XFILE *fp, pstring name, int *name_type, struct in_addr *ipa
/* Extra feature. If the name ends in '#XX', where XX is a hex number,
then only add that name type. */
- if((ptr = strchr_m(name, '#')) != NULL)
+ if((ptr1 = strchr_m(name, '#')) != NULL)
{
char *endptr;
- ptr++;
- *name_type = (int)strtol(ptr, &endptr, 16);
+ ptr1++;
+ *name_type = (int)strtol(ptr1, &endptr, 16);
- if(!*ptr || (endptr == ptr))
+ if(!*ptr1 || (endptr == ptr1))
{
DEBUG(0,("getlmhostsent: invalid name %s containing '#'.\n", name));
continue;
}
- *(--ptr) = '\0'; /* Truncate at the '#' */
+ *(--ptr1) = '\0'; /* Truncate at the '#' */
}
return True;
@@ -787,7 +788,7 @@ static BOOL internal_resolve_name(const char *name, int name_type,
{
pstring name_resolve_list;
fstring tok;
- char *ptr;
+ const char *ptr;
BOOL allones = (strcmp(name,"255.255.255.255") == 0);
BOOL allzeros = (strcmp(name,"0.0.0.0") == 0);
BOOL is_address = is_ipaddress(name);
@@ -1242,7 +1243,7 @@ BOOL get_dc_list(const char *domain, struct in_addr **ip_list, int *count)
*/
if (strequal(domain, lp_workgroup())) {
- char *p;
+ const char *p;
char *pserver = lp_passwordserver();
fstring name;
int num_adresses = 0;
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index ba0d8cee5d..43e32aebbd 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -28,14 +28,14 @@ static const struct opcode_names {
char *nmb_opcode_name;
int opcode;
} nmb_header_opcode_names[] = {
- {"Query", 0 },
- {"Registration", 5 },
- {"Release", 6 },
- {"WACK", 7 },
- {"Refresh", 8 },
- {"Refresh(altcode)", 9 },
- {"Multi-homed Registration", 15 },
- {0, -1 }
+ {"Query", 0 },
+ {"Registration", 5 },
+ {"Release", 6 },
+ {"WACK", 7 },
+ {"Refresh", 8 },
+ {"Refresh(altcode)", 9 },
+ {"Multi-homed Registration", 15 },
+ {0, -1 }
};
/****************************************************************************
@@ -814,15 +814,15 @@ static int build_dgram(char *buf,struct packet_struct *p)
}
/*******************************************************************
- build a nmb name
- *******************************************************************/
+ Build a nmb name
+*******************************************************************/
+
void make_nmb_name( struct nmb_name *n, const char *name, int type)
{
- extern pstring global_scope;
memset( (char *)n, '\0', sizeof(struct nmb_name) );
push_ascii(n->name, name, 16, STR_TERMINATE|STR_UPPER);
n->name_type = (unsigned int)type & 0xFF;
- StrnCpy( n->scope, global_scope, 63 );
+ StrnCpy( n->scope, global_scope(), 63 );
strupper( n->scope );
}
@@ -1180,7 +1180,6 @@ int name_mangle( char *In, char *Out, char name_type )
int len;
char buf[20];
char *p = Out;
- extern pstring global_scope;
/* Safely copy the input string, In, into buf[]. */
(void)memset( buf, 0, 20 );
@@ -1204,9 +1203,9 @@ int name_mangle( char *In, char *Out, char name_type )
p[0] = '\0';
/* Add the scope string. */
- for( i = 0, len = 0; NULL != global_scope; i++, len++ )
+ for( i = 0, len = 0; NULL != global_scope(); i++, len++ )
{
- switch( global_scope[i] )
+ switch( (global_scope())[i] )
{
case '\0':
p[0] = len;
@@ -1219,7 +1218,7 @@ int name_mangle( char *In, char *Out, char name_type )
len = -1;
break;
default:
- p[len+1] = global_scope[i];
+ p[len+1] = (global_scope())[i];
break;
}
}
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index b96bdc95a1..41b6095520 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -20,9 +20,6 @@
#include "includes.h"
-
-extern pstring global_myname;
-
/*************************************************************
change a password on a remote machine using IPC calls
*************************************************************/
@@ -50,7 +47,7 @@ BOOL remote_password_change(const char *remote_machine, const char *user_name,
return False;
}
- make_nmb_name(&calling, global_myname , 0x0);
+ make_nmb_name(&calling, global_myname() , 0x0);
make_nmb_name(&called , remote_machine, 0x20);
if (!cli_session_request(&cli, &calling, &called)) {
diff --git a/source3/libsmb/pwd_cache.c b/source3/libsmb/pwd_cache.c
index fc0602507a..7ddcf853c4 100644
--- a/source3/libsmb/pwd_cache.c
+++ b/source3/libsmb/pwd_cache.c
@@ -41,7 +41,7 @@ static void pwd_init(struct pwd_info *pwd)
Makes lm and nt hashed passwords.
****************************************************************************/
-static void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr)
+static void pwd_make_lm_nt_16(struct pwd_info *pwd, const char *clr)
{
pstring dos_passwd;
@@ -59,7 +59,7 @@ static void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr)
Stores a cleartext password.
****************************************************************************/
-void pwd_set_cleartext(struct pwd_info *pwd, char *clr)
+void pwd_set_cleartext(struct pwd_info *pwd, const char *clr)
{
pwd_init(pwd);
push_ascii_fstring(pwd->password, clr);
@@ -138,13 +138,3 @@ void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24], uchar nt_owf[24])
if (nt_owf != NULL)
memcpy(nt_owf, pwd->smb_nt_owf, 24);
}
-
-
-
-
-
-
-
-
-
-
diff --git a/source3/libsmb/trust_passwd.c b/source3/libsmb/trust_passwd.c
index 4d7acd1988..cf9fd58b13 100644
--- a/source3/libsmb/trust_passwd.c
+++ b/source3/libsmb/trust_passwd.c
@@ -20,8 +20,6 @@
#include "includes.h"
-extern pstring global_myname;
-
/*********************************************************
Change the domain password on the PDC.
@@ -45,7 +43,7 @@ static NTSTATUS just_change_the_password(struct cli_state *cli, TALLOC_CTX *mem_
return result;
}
- result = cli_net_srv_pwset(cli, mem_ctx, global_myname, new_trust_passwd_hash);
+ result = cli_net_srv_pwset(cli, mem_ctx, global_myname(), new_trust_passwd_hash);
if (!NT_STATUS_IS_OK(result)) {
DEBUG(0,("just_change_the_password: unable to change password (%s)!\n",
@@ -99,7 +97,7 @@ NTSTATUS trust_pw_change_and_store_it(struct cli_state *cli, TALLOC_CTX *mem_ctx
**********************************************************/
NTSTATUS trust_pw_find_change_and_store_it(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- char *domain)
+ const char *domain)
{
unsigned char old_trust_passwd_hash[16];
char *up_domain;