Commit 89db7e10 authored by Jeremy Allison's avatar Jeremy Allison Committed by Gerald (Jerry) Carter
Browse files

r656: Make widelinks use realpath(). Tidy up cases where we need to become a service.

Jeremy.
(This used to be commit a03b6a05e02ec8415efc0e8ceade102e06f8fffe)
parent effc7c04
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -2277,7 +2277,21 @@ if test x"$samba_cv_BROKEN_NISPLUS_INCLUDE_FILES" = x"yes"; then
	AC_DEFINE(BROKEN_NISPLUS_INCLUDE_FILES,1,[Whether the nisplus include files are broken])
fi

AC_CACHE_CHECK([if the realpath function allows a NULL argument],samba_cv_REALPATH_TAKES_NULL,[
AC_TRY_RUN([
#include <stdio.h>
#include <limits.h>
main() {
	char *newpath = realpath("/tmp", NULL);
	exit ((newpath != NULL) ? 0 : 1);
}
],
samba_cv_REALPATH_TAKES_NULL=yes,samba_cv_REALPATH_TAKES_NULL=no,samba_cv_REALPATH_TAKES_NULL=cross)])
if test x"$samba_cv_REALPATH_TAKES_NULL" = x"yes"; then
    AC_DEFINE(REALPATH_TAKES_NULL,1,[Whether the realpath function allows NULL])
fi

A
#################################################
# check for smbwrapper support
AC_MSG_CHECKING(whether to use smbwrapper)
+1 −0
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@ void conn_close_all(void)
	connection_struct *conn, *next;
	for (conn=Connections;conn;conn=next) {
		next=conn->next;
		set_current_service(conn, True);
		close_cnum(conn, conn->vuid);
	}
}
+1 −1
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ BOOL check_name(pstring name,connection_struct *conn)
	}

	if (!lp_widelinks(SNUM(conn))) {
		ret = reduce_name(conn,name,conn->connectpath);
		ret = reduce_name(conn,name);
	}

	/* Check if we are allowing users to follow symlinks */
+4 −3
Original line number Diff line number Diff line
@@ -344,6 +344,7 @@ force write permissions on print services.
#define CAN_IPC (1<<3)
#define AS_GUEST (1<<5)
#define QUEUE_IN_OPLOCK (1<<6)
#define DO_CHDIR (1<<7)

/* 
   define a list of possible SMB messages and their corresponding
@@ -373,7 +374,7 @@ static const struct smb_message_struct {
/* 0x0e */ { "SMBctemp",reply_ctemp,AS_USER | QUEUE_IN_OPLOCK },
/* 0x0f */ { "SMBmknew",reply_mknew,AS_USER}, 
/* 0x10 */ { "SMBchkpth",reply_chkpth,AS_USER},
/* 0x11 */ { "SMBexit",reply_exit,0},
/* 0x11 */ { "SMBexit",reply_exit,DO_CHDIR},
/* 0x12 */ { "SMBlseek",reply_lseek,AS_USER},
/* 0x13 */ { "SMBlockread",reply_lockread,AS_USER},
/* 0x14 */ { "SMBwriteunlock",reply_writeunlock,AS_USER},
@@ -469,7 +470,7 @@ static const struct smb_message_struct {
/* 0x6e */ { NULL, NULL, 0 },
/* 0x6f */ { NULL, NULL, 0 },
/* 0x70 */ { "SMBtcon",reply_tcon,0},
/* 0x71 */ { "SMBtdis",reply_tdis,0},
/* 0x71 */ { "SMBtdis",reply_tdis,DO_CHDIR},
/* 0x72 */ { "SMBnegprot",reply_negprot,0},
/* 0x73 */ { "SMBsesssetupX",reply_sesssetup_and_X,0},
/* 0x74 */ { "SMBulogoffX", reply_ulogoffX, 0}, /* ulogoff doesn't give a valid TID */
@@ -754,7 +755,7 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
			return(ERROR_DOS(ERRSRV,ERRaccess));	    

		/* load service specific parameters */
		if (conn && !set_current_service(conn,(flags & AS_USER)?True:False))
		if (conn && !set_current_service(conn,(flags & (AS_USER|DO_CHDIR)?True:False)))
			return(ERROR_DOS(ERRSRV,ERRaccess));

		/* does this protocol need to be run as guest? */
+3 −3
Original line number Diff line number Diff line
@@ -788,6 +788,9 @@ void close_cnum(connection_struct *conn, uint16 vuid)
{
	DirCacheFlush(SNUM(conn));

	file_close_conn(conn);
	dptr_closecnum(conn);

	change_to_root_user();

	DEBUG(IS_IPC(conn)?3:1, ("%s (%s) closed connection to service %s\n",
@@ -799,9 +802,6 @@ void close_cnum(connection_struct *conn, uint16 vuid)

	yield_connection(conn, lp_servicename(SNUM(conn)));

	file_close_conn(conn);
	dptr_closecnum(conn);

	/* make sure we leave the directory available for unmount */
	vfs_ChDir(conn, "/");

Loading