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/smbd/trans2.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) (limited to 'source3/smbd/trans2.c') diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index dff57a41c2..21fa9b5cc5 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -101,8 +101,8 @@ static int send_trans2_replies(char *outbuf, int bufsize, char *params, * the length of the data we send over the wire, as the alignment offsets * are sent here. Fix from Marc_Jacobsen@hp.com. */ - total_sent_thistime = MIN(total_sent_thistime, useable_space + - alignment_offset + data_alignment_offset); + total_sent_thistime = MIN(total_sent_thistime, useable_space+ + alignment_offset + data_alignment_offset); set_message(outbuf, 10, total_sent_thistime, True); @@ -120,7 +120,7 @@ static int send_trans2_replies(char *outbuf, int bufsize, char *params, SSVAL(outbuf,smb_prcnt, params_sent_thistime); if(params_sent_thistime == 0) { - SSVAL(outbuf,smb_proff,0); + SSVAL(outbuf,smb_proff,((smb_buf(outbuf)+alignment_offset) - smb_base(outbuf))); SSVAL(outbuf,smb_prdisp,0); } else @@ -693,6 +693,8 @@ static int call_trans2findfirst(connection_struct *conn, pstrcpy(directory, params + 12); /* Complete directory path with wildcard mask appended */ + RESOLVE_FINDFIRST_DFSPATH(directory, conn, inbuf, outbuf); + DEBUG(5,("path=%s\n",directory)); unix_convert(directory,conn,0,&bad_path,NULL); @@ -1354,6 +1356,9 @@ static int call_trans2qfilepathinfo(connection_struct *conn, fname = &fname1[0]; pstrcpy(fname,¶ms[6]); + + RESOLVE_DFSPATH(fname, conn, inbuf, outbuf); + unix_convert(fname,conn,0,&bad_path,&sbuf); if (!check_name(fname,conn) || (!VALID_STAT(sbuf) && conn->vfs_ops.stat(dos_to_unix(fname,False),&sbuf))) { @@ -2120,6 +2125,49 @@ static int call_trans2findnotifynext(connection_struct *conn, return(-1); } +/**************************************************************************** + reply to a TRANS2_GET_DFS_REFERRAL - Shirish Kalele +****************************************************************************/ +static int call_trans2getdfsreferral(connection_struct *conn, char* inbuf, + char* outbuf, int length, int bufsize, + char** pparams, char** ppdata) +{ + char *params = *pparams; + enum remote_arch_types ra_type = get_remote_arch(); + BOOL NT_arch = ((ra_type == RA_WINNT) || (ra_type == RA_WIN2K)); + pstring pathname; + int reply_size = 0; + char* dfs_referral = NULL; + int max_referral_level = SVAL(params,0); + + DEBUG(10,("call_trans2getdfsreferral\n")); +#ifdef MS_DFS + if(!lp_host_msdfs()) + return(ERROR(ERRDOS,ERRbadfunc)); + + /* if pathname is in UNICODE, convert to DOS */ + /* NT always sends in UNICODE, may not set UNICODE flag */ + if(NT_arch || (SVAL(inbuf,smb_flg2) & FLAGS2_UNICODE_STRINGS)) + { + unistr_to_dos(pathname, ¶ms[2]); + DEBUG(10,("UNICODE referral for %s\n",pathname)); + } + else + pstrcpy(pathname,¶ms[2]); + + if((reply_size = setup_dfs_referral(pathname,max_referral_level,ppdata)) < 0) + return(ERROR(ERRDOS,ERRbadfile)); + + SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2) | FLAGS2_UNICODE_STRINGS | + FLAGS2_DFS_PATHNAMES); + send_trans2_replies(outbuf,bufsize,0,0,*ppdata,reply_size); +#else + DEBUG(0,("Unexpected DFS referral request!\n")); + return(ERROR(ERRDOS,ERRbadfunc)); +#endif +} + + /**************************************************************************** reply to a SMBfindclose (stop trans2 directory search) ****************************************************************************/ @@ -2353,6 +2401,11 @@ int reply_trans2(connection_struct *conn, outsize = call_trans2mkdir(conn, inbuf, outbuf, length, bufsize, ¶ms, &data); break; + + case TRANSACT2_GET_DFS_REFERRAL: + outsize = call_trans2getdfsreferral(conn,inbuf,outbuf,length, + bufsize, ¶ms, &data); + break; default: /* Error in request */ DEBUG(2,("Unknown request %d in trans2 call\n", tran_call)); -- cgit