summaryrefslogtreecommitdiff
path: root/source3/utils
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/utils
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/utils')
-rw-r--r--source3/utils/net.c31
-rw-r--r--source3/utils/net_ads.c45
-rw-r--r--source3/utils/net_ads_cldap.c3
-rw-r--r--source3/utils/net_rpc.c11
-rw-r--r--source3/utils/net_rpc_join.c8
-rw-r--r--source3/utils/net_time.c3
-rw-r--r--source3/utils/nmblookup.c8
-rw-r--r--source3/utils/pdbedit.c17
-rw-r--r--source3/utils/smbcacls.c18
-rw-r--r--source3/utils/smbcontrol.c2
-rw-r--r--source3/utils/smbgroupedit.c16
-rw-r--r--source3/utils/smbpasswd.c10
-rw-r--r--source3/utils/testparm.c6
13 files changed, 60 insertions, 118 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 4b1a52992e..ba08feae19 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -61,7 +61,7 @@ char *opt_host = NULL;
char *opt_password = NULL;
char *opt_user_name = NULL;
BOOL opt_user_specified = False;
-char *opt_workgroup = NULL;
+const char *opt_workgroup = NULL;
int opt_long_list_entries = 0;
int opt_reboot = 0;
int opt_force = 0;
@@ -77,7 +77,6 @@ static int opt_machine_pass = 0;
BOOL opt_have_ip = False;
struct in_addr opt_dest_ip;
-extern pstring global_myname;
extern BOOL AllowDebugChange;
/*
@@ -188,7 +187,7 @@ BOOL net_find_server(unsigned flags, struct in_addr *server_ip, char **server_na
if (is_zero_ip(pdc_ip))
return False;
- if (!lookup_dc_name(global_myname, opt_target_workgroup, &pdc_ip, dc_name))
+ if (!lookup_dc_name(global_myname(), opt_target_workgroup, &pdc_ip, dc_name))
return False;
*server_name = strdup(dc_name);
@@ -238,7 +237,7 @@ BOOL net_find_dc(struct in_addr *server_ip, fstring server_name, const char *dom
if (is_zero_ip(*server_ip))
return False;
- if (!lookup_dc_name(global_myname, domain_name, server_ip, dc_name))
+ if (!lookup_dc_name(global_myname(), domain_name, server_ip, dc_name))
return False;
safe_strcpy(server_name, dc_name, FSTRING_LEN);
@@ -335,7 +334,7 @@ static int net_getlocalsid(int argc, const char **argv)
name = argv[0];
}
else {
- name = global_myname;
+ name = global_myname();
}
if (!secrets_fetch_domain_sid(name, &sid)) {
@@ -359,7 +358,7 @@ static int net_setlocalsid(int argc, const char **argv)
return 1;
}
- if (!secrets_store_domain_sid(global_myname, &sid)) {
+ if (!secrets_store_domain_sid(global_myname(), &sid)) {
DEBUG(0,("Can't store domain SID as a pdc/bdc.\n"));
return 1;
}
@@ -372,12 +371,12 @@ static int net_getdomainsid(int argc, const char **argv)
DOM_SID domain_sid;
fstring sid_str;
- if (!secrets_fetch_domain_sid(global_myname, &domain_sid)) {
+ if (!secrets_fetch_domain_sid(global_myname(), &domain_sid)) {
d_printf("Could not fetch local SID\n");
return 1;
}
sid_to_string(sid_str, &domain_sid);
- d_printf("SID for domain %s is: %s\n", global_myname, sid_str);
+ d_printf("SID for domain %s is: %s\n", global_myname(), sid_str);
if (!secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) {
d_printf("Could not fetch domain SID\n");
@@ -607,19 +606,11 @@ static struct functable net_func[] = {
}
if (!opt_target_workgroup) {
- opt_target_workgroup = lp_workgroup();
+ opt_target_workgroup = strdup(lp_workgroup());
}
- if (!*global_myname) {
- char *p2;
-
- pstrcpy(global_myname, myhostname());
- p2 = strchr_m(global_myname, '.');
- if (p2)
- *p2 = 0;
- }
-
- strupper(global_myname);
+ if (!init_names())
+ exit(1);
load_interfaces();
@@ -632,7 +623,7 @@ static struct functable net_func[] = {
exit(1);
}
- asprintf(&opt_user_name,"%s$", global_myname);
+ asprintf(&opt_user_name,"%s$", global_myname());
opt_password = secrets_fetch_machine_password();
if (!opt_password) {
d_printf("ERROR: Unable to fetch machine password\n");
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index af290ce83c..b138f67aa3 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -513,19 +513,18 @@ static int net_ads_status(int argc, const char **argv)
{
ADS_STRUCT *ads;
ADS_STATUS rc;
- extern pstring global_myname;
void *res;
if (!(ads = ads_startup())) return -1;
- rc = ads_find_machine_acct(ads, &res, global_myname);
+ rc = ads_find_machine_acct(ads, &res, global_myname());
if (!ADS_ERR_OK(rc)) {
d_printf("ads_find_machine_acct: %s\n", ads_errstr(rc));
return -1;
}
if (ads_count_replies(ads, res) == 0) {
- d_printf("No machine account for '%s' found\n", global_myname);
+ d_printf("No machine account for '%s' found\n", global_myname());
return -1;
}
@@ -538,7 +537,6 @@ static int net_ads_leave(int argc, const char **argv)
{
ADS_STRUCT *ads = NULL;
ADS_STATUS rc;
- extern pstring global_myname;
if (!secrets_init()) {
DEBUG(1,("Failed to initialise secrets database\n"));
@@ -546,7 +544,7 @@ static int net_ads_leave(int argc, const char **argv)
}
if (!opt_password) {
- asprintf(&opt_user_name, "%s$", global_myname);
+ asprintf(&opt_user_name, "%s$", global_myname());
opt_password = secrets_fetch_machine_password();
}
@@ -554,14 +552,14 @@ static int net_ads_leave(int argc, const char **argv)
return -1;
}
- rc = ads_leave_realm(ads, global_myname);
+ rc = ads_leave_realm(ads, global_myname());
if (!ADS_ERR_OK(rc)) {
d_printf("Failed to delete host '%s' from the '%s' realm.\n",
- global_myname, ads->config.realm);
+ global_myname(), ads->config.realm);
return -1;
}
- d_printf("Removed '%s' from realm '%s'\n", global_myname, ads->config.realm);
+ d_printf("Removed '%s' from realm '%s'\n", global_myname(), ads->config.realm);
return 0;
}
@@ -569,14 +567,13 @@ static int net_ads_leave(int argc, const char **argv)
static int net_ads_join_ok(void)
{
ADS_STRUCT *ads = NULL;
- extern pstring global_myname;
if (!secrets_init()) {
DEBUG(1,("Failed to initialise secrets database\n"));
return -1;
}
- asprintf(&opt_user_name, "%s$", global_myname);
+ asprintf(&opt_user_name, "%s$", global_myname());
opt_password = secrets_fetch_machine_password();
if (!(ads = ads_startup())) {
@@ -611,7 +608,6 @@ int net_ads_join(int argc, const char **argv)
ADS_STATUS rc;
char *password;
char *tmp_password;
- extern pstring global_myname;
const char *org_unit = "Computers";
char *dn;
void *res;
@@ -649,7 +645,7 @@ int net_ads_join(int argc, const char **argv)
return -1;
}
- rc = ads_join_realm(ads, global_myname, org_unit);
+ rc = ads_join_realm(ads, global_myname(), org_unit);
if (!ADS_ERR_OK(rc)) {
d_printf("ads_join_realm: %s\n", ads_errstr(rc));
return -1;
@@ -661,7 +657,7 @@ int net_ads_join(int argc, const char **argv)
return -1;
}
- rc = ads_set_machine_password(ads, global_myname, password);
+ rc = ads_set_machine_password(ads, global_myname(), password);
if (!ADS_ERR_OK(rc)) {
d_printf("ads_set_machine_password: %s\n", ads_errstr(rc));
return -1;
@@ -677,7 +673,7 @@ int net_ads_join(int argc, const char **argv)
return -1;
}
- d_printf("Joined '%s' to realm '%s'\n", global_myname, ads->config.realm);
+ d_printf("Joined '%s' to realm '%s'\n", global_myname(), ads->config.realm);
free(password);
@@ -704,7 +700,6 @@ static int net_ads_printer_info(int argc, const char **argv)
ADS_STRUCT *ads;
ADS_STATUS rc;
const char *servername, *printername;
- extern pstring global_myname;
void *res = NULL;
if (!(ads = ads_startup())) return -1;
@@ -717,7 +712,7 @@ static int net_ads_printer_info(int argc, const char **argv)
if (argc > 1)
servername = argv[1];
else
- servername = global_myname;
+ servername = global_myname();
rc = ads_find_printer_on_server(ads, &res, printername, servername);
@@ -750,7 +745,6 @@ static int net_ads_printer_publish(int argc, const char **argv)
ADS_STATUS rc;
char *uncname, *servername;
ADS_PRINTER_ENTRY prt;
- extern pstring global_myname;
char *ports[2] = {"Samba", NULL};
/*
@@ -772,11 +766,11 @@ static int net_ads_printer_publish(int argc, const char **argv)
get_a_printer, because the server name might be
localhost or an ip address */
prt.printerName = argv[0];
- asprintf(&servername, "%s.%s", global_myname, ads->config.realm);
+ asprintf(&servername, "%s.%s", global_myname(), ads->config.realm);
prt.serverName = servername;
- prt.shortServerName = global_myname;
+ prt.shortServerName = global_myname();
prt.versionNumber = "4";
- asprintf(&uncname, "\\\\%s\\%s", global_myname, argv[0]);
+ asprintf(&uncname, "\\\\%s\\%s", global_myname(), argv[0]);
prt.uNCName=uncname;
prt.printBinNames = (char **) bins;
prt.printMediaSupported = (char **) media;
@@ -799,8 +793,8 @@ static int net_ads_printer_remove(int argc, const char **argv)
{
ADS_STRUCT *ads;
ADS_STATUS rc;
- char *servername, *prt_dn;
- extern pstring global_myname;
+ const char *servername;
+ char *prt_dn;
void *res = NULL;
if (!(ads = ads_startup())) return -1;
@@ -811,7 +805,7 @@ static int net_ads_printer_remove(int argc, const char **argv)
if (argc > 1)
servername = argv[1];
else
- servername = global_myname;
+ servername = global_myname();
rc = ads_find_printer_on_server(ads, &res, argv[0], servername);
@@ -902,7 +896,6 @@ static int net_ads_password(int argc, const char **argv)
static int net_ads_change_localhost_pass(int argc, const char **argv)
{
ADS_STRUCT *ads;
- extern pstring global_myname;
char *host_principal;
char *hostname;
ADS_STATUS ret;
@@ -912,14 +905,14 @@ static int net_ads_change_localhost_pass(int argc, const char **argv)
return -1;
}
- asprintf(&opt_user_name, "%s$", global_myname);
+ asprintf(&opt_user_name, "%s$", global_myname());
opt_password = secrets_fetch_machine_password();
if (!(ads = ads_startup())) {
return -1;
}
- hostname = strdup(global_myname);
+ hostname = strdup(global_myname());
strlower(hostname);
asprintf(&host_principal, "%s@%s", hostname, ads->config.realm);
SAFE_FREE(hostname);
diff --git a/source3/utils/net_ads_cldap.c b/source3/utils/net_ads_cldap.c
index 6821a5902e..f81c763093 100644
--- a/source3/utils/net_ads_cldap.c
+++ b/source3/utils/net_ads_cldap.c
@@ -232,7 +232,6 @@ int ads_cldap_netlogon(ADS_STRUCT *ads)
{
int sock;
int ret;
- extern pstring global_myname;
struct cldap_netlogon_reply reply;
sock = open_udp_socket(inet_ntoa(ads->ldap_ip), ads->ldap_port);
@@ -243,7 +242,7 @@ int ads_cldap_netlogon(ADS_STRUCT *ads)
return -1;
}
- ret = send_cldap_netlogon(sock, ads->config.realm, global_myname, 6);
+ ret = send_cldap_netlogon(sock, ads->config.realm, global_myname(), 6);
if (ret != 0) {
return ret;
}
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index ae1e8dbbac..16caa8d861 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -21,8 +21,6 @@
#include "includes.h"
#include "../utils/net.h"
-extern pstring global_myname;
-
/**
* @file net_rpc.c
*
@@ -240,12 +238,11 @@ static int rpc_changetrustpw(int argc, const char **argv)
static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct cli_state *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv) {
- extern pstring global_myname;
fstring trust_passwd;
unsigned char orig_trust_passwd_hash[16];
NTSTATUS result;
- fstrcpy(trust_passwd, global_myname);
+ fstrcpy(trust_passwd, global_myname());
strlower(trust_passwd);
/*
@@ -432,7 +429,7 @@ rpc_getsid_internals(const DOM_SID *domain_sid, struct cli_state *cli,
d_printf("Storing SID %s for Domain %s in secrets.tdb\n",
sid_str, lp_workgroup());
- if (!secrets_store_domain_sid(global_myname, domain_sid)) {
+ if (!secrets_store_domain_sid(global_myname(), domain_sid)) {
DEBUG(0,("Can't store domain SID\n"));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -1917,7 +1914,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
if (opt_target_workgroup) SAFE_FREE(opt_target_workgroup);
opt_target_workgroup = opt_workgroup;
} else {
- safe_strcpy(pdc_name, global_myname, FSTRING_LEN);
+ safe_strcpy(pdc_name, global_myname(), FSTRING_LEN);
domain_name = talloc_strdup(mem_ctx, lp_workgroup());
if (opt_target_workgroup) SAFE_FREE(opt_target_workgroup);
opt_target_workgroup = domain_name;
@@ -2165,7 +2162,7 @@ BOOL net_rpc_check(unsigned flags)
if (!cli_connect(&cli, server_name, &server_ip))
goto done;
- if (!attempt_netbios_session_request(&cli, global_myname,
+ if (!attempt_netbios_session_request(&cli, global_myname(),
server_name, &server_ip))
goto done;
if (!cli_negprot(&cli))
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index c209886ef1..4b78b7d283 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -104,8 +104,6 @@ done:
int net_rpc_join_newstyle(int argc, const char **argv)
{
- extern pstring global_myname;
-
/* libsmb variables */
struct cli_state *cli;
@@ -187,7 +185,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
"could not open domain");
/* Create domain user */
- acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname);
+ acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname());
strlower(acct_name);
const_acct_name = acct_name;
@@ -347,9 +345,7 @@ done:
**/
int net_rpc_testjoin(int argc, const char **argv)
{
- char *domain = lp_workgroup();
-
- domain = smb_xstrdup(domain);
+ char *domain = smb_xstrdup(lp_workgroup());
/* Display success or failure */
if (net_rpc_join_ok(domain) != 0) {
diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c
index 13c75c80b0..4cf923b1f7 100644
--- a/source3/utils/net_time.c
+++ b/source3/utils/net_time.c
@@ -28,7 +28,6 @@ static time_t cli_servertime(const char *host, struct in_addr *ip, int *zone)
{
struct nmb_name calling, called;
time_t ret = 0;
- extern pstring global_myname;
struct cli_state *cli = NULL;
cli = cli_initialise(NULL);
@@ -39,7 +38,7 @@ static time_t cli_servertime(const char *host, struct in_addr *ip, int *zone)
goto done;
}
- make_nmb_name(&calling, global_myname, 0x0);
+ make_nmb_name(&calling, global_myname(), 0x0);
if (host) {
make_nmb_name(&called, host, 0x20);
} else {
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index cdaa434e3c..8106134699 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -246,12 +246,8 @@ int main(int argc,char *argv[])
translate_addresses = !translate_addresses;
break;
case 'i':
- {
- extern pstring global_scope;
- pstrcpy(global_scope,optarg);
- strupper(global_scope);
- }
- break;
+ set_global_scope(optarg);
+ break;
case 'M':
find_master = True;
break;
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 1199dec7fb..6a019e73d7 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -50,7 +50,6 @@
#define MASK_ALWAYS_GOOD 0x0000001F
#define MASK_USER_GOOD 0x00001F00
-extern pstring global_myname;
/*********************************************************
Add all currently available users to another db
@@ -176,7 +175,7 @@ static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdst
Get an Print User Info
**********************************************************/
-static int print_user_info (struct pdb_context *in, char *username, BOOL verbosity, BOOL smbpwdstyle)
+static int print_user_info (struct pdb_context *in, const char *username, BOOL verbosity, BOOL smbpwdstyle)
{
SAM_ACCOUNT *sam_pwent=NULL;
BOOL ret;
@@ -496,7 +495,7 @@ int main (int argc, char **argv)
poptGetArg(pc); /* Drop argv[0], the program name */
if (user_name == NULL) {
- user_name = poptGetArg(pc);
+ user_name = strdup(poptGetArg(pc));
}
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
@@ -504,16 +503,8 @@ int main (int argc, char **argv)
exit(1);
}
- if (!*global_myname) {
- char *p2;
-
- pstrcpy(global_myname, myhostname());
- p2 = strchr_m(global_myname, '.');
- if (p2)
- *p2 = 0;
- }
-
- strupper(global_myname);
+ if (!init_names())
+ exit(1);
setparms = (backend ? BIT_BACKEND : 0) +
(verbose ? BIT_VERBOSE : 0) +
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 940187407c..1d681a07f7 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -42,9 +42,6 @@ enum acl_mode {SMB_ACL_SET, SMB_ACL_DELETE, SMB_ACL_MODIFY, SMB_ACL_ADD };
enum chown_mode {REQUEST_NONE, REQUEST_CHOWN, REQUEST_CHGRP};
enum exit_values {EXIT_OK, EXIT_FAILED, EXIT_PARSE_ERROR};
-extern pstring global_myname;
-extern fstring global_myworkgroup;
-
struct perm_value {
char *perm;
uint32 mask;
@@ -232,6 +229,7 @@ static void print_ace(FILE *f, SEC_ACE *ace)
static BOOL parse_ace(SEC_ACE *ace, char *str)
{
char *p;
+ const char *cp;
fstring tok;
unsigned atype, aflags, amask;
DOM_SID sid;
@@ -243,7 +241,6 @@ static BOOL parse_ace(SEC_ACE *ace, char *str)
if (!p) return False;
*p = '\0';
p++;
-
/* Try to parse numeric form */
if (sscanf(p, "%i/%i/%i", &atype, &aflags, &amask) == 3 &&
@@ -257,7 +254,8 @@ static BOOL parse_ace(SEC_ACE *ace, char *str)
return False;
}
- if (!next_token(&p, tok, "/", sizeof(fstring))) {
+ cp = p;
+ if (!next_token(&cp, tok, "/", sizeof(fstring))) {
return False;
}
@@ -271,12 +269,12 @@ static BOOL parse_ace(SEC_ACE *ace, char *str)
/* Only numeric form accepted for flags at present */
- if (!(next_token(&p, tok, "/", sizeof(fstring)) &&
+ if (!(next_token(&cp, tok, "/", sizeof(fstring)) &&
sscanf(tok, "%i", &aflags))) {
return False;
}
- if (!next_token(&p, tok, "/", sizeof(fstring))) {
+ if (!next_token(&cp, tok, "/", sizeof(fstring))) {
return False;
}
@@ -342,7 +340,7 @@ static BOOL add_ace(SEC_ACL **the_acl, SEC_ACE *ace)
/* parse a ascii version of a security descriptor */
static SEC_DESC *sec_desc_parse(char *str)
{
- char *p = str;
+ const char *p = str;
fstring tok;
SEC_DESC *ret;
size_t sd_size;
@@ -718,10 +716,10 @@ static struct cli_state *connect_one(char *share)
}
}
- if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname, server,
+ if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname(), server,
&ip, 0,
share, "?????",
- username, global_myworkgroup,
+ username, lp_workgroup(),
password, 0, NULL))) {
return c;
} else {
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 7c292dd521..034de91ce0 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -107,7 +107,7 @@ Prints out the current Debug level returned by MSG_DEBUGLEVEL
****************************************************************************/
void debuglevel_function(int msg_type, pid_t src, void *buf, size_t len)
{
- char *levels = (char *)buf;
+ const char *levels = (char *)buf;
pstring dbgcl;
printf("Current debug levels of PID %u are:\n",(unsigned int)src);
diff --git a/source3/utils/smbgroupedit.c b/source3/utils/smbgroupedit.c
index b5033e0384..0faa0513ed 100644
--- a/source3/utils/smbgroupedit.c
+++ b/source3/utils/smbgroupedit.c
@@ -21,9 +21,6 @@
#include "includes.h"
-extern pstring global_myname;
-extern fstring global_myworkgroup;
-
/*
* Next two lines needed for SunOS and don't
* hurt anything else...
@@ -282,17 +279,8 @@ int main (int argc, char **argv)
exit(1);
}
- if (!*global_myname) {
- char *p;
- pstrcpy( global_myname, myhostname() );
- p = strchr_m(global_myname, '.' );
- if (p)
- *p = 0;
- }
-
- strupper(global_myname);
-
- fstrcpy(global_myworkgroup, lp_workgroup());
+ if (!init_names())
+ exit(1);
if(!initialize_password_db(True)) {
fprintf(stderr, "Can't setup password database vectors.\n");
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 0e822ee7ad..d9f36119f7 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -19,7 +19,6 @@
#include "includes.h"
-extern pstring global_myname;
extern BOOL AllowDebugChange;
/*
@@ -585,13 +584,8 @@ int main(int argc, char **argv)
* set from the config file.
*/
- if (!*global_myname) {
- char *p;
- fstrcpy(global_myname, myhostname());
- p = strchr_m(global_myname, '.' );
- if (p) *p = 0;
- }
- strupper(global_myname);
+ if (!init_names())
+ return 1;
/* Check the effective uid - make sure we are not setuid */
if (is_setuid_root()) {
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 280a7b8853..d30bd916b2 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -121,7 +121,7 @@ parameter.\n" );
} else {
pstring passwd_prog;
pstring truncated_prog;
- char *p;
+ const char *p;
pstrcpy( passwd_prog, lp_passwd_program());
p = passwd_prog;
@@ -250,8 +250,8 @@ int main(int argc, const char *argv[])
for (s=0;s<1000;s++) {
if (VALID_SNUM(s)) {
- char **deny_list = lp_hostsdeny(s);
- char **allow_list = lp_hostsallow(s);
+ const char **deny_list = lp_hostsdeny(s);
+ const char **allow_list = lp_hostsallow(s);
int i;
if(deny_list) {
for (i=0; deny_list[i]; i++) {