From 952799d9afe028d822181831715b85521c89a7ef Mon Sep 17 00:00:00 2001 From: Shirish Kalele Date: Wed, 8 Mar 2000 22:14:30 +0000 Subject: dded Microsoft Dfs services. * added a new msdfs/ directory under source/ * added msdfs sources under this directory. * modified configure setup to add a --with-msdfs configure time option Modified Files: Makefile.in acconfig.h configure configure.in include/config.h.in include/includes.h include/proto.h include/smb.h include/smb_macros.h param/loadparm.c smbd/negprot.c smbd/nttrans.c smbd/process.c smbd/reply.c smbd/server.c smbd/trans2.c Added Files: include/msdfs.h msdfs/README msdfs/msdfs.c msdfs/msdfs_tdb.c msdfs/parse_dfs_map.c ---------------------------------------------------------------------- (This used to be commit 4684b4a188b54493dbe7f0de2909a8d3c5c3ebf9) --- source3/include/config.h.in | 1 + source3/include/includes.h | 2 ++ source3/include/msdfs.h | 78 ++++++++++++++++++++++++++++++++++++++++++++ source3/include/proto.h | 2 +- source3/include/smb.h | 1 + source3/include/smb_macros.h | 1 + 6 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 source3/include/msdfs.h (limited to 'source3/include') diff --git a/source3/include/config.h.in b/source3/include/config.h.in index 0b3872e7ce..d4d5a8c213 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -141,6 +141,7 @@ #undef HAVE_SETRESUID #undef WITH_NETATALK #undef WITH_UTMP +#undef MS_DFS #undef HAVE_INO64_T #undef HAVE_STRUCT_FLOCK64 #undef SIZEOF_INO_T diff --git a/source3/include/includes.h b/source3/include/includes.h index 1929df3b7d..d040dada7a 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -914,4 +914,6 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid); #include #endif +#include "msdfs.h" + #endif /* _INCLUDES_H */ diff --git a/source3/include/msdfs.h b/source3/include/msdfs.h new file mode 100644 index 0000000000..ea72c4c15f --- /dev/null +++ b/source3/include/msdfs.h @@ -0,0 +1,78 @@ +/* + Unix SMB/Netbios implementation. + Version 3.0 + MSDfs services for Samba + Copyright (C) Shirish Kalele 2000 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _MSDFS_H +#define _MSDFS_H + +#ifdef MS_DFS + +#define REFERRAL_TTL 600 + +/* Flags used in trans2 Get Referral reply */ +#define DFSREF_REFERRAL_SERVER 0x1 +#define DFSREF_STORAGE_SERVER 0x2 + + +struct referral +{ + pstring alternate_path; /* contains the path referred (UNICODE?) */ + uint32 proximity; + uint32 ttl; /* how long should client cache referral */ +}; + +struct junction_map +{ + pstring service_name; + pstring volume_name; + int referral_count; + struct referral* referral_list; +}; + +#define RESOLVE_DFSPATH(name, conn, inbuf, outbuf) \ +{ if(((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES)) && \ + dfs_redirect(name,conn)) \ + return(dfs_path_error(inbuf,outbuf)); } + +#define RESOLVE_FINDFIRST_DFSPATH(name, conn, inbuf, outbuf) \ +{ if((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) || \ + get_remote_arch()==RA_WIN95) \ + if(dfs_findfirst_redirect(directory,conn)) \ + return(dfs_path_error(inbuf,outbuf)); } + +#define init_dfsroot(conn, inbuf, outbuf) \ +{ if(*lp_dfsmap(SNUM(conn)) && lp_host_msdfs()) { \ + SSVAL(outbuf, smb_vwv2, SMB_SHARE_IN_DFS | SMB_SUPPORT_SEARCH_BITS); \ + if(lp_dfsmap_loaded(SNUM(conn))) \ + msdfs_open(False); \ + else { \ + DEBUG(3,("msdfs map database not initialized!\n")); \ + pstrcpy(lp_dfsmap(SNUM(conn)),""); \ + } } } + +#else +/* Stub macros */ +#define RESOLVE_DFSPATH(name, conn, inbuf, outbuf) ; +#define RESOLVE_FINDFIRST_DFSPATH(name, conn, inbuf, outbuf) ; +#define init_dfsroot(conn, inbuf, outbuf) ; + +#endif + +#endif /* _MSDFS_H */ diff --git a/source3/include/proto.h b/source3/include/proto.h index 7ea33ee275..f10f006aeb 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -24,7 +24,6 @@ BOOL allow_access(char *deny_list,char *allow_list, BOOL check_access(int sock, char *allow_list, char *deny_list); /*The following definitions come from lib/bitmap.c */ - struct bitmap *bitmap_allocate(int n); BOOL bitmap_set(struct bitmap *bm, unsigned i); BOOL bitmap_clear(struct bitmap *bm, unsigned i); @@ -1305,6 +1304,7 @@ char *lp_readlist(int ); char *lp_writelist(int ); char *lp_fstype(int ); char *lp_vfsobj(int ); +char *lp_dfsmap(int ); char *lp_mangled_map(int ); char *lp_veto_files(int ); char *lp_hide_files(int ); diff --git a/source3/include/smb.h b/source3/include/smb.h index 54fb4d5cc7..c330593b1a 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1143,6 +1143,7 @@ struct bitmap { /* this is used on a TConX. I'm not sure the name is very helpful though */ #define SMB_SUPPORT_SEARCH_BITS 0x0001 +#define SMB_SHARE_IN_DFS 0x0002 /* these are the constants used in the above call. */ /* DesiredAccess */ diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 8fb1fdbb71..496787ee13 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -233,4 +233,5 @@ copy an IP address from one buffer to another #define dos_format(fname) string_replace(fname,'/','\\') + #endif /* _SMB_MACROS_H */ -- cgit