summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-08-14 12:11:07 +0200
committerVolker Lendecke <vl@samba.org>2010-08-16 21:33:22 +0200
commit17150dfa9ae97ef5ac2c2c55a0b31b1fd4a3501d (patch)
treeb15d5010426a30693b7d0544a79316fadc757075
parent1b022d1d3d613d2299350f9c8cea8cec4510d0b2 (diff)
downloadsamba-17150dfa9ae97ef5ac2c2c55a0b31b1fd4a3501d.tar.gz
samba-17150dfa9ae97ef5ac2c2c55a0b31b1fd4a3501d.tar.bz2
samba-17150dfa9ae97ef5ac2c2c55a0b31b1fd4a3501d.zip
s3: Lift smbd_server_fd() from read_target_host
-rw-r--r--source3/modules/vfs_expand_msdfs.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/modules/vfs_expand_msdfs.c b/source3/modules/vfs_expand_msdfs.c
index 2d9bd4fd90..9fe9ef4a31 100644
--- a/source3/modules/vfs_expand_msdfs.c
+++ b/source3/modules/vfs_expand_msdfs.c
@@ -36,7 +36,8 @@
This is to redirect a DFS client to a host close to it.
***********************************************************/
-static char *read_target_host(TALLOC_CTX *ctx, const char *mapfile)
+static char *read_target_host(TALLOC_CTX *ctx, const char *mapfile,
+ const char *clientaddr)
{
XFILE *f;
char buf[1024];
@@ -54,7 +55,6 @@ static char *read_target_host(TALLOC_CTX *ctx, const char *mapfile)
DEBUG(10, ("Scanning mapfile [%s]\n", mapfile));
while (x_fgets(buf, sizeof(buf), f) != NULL) {
- char addr[INET6_ADDRSTRLEN];
if ((strlen(buf) > 0) && (buf[strlen(buf)-1] == '\n'))
buf[strlen(buf)-1] = '\0';
@@ -70,8 +70,7 @@ static char *read_target_host(TALLOC_CTX *ctx, const char *mapfile)
*space = '\0';
- if (strncmp(client_addr(smbd_server_fd(),addr,sizeof(addr)),
- buf, strlen(buf)) == 0) {
+ if (strncmp(clientaddr, buf, strlen(buf)) == 0) {
found = true;
break;
}
@@ -114,6 +113,7 @@ static char *expand_msdfs_target(TALLOC_CTX *ctx,
int filename_len = 0;
char *targethost = NULL;
char *new_target = NULL;
+ char addr[INET6_ADDRSTRLEN];
if (filename_start == NULL) {
DEBUG(10, ("No filename start in %s\n", target));
@@ -136,7 +136,10 @@ static char *expand_msdfs_target(TALLOC_CTX *ctx,
DEBUG(10, ("Expanding from table [%s]\n", mapfilename));
- if ((targethost = read_target_host(ctx, mapfilename)) == NULL) {
+ targethost = read_target_host(
+ ctx, client_addr(smbd_server_fd(), addr, sizeof(addr)),
+ mapfilename);
+ if (targethost == NULL) {
DEBUG(1, ("Could not expand target host from file %s\n",
mapfilename));
return NULL;