summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShirish Kalele <kalele@samba.org>2000-05-26 17:10:40 +0000
committerShirish Kalele <kalele@samba.org>2000-05-26 17:10:40 +0000
commit8a86541e282424c4e0ea5626b26e818779ba0375 (patch)
tree316f69e049082a18c2151af46e8c11df43994595
parent9c4079d8c3b158369585d33f7b19fc7bd585401e (diff)
downloadsamba-8a86541e282424c4e0ea5626b26e818779ba0375.tar.gz
samba-8a86541e282424c4e0ea5626b26e818779ba0375.tar.bz2
samba-8a86541e282424c4e0ea5626b26e818779ba0375.zip
Changed MS_DFS to WITH_MSDFS throughout.
Fixed trans2 calls on IPC$ to let dfs referral calls through. (This used to be commit e0965a80bdca5239886b11ef55dc29fed261bfc0)
-rwxr-xr-xsource3/configure8
-rw-r--r--source3/configure.in4
-rw-r--r--source3/include/config.h.in2
-rw-r--r--source3/include/msdfs.h2
-rw-r--r--source3/include/proto.h14
-rw-r--r--source3/msdfs/msdfs.c212
-rw-r--r--source3/rpc_server/srv_dfs.c4
-rw-r--r--source3/rpc_server/srv_pipe.c2
-rw-r--r--source3/rpc_server/srv_srvsvc.c2
-rw-r--r--source3/smbd/negprot.c2
-rw-r--r--source3/smbd/nttrans.c2
-rw-r--r--source3/smbd/trans2.c5
12 files changed, 139 insertions, 120 deletions
diff --git a/source3/configure b/source3/configure
index 2a79536510..5477527f5c 100755
--- a/source3/configure
+++ b/source3/configure
@@ -917,7 +917,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-for ac_prog in gawk mawk nawk awk
+for ac_prog in mawk gawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -10254,8 +10254,8 @@ fi
#################################################
# check for MS Dfs support
-echo $ac_n "checking whether to support MS Dfs""... $ac_c" 1>&6
-echo "configure:10259: checking whether to support MS Dfs" >&5
+echo $ac_n "checking whether to support Microsoft Dfs""... $ac_c" 1>&6
+echo "configure:10259: checking whether to support Microsoft Dfs" >&5
# Check whether --with-msdfs or --without-msdfs was given.
if test "${with_msdfs+set}" = set; then
withval="$with_msdfs"
@@ -10263,7 +10263,7 @@ if test "${with_msdfs+set}" = set; then
yes)
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
-#define MS_DFS 1
+#define WITH_MSDFS 1
EOF
;;
diff --git a/source3/configure.in b/source3/configure.in
index d0061ecf62..742d50da49 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1421,14 +1421,14 @@ AC_ARG_WITH(utmp,
#################################################
# check for MS Dfs support
-AC_MSG_CHECKING(whether to support MS Dfs)
+AC_MSG_CHECKING(whether to support Microsoft Dfs)
AC_ARG_WITH(msdfs,
[ --with-msdfs Include MS Dfs support
--without-msdfs Don't include MS Dfs support (default)],
[ case "$withval" in
yes)
AC_MSG_RESULT(yes)
- AC_DEFINE(MS_DFS)
+ AC_DEFINE(WITH_MSDFS)
;;
*)
AC_MSG_RESULT(no)
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
index dc5932b9be..ed74b6e556 100644
--- a/source3/include/config.h.in
+++ b/source3/include/config.h.in
@@ -135,7 +135,7 @@
#undef HAVE_SETRESUID
#undef WITH_NETATALK
#undef WITH_UTMP
-#undef MS_DFS
+#undef WITH_MSDFS
#undef HAVE_INO64_T
#undef HAVE_STRUCT_FLOCK64
#undef SIZEOF_INO_T
diff --git a/source3/include/msdfs.h b/source3/include/msdfs.h
index 5323b8749a..2c0f9a19ba 100644
--- a/source3/include/msdfs.h
+++ b/source3/include/msdfs.h
@@ -59,7 +59,7 @@ struct dfs_path
pstring restofthepath;
};
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
#define RESOLVE_DFSPATH(name, conn, inbuf, outbuf) \
{ if(((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES)) && \
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 69f8e8790b..a8608c47b5 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -357,7 +357,7 @@ char *myhostname(void);
char *lock_path(char *name);
char *parent_dirname(const char *path);
BOOL ms_has_wild(char *s);
-BOOL mask_match(char *string, char *pattern, BOOL case_sensitive);
+BOOL mask_match(char *string, char *pattern, BOOL is_case_sensitive);
int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6);
/*The following definitions come from lib/util_array.c */
@@ -873,20 +873,20 @@ BOOL posix_locking_end(void);
/*The following definitions come from msdfs/msdfs.c */
-BOOL remove_msdfs_link(struct junction_map* jn);
-BOOL create_msdfs_link(struct junction_map* jn, BOOL exists);
-BOOL is_msdfs_volume(connection_struct* conn, char* path);
+BOOL create_junction(char* pathname, struct junction_map* jn);
+BOOL is_msdfs_link(connection_struct* conn, char* path);
BOOL get_referred_path(struct junction_map* junction);
BOOL dfs_redirect(char* pathname, connection_struct* conn);
BOOL dfs_findfirst_redirect(char* pathname, connection_struct* conn);
-BOOL create_junction(char* pathname, struct junction_map* jn);
int setup_dfs_referral(char* pathname, int max_referral_level,
char** ppdata);
-int enum_msdfs_junctions(struct junction_map* jn);
int dfs_path_error(char* inbuf, char* outbuf);
+BOOL create_msdfs_link(struct junction_map* jn, BOOL exists);
+BOOL remove_msdfs_link(struct junction_map* jn);
+int enum_msdfs_links(struct junction_map* jn);
int setup_dfs_referral(char* pathname, int max_referral_level,
char** ppdata);
-BOOL is_msdfs_volume(connection_struct* conn, char* path);
+BOOL is_msdfs_link(connection_struct* conn, char* path);
/*The following definitions come from nmbd/asyncdns.c */
diff --git a/source3/msdfs/msdfs.c b/source3/msdfs/msdfs.c
index 25bc5cc17f..0101b9e066 100644
--- a/source3/msdfs/msdfs.c
+++ b/source3/msdfs/msdfs.c
@@ -25,7 +25,7 @@ extern int DEBUGLEVEL;
extern pstring global_myname;
extern uint32 global_client_caps;
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
/**********************************************************************
Create a tcon relative path from a dfs_path structure
@@ -93,7 +93,9 @@ static BOOL parse_dfs_path(char* pathname, struct dfs_path* pdp)
return True;
}
-
+/**********************************************************************
+ Forms a valid Unix pathname from the junction
+ **********************************************************************/
static BOOL form_path_from_junction(struct junction_map* jn, char* path,
int max_pathlen)
{
@@ -113,59 +115,33 @@ static BOOL form_path_from_junction(struct junction_map* jn, char* path,
return True;
}
-BOOL remove_msdfs_link(struct junction_map* jn)
-{
- pstring path;
- pstring msdfs_link;
- int i=0;
-
- if(!form_path_from_junction(jn, path, sizeof(path)))
- return False;
-
- if(unlink(path)!=0)
- return False;
-
- return True;
-}
-
-BOOL create_msdfs_link(struct junction_map* jn, BOOL exists)
+/**********************************************************************
+ Creates a junction structure from the Dfs pathname
+ **********************************************************************/
+BOOL create_junction(char* pathname, struct junction_map* jn)
{
- pstring path;
- pstring msdfs_link;
- int i=0;
-
- if(!form_path_from_junction(jn, path, sizeof(path)))
- return False;
+ struct dfs_path dp;
- /* form the msdfs_link contents */
- pstrcpy(msdfs_link, "msdfs:");
- for(i=0; i<jn->referral_count; i++)
- {
- char* refpath = jn->referral_list[i].alternate_path;
-
- trim_string(refpath, "\\", "\\");
- if(*refpath == '\0')
- continue;
-
- if(i>0)
- pstrcat(msdfs_link, ",");
-
- pstrcat(msdfs_link, refpath);
- }
+ parse_dfs_path(pathname,&dp);
- DEBUG(5,("create_msdfs_link: Creating new msdfs link: %s -> %s\n",
- path, msdfs_link));
+ /* check if path is dfs : check hostname is the first token */
+ if(global_myname && (strcasecmp(global_myname,dp.hostname)!=0))
+ {
+ DEBUG(4,("create_junction: Invalid hostname %s in dfs path %s\n",
+ dp.hostname, pathname));
+ return False;
+ }
- if(exists)
- if(unlink(path)!=0)
- return False;
+ /* Check for a non-DFS share */
+ if(!lp_msdfs_root(lp_servicenumber(dp.servicename)))
+ {
+ DEBUG(4,("create_junction: %s is not an msdfs root.\n",
+ dp.servicename));
+ return False;
+ }
- if(symlink(msdfs_link, path) < 0)
- {
- DEBUG(1,("create_msdfs_link: symlink failed %s -> %s\nError: %s\n",
- path, msdfs_link, strerror(errno)));
- return False;
- }
+ pstrcpy(jn->service_name,dp.servicename);
+ pstrcpy(jn->volume_name,dp.volumename);
return True;
}
@@ -226,10 +202,14 @@ static BOOL parse_symlink(char* buf,struct referral** preflist, int* refcount)
return True;
}
-BOOL is_msdfs_volume(connection_struct* conn, char* path)
+/**********************************************************************
+ Returns true if the unix path is a valid msdfs symlink
+ **********************************************************************/
+BOOL is_msdfs_link(connection_struct* conn, char* path)
{
SMB_STRUCT_STAT st;
pstring referral;
+ int referral_len = 0;
if(!path || !conn)
return False;
@@ -238,21 +218,30 @@ BOOL is_msdfs_volume(connection_struct* conn, char* path)
if(conn->vfs_ops.lstat(dos_to_unix(path,False),&st) != 0)
{
- DEBUG(5,("is_msdfs_volume: %s does not exist.\n",path));
+ DEBUG(5,("is_msdfs_link: %s does not exist.\n",path));
return False;
}
if(S_ISLNK(st.st_mode))
{
/* open the link and read it */
- readlink(path, referral, sizeof(pstring));
- DEBUG(5,("is_msdfs_volume: %s -> %s\n",path,referral));
+ referral_len = readlink(path, referral, sizeof(pstring));
+ if(referral_len == -1)
+ DEBUG(0,("is_msdfs_link: Error reading msdfs link %s: %s\n",
+ path, strerror(errno)));
+
+ referral[referral_len] = '\0';
+ DEBUG(5,("is_msdfs_link: %s -> %s\n",path,referral));
if(parse_symlink(referral, NULL, NULL))
return True;
}
return False;
}
+/**********************************************************************
+ Fills in the junction_map struct with the referrals from the
+ symbolic link
+ **********************************************************************/
BOOL get_referred_path(struct junction_map* junction)
{
fstring path;
@@ -306,7 +295,7 @@ BOOL dfs_redirect(char* pathname, connection_struct* conn)
fstrcpy(path, conn->connectpath);
fstrcat(path, "/");
fstrcat(path, dp.volumename);
- if(is_msdfs_volume(conn, path))
+ if(is_msdfs_link(conn, path))
{
DEBUG(4,("dfs_redirect: Redirecting %s\n",temp));
return True;
@@ -530,35 +519,7 @@ static int setup_ver3_dfs_referral(char* pathname, char** ppdata,
return reply_size;
}
-/**********************************************************************
- Creates a junction structure from the Dfs pathname
- **********************************************************************/
-BOOL create_junction(char* pathname, struct junction_map* jn)
-{
- struct dfs_path dp;
-
- parse_dfs_path(pathname,&dp);
-
- /* check if path is dfs : check hostname is the first token */
- if(global_myname && (strcasecmp(global_myname,dp.hostname)!=0))
- {
- DEBUG(4,("create_junction: Invalid hostname %s in dfs path %s\n",
- dp.hostname, pathname));
- return False;
- }
-
- /* Check for a non-DFS share */
- if(!lp_msdfs_root(lp_servicenumber(dp.servicename)))
- {
- DEBUG(4,("create_junction: %s is not an msdfs root.\n",
- dp.servicename));
- return False;
- }
- pstrcpy(jn->service_name,dp.servicename);
- pstrcpy(jn->volume_name,dp.volumename);
- return True;
-}
/******************************************************************
* Set up the Dfs referral for the dfs pathname
@@ -640,6 +601,74 @@ int setup_dfs_referral(char* pathname, int max_referral_level,
return reply_size;
}
+int dfs_path_error(char* inbuf, char* outbuf)
+{
+ enum remote_arch_types ra_type = get_remote_arch();
+ BOOL NT_arch = ((ra_type==RA_WINNT) || (ra_type == RA_WIN2K));
+ if(NT_arch && (global_client_caps & (CAP_NT_SMBS | CAP_STATUS32)) )
+ {
+ SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
+ return(ERROR(0,0xc0000000|NT_STATUS_PATH_NOT_COVERED));
+ }
+ return(ERROR(ERRSRV,ERRbadpath));
+}
+
+/**********************************************************************
+ The following functions are called by the NETDFS RPC pipe functions
+ **********************************************************************/
+BOOL create_msdfs_link(struct junction_map* jn, BOOL exists)
+{
+ pstring path;
+ pstring msdfs_link;
+ int i=0;
+
+ if(!form_path_from_junction(jn, path, sizeof(path)))
+ return False;
+
+ /* form the msdfs_link contents */
+ pstrcpy(msdfs_link, "msdfs:");
+ for(i=0; i<jn->referral_count; i++)
+ {
+ char* refpath = jn->referral_list[i].alternate_path;
+
+ trim_string(refpath, "\\", "\\");
+ if(*refpath == '\0')
+ continue;
+
+ if(i>0)
+ pstrcat(msdfs_link, ",");
+
+ pstrcat(msdfs_link, refpath);
+ }
+
+ DEBUG(5,("create_msdfs_link: Creating new msdfs link: %s -> %s\n",
+ path, msdfs_link));
+
+ if(exists)
+ if(unlink(path)!=0)
+ return False;
+
+ if(symlink(msdfs_link, path) < 0)
+ {
+ DEBUG(1,("create_msdfs_link: symlink failed %s -> %s\nError: %s\n",
+ path, msdfs_link, strerror(errno)));
+ return False;
+ }
+ return True;
+}
+
+BOOL remove_msdfs_link(struct junction_map* jn)
+{
+ pstring path;
+
+ if(!form_path_from_junction(jn, path, sizeof(path)))
+ return False;
+
+ if(unlink(path)!=0)
+ return False;
+
+ return True;
+}
static BOOL form_junctions(int snum, struct junction_map* jn, int* jn_count)
{
@@ -701,7 +730,7 @@ static BOOL form_junctions(int snum, struct junction_map* jn, int* jn_count)
return True;
}
-int enum_msdfs_junctions(struct junction_map* jn)
+int enum_msdfs_links(struct junction_map* jn)
{
int i=0;
int jn_count = 0;
@@ -717,27 +746,16 @@ int enum_msdfs_junctions(struct junction_map* jn)
return jn_count;
}
-int dfs_path_error(char* inbuf, char* outbuf)
-{
- enum remote_arch_types ra_type = get_remote_arch();
- BOOL NT_arch = ((ra_type==RA_WINNT) || (ra_type == RA_WIN2K));
- if(NT_arch && (global_client_caps & (CAP_NT_SMBS | CAP_STATUS32)) )
- {
- SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
- return(ERROR(0,0xc0000000|NT_STATUS_PATH_NOT_COVERED));
- }
- return(ERROR(ERRSRV,ERRbadpath));
-}
#else
-/* Stub functions if MS_DFS not defined */
+/* Stub functions if WITH_MSDFS not defined */
int setup_dfs_referral(char* pathname, int max_referral_level,
char** ppdata)
{
return -1;
}
-BOOL is_msdfs_volume(connection_struct* conn, char* path)
+BOOL is_msdfs_link(connection_struct* conn, char* path)
{
return False;
}
diff --git a/source3/rpc_server/srv_dfs.c b/source3/rpc_server/srv_dfs.c
index 9f78b7db37..2a8bb71604 100644
--- a/source3/rpc_server/srv_dfs.c
+++ b/source3/rpc_server/srv_dfs.c
@@ -30,7 +30,7 @@
extern int DEBUGLEVEL;
extern pstring global_myname;
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
/**********************************************************************
api_dfs_exist
@@ -329,7 +329,7 @@ static uint32 init_reply_dfs_enum(uint32 level, DFS_R_DFS_ENUM *q_r)
int num_jn = 0;
int i=0;
- num_jn = enum_msdfs_junctions(jn);
+ num_jn = enum_msdfs_links(jn);
DEBUG(5,("make_reply_dfs_enum: %d junctions found in Dfs, doing level %d\n",
num_jn, level));
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index aef0c9d23b..11dc5a2f89 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -474,7 +474,7 @@ static struct api_cmd api_fd_commands[] =
{ "NETLOGON", "lsass", api_netlog_rpc },
{ "winreg", "winreg", api_reg_rpc },
{ "spoolss", "spoolss", api_spoolss_rpc },
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
{ "netdfs", "netdfs" , api_netdfs_rpc },
#endif
{ NULL, NULL, NULL }
diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c
index 44c4f5569d..2e8d33d4d2 100644
--- a/source3/rpc_server/srv_srvsvc.c
+++ b/source3/rpc_server/srv_srvsvc.c
@@ -98,7 +98,7 @@ static void init_srv_share_info_1005(SRV_SHARE_INFO_1005* sh1005, int snum)
{
sh1005->dfs_root_flag = 0;
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
if(lp_host_msdfs() && lp_msdfs_root(snum))
sh1005->dfs_root_flag = 3;
#endif
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 60af2924b2..362d571ff1 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -201,7 +201,7 @@ static int reply_nt1(char *outbuf)
capabilities |= CAP_RAW_MODE;
}
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
if(lp_host_msdfs())
capabilities |= CAP_DFS;
#endif
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 27635cae25..f64ca386f8 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -44,7 +44,7 @@ static char *known_nt_pipes[] = {
"\\lsarpc",
"\\winreg",
"\\spoolss",
-#ifdef MS_DFS
+#ifdef WITH_MSDFS
"\\netdfs",
#endif
NULL
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index cc3261a479..900a87e32b 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -411,7 +411,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn,
{
/* Needed to show the msdfs symlinks as directories */
if(!lp_host_msdfs() || !lp_msdfs_root(SNUM(conn))
- || !is_msdfs_volume(conn, pathreal))
+ || !is_msdfs_link(conn, pathreal))
{
DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",
pathreal,strerror(errno)));
@@ -2238,7 +2238,8 @@ int reply_trans2(connection_struct *conn,
return -1;
}
- if (IS_IPC(conn) && (tran_call != TRANSACT2_OPEN))
+ if (IS_IPC(conn) && (tran_call != TRANSACT2_OPEN)
+ && (tran_call != TRANSACT2_GET_DFS_REFERRAL))
return(ERROR(ERRSRV,ERRaccess));
outsize = set_message(outbuf,0,0,True);