summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-02-23 05:18:09 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-02-23 05:18:09 +0000
commitdf42b0a7bcdaae96035ecb1d434a66735358fd95 (patch)
treea7d6b0e651b294a385b7524484beb54828bdf018 /source3/lib
parentf71717efd03611459b90b6939f53410ebbacc303 (diff)
downloadsamba-df42b0a7bcdaae96035ecb1d434a66735358fd95.tar.gz
samba-df42b0a7bcdaae96035ecb1d434a66735358fd95.tar.bz2
samba-df42b0a7bcdaae96035ecb1d434a66735358fd95.zip
Makefile: Added cleandir target.
chgpasswd.c: Added patch from Roland Haag <haag@think.de> to allow password changes to be done more than once. loadparm.c: Added entries for the "directory mode/directory mask parameters". Changed default file mode to 644. proto.h: Added sys_gethostbyname. server.c: Added directory mode changes. system.c: Added sys_gethostbyname. trans2.c: Added NT_FILE_ATTRIBUTE_NORMAL patch from Roger Orr <rorr@csfp.csfb.com> trans2.h: Defined NT_FILE_ATTRIBUTE_NORMAL for above patch. util.c: Changes calls to gethostbyname to sys_gethostbyname. jra@cygnus.com (This used to be commit d8d8a7ee00971fca7a8d079bfb547af107df35a4)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/system.c42
-rw-r--r--source3/lib/util.c6
2 files changed, 45 insertions, 3 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c
index ac97449da2..86c4c28a59 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -146,7 +146,11 @@ The wait() calls vary between systems
********************************************************************/
int sys_waitpid(pid_t pid,int *status,int options)
{
+#ifdef USE_WAITPID
return waitpid(pid,status,options);
+#else /* USE_WAITPID */
+ return wait4(pid, status, options, NULL);
+#endif /* USE_WAITPID */
}
/*******************************************************************
@@ -235,3 +239,41 @@ int sys_chroot(char *dname)
return(chroot(dname));
#endif
}
+
+/**************************************************************************
+A wrapper for gethostbyname() that tries avoids looking up hostnames
+in the root domain, which can cause dial-on-demand links to come up for no
+apparent reason.
+****************************************************************************/
+struct hostent *sys_gethostbyname(char *name)
+{
+ char query[256], hostname[256];
+ char *domain;
+
+ /* Does this name have any dots in it? If so, make no change */
+
+ if (strchr(name, '.'))
+ return(gethostbyname(name));
+
+ /* Get my hostname, which should have domain name
+ attached. If not, just do the gethostname on the
+ original string.
+ */
+
+ gethostname(hostname, sizeof(hostname) - 1);
+ hostname[sizeof(hostname) - 1] = 0;
+ if ((domain = strchr(hostname, '.')) == NULL)
+ return(gethostbyname(name));
+
+ /* Attach domain name to query and do modified query.
+ If names too large, just do gethostname on the
+ original string.
+ */
+
+ if((strlen(name) + strlen(domain)) >= sizeof(query))
+ return(gethostbyname(name));
+
+ sprintf(query, "%s%s", name, domain);
+ return(gethostbyname(query));
+}
+
diff --git a/source3/lib/util.c b/source3/lib/util.c
index a43de46c51..643c2fb7a5 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -3238,7 +3238,7 @@ struct hostent *Get_Hostbyname(char *name)
return(NULL);
}
- ret = gethostbyname(name2);
+ ret = sys_gethostbyname(name2);
if (ret != NULL)
{
free(name2);
@@ -3247,7 +3247,7 @@ struct hostent *Get_Hostbyname(char *name)
/* try with all lowercase */
strlower(name2);
- ret = gethostbyname(name2);
+ ret = sys_gethostbyname(name2);
if (ret != NULL)
{
free(name2);
@@ -3256,7 +3256,7 @@ struct hostent *Get_Hostbyname(char *name)
/* try with all uppercase */
strupper(name2);
- ret = gethostbyname(name2);
+ ret = sys_gethostbyname(name2);
if (ret != NULL)
{
free(name2);