View | Details | Raw Unified | Return to bug 19544
Collapse All | Expand All

(-)a/samba/source/client/cifs.upcall.c (-1 / +33 lines)
Lines 26-31 create dns_resolver * * /usr/local/sbin/cifs.upcall %k Link Here
26
26
27
#include "includes.h"
27
#include "includes.h"
28
#include <keyutils.h>
28
#include <keyutils.h>
29
#include <netdb.h>
30
#include <resolv.h>
31
32
#define MAX_DNS_NAMELEN (15*(MAXHOSTNAMELEN + 1)+1)
29
33
30
#include "cifs_spnego.h"
34
#include "cifs_spnego.h"
31
35
Lines 111-119 decode_key_description(const char *desc, int *ver, secType_t * sec, Link Here
111
				len = pos - tkn;
115
				len = pos - tkn;
112
			}
116
			}
113
			len -= 4;
117
			len -= 4;
118
			// Get canonical name of host
119
			struct addrinfo * info;
120
			if(len > MAX_DNS_NAMELEN)
121
			{
122
				syslog(LOG_WARNING, "Hostname is too long");
123
				return 1;
124
			}
125
			char host[MAX_DNS_NAMELEN+1];
126
			strlcpy(host, tkn + 5, len);
127
			int ret = getaddrinfo(host, 0, 0, &info);
128
			if(ret)
129
			{
130
				syslog(LOG_WARNING, "getaddrinfo: %s",
131
					gai_strerror(ret));
132
				return 1;
133
			}
134
			ret = getnameinfo(info->ai_addr, info->ai_addrlen,
135
				    host, sizeof(host), 0, 0, 0);
136
			if(ret)
137
			{
138
				syslog(LOG_WARNING, "getnameinfo: %s",
139
					gai_strerror(ret));
140
				freeaddrinfo(info);
141
				return 1;
142
			}
143
			freeaddrinfo(info);
144
			len = strlen(host) + 1;
145
114
			SAFE_FREE(*hostname);
146
			SAFE_FREE(*hostname);
115
			*hostname = SMB_XMALLOC_ARRAY(char, len);
147
			*hostname = SMB_XMALLOC_ARRAY(char, len);
116
			strlcpy(*hostname, tkn + 5, len);
148
			strlcpy(*hostname, host, len);
117
			retval |= DKD_HAVE_HOSTNAME;
149
			retval |= DKD_HAVE_HOSTNAME;
118
		} else if (strncmp(tkn, "ipv4=", 5) == 0) {
150
		} else if (strncmp(tkn, "ipv4=", 5) == 0) {
119
			/* BB: do we need it if we have hostname already? */
151
			/* BB: do we need it if we have hostname already? */

Return to bug 19544