mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
Fix up name canonicalization (needed for krb5 keytab support later).
Remove source_env handler (no longer used in any codepath). Jeremy. (This used to be commit 3a3e33603084048e647af86a9badaaf49433c789)
This commit is contained in:
parent
bff6c13849
commit
2f2e5b0191
@ -932,26 +932,33 @@ BOOL get_myname(char *my_name)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Get my own name, including domain.
|
||||
Get my own canonical name, including domain.
|
||||
****************************************************************************/
|
||||
|
||||
BOOL get_myfullname(char *my_name)
|
||||
BOOL get_mydnsfullname(fstring my_dnsname)
|
||||
{
|
||||
pstring hostname;
|
||||
static fstring dnshostname;
|
||||
struct hostent *hp;
|
||||
|
||||
*hostname = 0;
|
||||
if (!*dnshostname) {
|
||||
/* get my host name */
|
||||
if (gethostname(dnshostname, sizeof(dnshostname)) == -1) {
|
||||
*dnshostname = '\0';
|
||||
DEBUG(0,("gethostname failed\n"));
|
||||
return False;
|
||||
}
|
||||
|
||||
/* get my host name */
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1) {
|
||||
DEBUG(0,("gethostname failed\n"));
|
||||
return False;
|
||||
/* Ensure null termination. */
|
||||
dnshostname[sizeof(dnshostname)-1] = '\0';
|
||||
|
||||
/* Ensure we get the cannonical name. */
|
||||
if (!(hp = sys_gethostbyname(dnshostname))) {
|
||||
*dnshostname = '\0';
|
||||
return False;
|
||||
}
|
||||
fstrcpy(dnshostname, hp->h_name);
|
||||
}
|
||||
|
||||
/* Ensure null termination. */
|
||||
hostname[sizeof(hostname)-1] = '\0';
|
||||
|
||||
if (my_name)
|
||||
fstrcpy(my_name, hostname);
|
||||
fstrcpy(my_dnsname, dnshostname);
|
||||
return True;
|
||||
}
|
||||
|
||||
@ -959,44 +966,19 @@ BOOL get_myfullname(char *my_name)
|
||||
Get my own domain name.
|
||||
****************************************************************************/
|
||||
|
||||
BOOL get_mydomname(fstring my_domname)
|
||||
BOOL get_mydnsdomname(fstring my_domname)
|
||||
{
|
||||
pstring hostname;
|
||||
fstring domname;
|
||||
char *p;
|
||||
struct hostent *hp;
|
||||
|
||||
*hostname = 0;
|
||||
/* get my host name */
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1) {
|
||||
DEBUG(0,("gethostname failed\n"));
|
||||
*my_domname = '\0';
|
||||
if (!get_mydnsfullname(domname)) {
|
||||
return False;
|
||||
}
|
||||
|
||||
/* Ensure null termination. */
|
||||
hostname[sizeof(hostname)-1] = '\0';
|
||||
|
||||
|
||||
p = strchr_m(hostname, '.');
|
||||
|
||||
p = strchr_m(domname, '.');
|
||||
if (p) {
|
||||
p++;
|
||||
|
||||
if (my_domname)
|
||||
fstrcpy(my_domname, p);
|
||||
}
|
||||
|
||||
if (!(hp = sys_gethostbyname(hostname))) {
|
||||
return False;
|
||||
}
|
||||
|
||||
p = strchr_m(hp->h_name, '.');
|
||||
|
||||
if (p) {
|
||||
p++;
|
||||
|
||||
if (my_domname)
|
||||
fstrcpy(my_domname, p);
|
||||
return True;
|
||||
fstrcpy(my_domname, p);
|
||||
}
|
||||
|
||||
return False;
|
||||
|
@ -433,12 +433,11 @@ static NTSTATUS ntlmssp_server_negotiate(struct ntlmssp_state *ntlmssp_state,
|
||||
|
||||
/* This should be a 'netbios domain -> DNS domain' mapping */
|
||||
dnsdomname[0] = '\0';
|
||||
get_mydomname(dnsdomname);
|
||||
get_mydnsdomname(dnsdomname);
|
||||
strlower_m(dnsdomname);
|
||||
|
||||
dnsname[0] = '\0';
|
||||
get_myfullname(dnsname);
|
||||
strlower_m(dnsname);
|
||||
get_mydnsfullname(dnsname);
|
||||
|
||||
/* This creates the 'blob' of names that appears at the end of the packet */
|
||||
if (chal_flags & NTLMSSP_CHAL_TARGET_INFO)
|
||||
|
@ -321,7 +321,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
|
||||
char *q_orig = q;
|
||||
int str_offset;
|
||||
|
||||
get_mydomname(domain);
|
||||
get_mydnsdomname(domain);
|
||||
get_myname(hostname);
|
||||
|
||||
if (SVAL(uniuser, 0) == 0) {
|
||||
|
@ -553,7 +553,6 @@ static int default_server_announce;
|
||||
/* prototypes for the special type handlers */
|
||||
static BOOL handle_include(const char *pszParmValue, char **ptr);
|
||||
static BOOL handle_copy(const char *pszParmValue, char **ptr);
|
||||
static BOOL handle_source_env(const char *pszParmValue, char **ptr);
|
||||
static BOOL handle_netbios_name(const char *pszParmValue, char **ptr);
|
||||
static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr);
|
||||
static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr);
|
||||
@ -2790,6 +2789,8 @@ static BOOL source_env(char **lines)
|
||||
return (True);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Doesn't seem to be used anymore. JRA */
|
||||
/***************************************************************************
|
||||
Handle the source environment operation.
|
||||
***************************************************************************/
|
||||
@ -2829,6 +2830,7 @@ static BOOL handle_source_env(const char *pszParmValue, char **ptr)
|
||||
|
||||
return (result);
|
||||
}
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
Handle the include operation.
|
||||
|
@ -2537,7 +2537,7 @@ static BOOL map_nt_printer_info2_to_dsspooler(NT_PRINTER_INFO_LEVEL_2 *info2)
|
||||
map_sz_into_ctr(ctr, SPOOL_REG_PRINTERNAME, info2->sharename);
|
||||
map_sz_into_ctr(ctr, SPOOL_REG_SHORTSERVERNAME, global_myname());
|
||||
|
||||
get_myfullname(longname);
|
||||
get_mydnsfullname(longname);
|
||||
map_sz_into_ctr(ctr, SPOOL_REG_SERVERNAME, longname);
|
||||
|
||||
asprintf(&allocated_string, "\\\\%s\\%s", longname, info2->sharename);
|
||||
|
@ -58,7 +58,7 @@ static NTSTATUS fill_dsrole_dominfo_basic(TALLOC_CTX *ctx, DSROLE_PRIMARY_DOMAIN
|
||||
basic->flags = DSROLE_PRIMARY_DS_RUNNING|DSROLE_PRIMARY_DS_MIXED_MODE;
|
||||
if ( secrets_fetch_domain_guid( lp_workgroup(), &basic->domain_guid ) )
|
||||
basic->flags |= DSROLE_PRIMARY_DOMAIN_GUID_PRESENT;
|
||||
get_mydomname(dnsdomain);
|
||||
get_mydnsdomname(dnsdomain);
|
||||
strlower_m(dnsdomain);
|
||||
break;
|
||||
case ROLE_DOMAIN_PDC:
|
||||
@ -66,7 +66,7 @@ static NTSTATUS fill_dsrole_dominfo_basic(TALLOC_CTX *ctx, DSROLE_PRIMARY_DOMAIN
|
||||
basic->flags = DSROLE_PRIMARY_DS_RUNNING|DSROLE_PRIMARY_DS_MIXED_MODE;
|
||||
if ( secrets_fetch_domain_guid( lp_workgroup(), &basic->domain_guid ) )
|
||||
basic->flags |= DSROLE_PRIMARY_DOMAIN_GUID_PRESENT;
|
||||
get_mydomname(dnsdomain);
|
||||
get_mydnsdomname(dnsdomain);
|
||||
strlower_m(dnsdomain);
|
||||
break;
|
||||
}
|
||||
|
@ -1250,7 +1250,7 @@ NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_I
|
||||
|
||||
/* This should be a 'netbios domain -> DNS domain' mapping */
|
||||
dnsdomname[0] = '\0';
|
||||
get_mydomname(dnsdomname);
|
||||
get_mydnsdomname(dnsdomname);
|
||||
strlower_m(dnsdomname);
|
||||
|
||||
dns_name = dnsdomname;
|
||||
|
@ -2431,7 +2431,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *ctx, fstring value, uint
|
||||
if (!StrCaseCmp(value, "DNSMachineName")) {
|
||||
pstring hostname;
|
||||
|
||||
if (!get_myfullname(hostname))
|
||||
if (!get_mydnsfullname(hostname))
|
||||
return WERR_BADFILE;
|
||||
*type = 0x1;
|
||||
*needed = 2*(strlen(hostname)+1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user