summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2021-03-13 22:07:53 +0100
committerJeremy Allison <jra@samba.org>2021-03-16 17:09:32 +0000
commitbb5bf508197205f6a9d17b3418a9291b934bd9fa (patch)
tree69fed1336ff204ea88200d134570c167bbf11679 /source3
parent57d548b5020b5071e80d6b07c168c8207b52df25 (diff)
downloadsamba-bb5bf508197205f6a9d17b3418a9291b934bd9fa.tar.gz
lib: Remove init_names()
is_myname() looks at lp_* directly, nmbd maintains its own list: We don't need the baroque loadparm handler anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c5
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/lib/netapi/netapi.c2
-rw-r--r--source3/lib/util.c1
-rw-r--r--source3/lib/util_names.c127
-rw-r--r--source3/param/loadparm_ctx.c1
-rw-r--r--source3/rpcclient/rpcclient.c5
-rw-r--r--source3/smbd/server.c3
-rw-r--r--source3/torture/pdbtest.c1
-rw-r--r--source3/utils/net.c3
-rw-r--r--source3/utils/pdbedit.c3
-rw-r--r--source3/utils/smbpasswd.c8
-rw-r--r--source3/winbindd/winbindd.c5
13 files changed, 0 insertions, 167 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index e2fdacd1251..7c0a3832a41 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -6622,11 +6622,6 @@ int main(int argc,char *argv[])
}
}
- if (!init_names()) {
- fprintf(stderr, "init_names() failed\n");
- exit(1);
- }
-
if(new_name_resolve_order)
lp_set_cmdline("name resolve order", new_name_resolve_order);
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 5bb5f2c36da..1d5ebecb03c 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -310,10 +310,7 @@ bool is_allowed_domain(const char *domain_name);
enum protocol_types get_Protocol(void);
void set_Protocol(enum protocol_types p);
-void gfree_names(void);
void gfree_all( void );
-bool set_netbios_aliases(const char **str_array);
-bool init_names(void);
bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
bool fake_dir_create_times);
bool socket_exist(const char *fname);
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index f8f79c69baf..fb8b4bc6113 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -81,7 +81,6 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
return W_ERROR_V(WERR_GEN_FAILURE);
}
- init_names();
load_interfaces();
reopen_logs();
@@ -178,7 +177,6 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
}
}
- gfree_names();
gfree_loadparm();
gfree_charcnv();
gfree_interfaces();
diff --git a/source3/lib/util.c b/source3/lib/util.c
index f4091e1759a..ee6cab17f0f 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -99,7 +99,6 @@ static enum remote_arch_types ra_type = RA_UNKNOWN;
void gfree_all( void )
{
- gfree_names();
gfree_loadparm();
gfree_charcnv();
gfree_interfaces();
diff --git a/source3/lib/util_names.c b/source3/lib/util_names.c
index ade9a0570c2..f0e9f699f29 100644
--- a/source3/lib/util_names.c
+++ b/source3/lib/util_names.c
@@ -24,133 +24,6 @@
#include "includes.h"
-/***********************************************************************
- Definitions for all names.
-***********************************************************************/
-
-static int smb_num_netbios_names;
-static char **smb_my_netbios_names;
-
-static void free_netbios_names_array(void)
-{
- int i;
-
- for (i = 0; i < smb_num_netbios_names; i++)
- SAFE_FREE(smb_my_netbios_names[i]);
-
- SAFE_FREE(smb_my_netbios_names);
- smb_num_netbios_names = 0;
-}
-
-static bool allocate_my_netbios_names_array(size_t number)
-{
- free_netbios_names_array();
-
- smb_num_netbios_names = number + 1;
- smb_my_netbios_names = SMB_MALLOC_ARRAY( char *, smb_num_netbios_names );
-
- if (!smb_my_netbios_names)
- return False;
-
- memset(smb_my_netbios_names, '\0', sizeof(char *) * smb_num_netbios_names);
- return True;
-}
-
-static bool set_my_netbios_names(const char *name, int i)
-{
- SAFE_FREE(smb_my_netbios_names[i]);
-
- /*
- * Don't include space for terminating '\0' in strndup,
- * it is automatically added. This screws up if the name
- * is greater than MAX_NETBIOSNAME_LEN-1 in the unix
- * charset, but less than or equal to MAX_NETBIOSNAME_LEN-1
- * in the DOS charset, but this is so old we have to live
- * with that.
- */
- smb_my_netbios_names[i] = SMB_STRNDUP(name, MAX_NETBIOSNAME_LEN-1);
- if (!smb_my_netbios_names[i])
- return False;
- return strupper_m(smb_my_netbios_names[i]);
-}
-
-/***********************************************************************
- Free memory allocated to global objects
-***********************************************************************/
-
-void gfree_names(void)
-{
- free_netbios_names_array();
-}
-
-bool set_netbios_aliases(const char **str_array)
-{
- size_t namecount;
-
- /* Work out the max number of netbios aliases that we have */
- for( namecount=0; str_array && (str_array[namecount] != NULL); namecount++ )
- ;
-
- if ( lp_netbios_name() && *lp_netbios_name())
- namecount++;
-
- /* Allocate space for the netbios aliases */
- if (!allocate_my_netbios_names_array(namecount))
- return False;
-
- /* Use the global_myname string first */
- namecount=0;
- if ( lp_netbios_name() && *lp_netbios_name()) {
- set_my_netbios_names( lp_netbios_name(), namecount );
- namecount++;
- }
-
- if (str_array) {
- size_t i;
- for ( i = 0; str_array[i] != NULL; i++) {
- size_t n;
- bool duplicate = False;
-
- /* Look for duplicates */
- for( n=0; n<namecount; n++ ) {
- if( strequal( str_array[i],
- smb_my_netbios_names[n] ) ) {
- duplicate = True;
- break;
- }
- }
- if (!duplicate) {
- if (!set_my_netbios_names(str_array[i], namecount))
- return False;
- namecount++;
- }
- }
- }
- return True;
-}
-
-/****************************************************************************
- Common name initialization code.
-****************************************************************************/
-
-bool init_names(void)
-{
- int n;
-
- if (!set_netbios_aliases(lp_netbios_aliases())) {
- DEBUG( 0, ( "init_names: malloc fail.\n" ) );
- return False;
- }
-
- DEBUG( 5, ("Netbios name list:-\n") );
- for( n=0; smb_my_netbios_names[n]; n++ ) {
- DEBUGADD( 5, ("my_netbios_names[%d]=\"%s\"\n",
- n, smb_my_netbios_names[n] ) );
- }
-
- return( True );
-}
-
/******************************************************************
get the default domain/netbios name to be used when dealing
with our passdb list of accounts
diff --git a/source3/param/loadparm_ctx.c b/source3/param/loadparm_ctx.c
index 0a8f957b787..43e431cec1c 100644
--- a/source3/param/loadparm_ctx.c
+++ b/source3/param/loadparm_ctx.c
@@ -68,7 +68,6 @@ static struct loadparm_s3_helpers s3_fns =
.dump = lp_dump,
.lp_include = lp_include,
.init_ldap_debugging = init_ldap_debugging,
- .set_netbios_aliases = set_netbios_aliases,
.do_section = lp_do_section,
};
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index e2a9aa97c32..6747aaec147 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -1088,11 +1088,6 @@ out_free:
rpcclient_msg_ctx = cmdline_messaging_context(get_dyn_CONFIGFILE());
- if (!init_names()) {
- result = 1;
- goto done;
- }
-
/*
* Get password
* from stdin if necessary
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index f41ceb899d7..8dd3068bf08 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1387,9 +1387,6 @@ static bool init_structs(void )
* set from the config file.
*/
- if (!init_names())
- return False;
-
if (!secrets_init())
return False;
diff --git a/source3/torture/pdbtest.c b/source3/torture/pdbtest.c
index 5d74aa9ab78..06aee9c5db1 100644
--- a/source3/torture/pdbtest.c
+++ b/source3/torture/pdbtest.c
@@ -586,7 +586,6 @@ int main(int argc, const char **argv)
/* Load configuration */
lp_load_global(get_dyn_CONFIGFILE());
setup_logging("pdbtest", DEBUG_STDOUT);
- init_names();
if (backend == NULL) {
backend = lp_passdb_backend();
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 4fc19c4a121..17d9a61ed87 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -1397,9 +1397,6 @@ static void get_credentials_file(struct net_context *c,
c->opt_target_workgroup = talloc_strdup(c, lp_workgroup());
}
- if (!init_names())
- exit(1);
-
load_interfaces();
/* this makes sure that when we do things like call scripts,
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index ac71167ad07..4c21b530623 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -1135,9 +1135,6 @@ int main(int argc, const char **argv)
exit(1);
}
- if (!init_names())
- exit(1);
-
setparms = (backend ? BIT_BACKEND : 0) +
(verbose ? BIT_VERBOSE : 0) +
(spstyle ? BIT_SPSTYLE : 0) +
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 4f727202863..4196e3f98f9 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -634,14 +634,6 @@ int main(int argc, char **argv)
setup_logging("smbpasswd", DEBUG_STDERR);
- /*
- * Set the machine NETBIOS name if not already
- * set from the config file.
- */
-
- if (!init_names())
- return 1;
-
/* Check the effective uid - make sure we are not setuid */
if (is_setuid_root()) {
fprintf(stderr, "smbpasswd must *NOT* be setuid root.\n");
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index bccd1726ce1..cfc65b0b2d4 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1842,11 +1842,6 @@ int main(int argc, const char **argv)
exit(1);
}
- /* Setup names. */
-
- if (!init_names())
- exit(1);
-
load_interfaces();
if (!secrets_init()) {