1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

configure configure.in include/config.h.in include/includes.h

Fixed bugs in readline autoconf.

param/loadparm.c smbd/open.c smbd/oplock.c: Started on kernel oplock
        code - checking forced by above issue. Should not be used
        currently.

Jeremy.
This commit is contained in:
Jeremy Allison 0001-01-01 00:00:00 +00:00
parent dbd8ce8a70
commit f939efac9e
8 changed files with 428 additions and 217 deletions

501
source/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,8 @@ AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h)
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
AC_CHECK_HEADERS(stropts.h poll.h )
AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
AC_CHECK_HEADERS(readline/history.h)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
@ -124,6 +125,14 @@ if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
fi])
fi
###############################################
# test for where we get readline() from
if test "$ac_cv_header_readline_h" = "yes" ||
test "$ac_cv_header_readline_readline_h" = "yes"; then
AC_CHECK_LIB(readline,readline)
AC_DEFINE(HAVE_LIBREADLINE)
fi
# The following test taken from the cvs sources
# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has

View File

@ -314,6 +314,9 @@
/* Define if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define if you have the <history.h> header file. */
#undef HAVE_HISTORY_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
@ -332,6 +335,15 @@
/* Define if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define if you have the <readline.h> header file. */
#undef HAVE_READLINE_H
/* Define if you have the <readline/history.h> header file. */
#undef HAVE_READLINE_HISTORY_H
/* Define if you have the <readline/readline.h> header file. */
#undef HAVE_READLINE_READLINE_H
/* Define if you have the <rpc/auth.h> header file. */
#undef HAVE_RPC_AUTH_H
@ -469,3 +481,6 @@
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if you have the readline library (-lreadline). */
#undef HAVE_LIBREADLINE

View File

@ -357,7 +357,7 @@
#ifdef LARGE_SMB_OFF_T
#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
#else
#define SOFF_T(p, ofs, v) SIVAL(p,ofs,v)
#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
#endif
@ -611,13 +611,6 @@ union semun {
#define ULTRIX_AUTH 1
#endif
/* This is the naughty bit. Autoconf should declare these symbols if
it finds that GNU Readline is installed. */
#define HAVE_LIBREADLINE
#define HAVE_READLINE_READLINE_H
#define HAVE_READLINE_HISTORY_H
#ifdef HAVE_LIBREADLINE
# ifdef HAVE_READLINE_READLINE_H
# include <readline/readline.h>

View File

@ -6,6 +6,11 @@
/*The following definitions come from client/client.c */
void do_dir(char *inbuf,char *outbuf,char *Mask,int attribute,void (*fn)(file_info *),BOOL recurse_dir, BOOL dirstoo);
char *complete_cmd_null(char *text, int state);
void complete_process_file(file_info *f);
char *complete_remote_file(char *text, int state);
char *complete_cmd(char *text, int state);
char **completion_fn(char *text, int start, int end);
/*The following definitions come from client/clientutil.c */
@ -930,6 +935,7 @@ BOOL lp_passwd_chat_debug(void);
BOOL lp_ole_locking_compat(void);
BOOL lp_nt_smb_support(void);
BOOL lp_stat_cache(void);
BOOL lp_kernel_oplocks(void);
int lp_os_level(void);
int lp_max_ttl(void);
int lp_max_wins_ttl(void);
@ -1055,6 +1061,7 @@ int lp_default_server_announce(void);
int lp_major_announce_version(void);
int lp_minor_announce_version(void);
void lp_set_name_resolve_order(char *new_order);
void lp_set_kernel_oplocks(BOOL val);
/*The following definitions come from param/params.c */
@ -1794,7 +1801,7 @@ int reply_nttrans(connection_struct *conn,
void fd_add_to_uid_cache(file_fd_struct *fd_ptr, uid_t u);
uint16 fd_attempt_close(file_fd_struct *fd_ptr);
void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int share_mode,int ofun,
mode_t mode,int oplock_request, int *Access,int *action);
mode_t mode,int *oplock_request, int *Access,int *action);
int open_directory(files_struct *fsp,connection_struct *conn,
char *fname, int smb_ofun, mode_t unixmode, int *action);
BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op);
@ -1806,6 +1813,7 @@ BOOL process_local_message(int sock, char *buffer, int buf_size);
BOOL request_oplock_break(share_mode_entry *share_entry,
SMB_DEV_T dev, SMB_INO_T inode);
BOOL attempt_close_oplocked_file(files_struct *fsp);
void check_kernel_oplocks(BOOL *have_oplocks);
/*The following definitions come from smbd/password.c */

View File

@ -231,6 +231,7 @@ typedef struct
BOOL bTimestampLogs;
BOOL bNTSmbSupport;
BOOL bStatCache;
BOOL bKernelOplocks;
} global;
static global Globals;
@ -691,6 +692,7 @@ static struct parm_struct parm_table[] =
{"Locking Options", P_SEP, P_SEPARATOR},
{"blocking locks", P_BOOL, P_LOCAL, &sDefault.bBlockingLocks, NULL, NULL, 0},
{"fake oplocks", P_BOOL, P_LOCAL, &sDefault.bFakeOplocks, NULL, NULL, 0},
{"kernel oplocks", P_BOOL, P_GLOBAL, &Globals.bKernelOplocks, NULL, NULL, FLAG_GLOBAL},
{"locking", P_BOOL, P_LOCAL, &sDefault.bLocking, NULL, NULL, FLAG_GLOBAL},
{"ole locking compatibility", P_BOOL, P_GLOBAL, &Globals.bOleLockingCompat, NULL, NULL, FLAG_GLOBAL},
{"oplocks", P_BOOL, P_LOCAL, &sDefault.bOpLocks, NULL, NULL, FLAG_GLOBAL},
@ -907,6 +909,12 @@ static void init_globals(void)
Globals.bDNSproxy = True;
/*
* smbd will check after starting to see if this value
* should be set to "true" or not.
*/
Globals.bKernelOplocks = False;
/*
* This must be done last as it checks the value in
* client_code_page.
@ -1150,6 +1158,7 @@ FN_GLOBAL_BOOL(lp_passwd_chat_debug,&Globals.bPasswdChatDebug)
FN_GLOBAL_BOOL(lp_ole_locking_compat,&Globals.bOleLockingCompat)
FN_GLOBAL_BOOL(lp_nt_smb_support,&Globals.bNTSmbSupport)
FN_GLOBAL_BOOL(lp_stat_cache,&Globals.bStatCache)
FN_GLOBAL_BOOL(lp_kernel_oplocks,&Globals.bKernelOplocks)
FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level)
FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl)
@ -2642,3 +2651,12 @@ void lp_set_name_resolve_order(char *new_order)
{
Globals.szNameResolveOrder = new_order;
}
/***********************************************************
Set the real value of kernel oplocks (called by smbd).
************************************************************/
void lp_set_kernel_oplocks(BOOL val)
{
Globals.bKernelOplocks = val;
}

View File

@ -687,7 +687,7 @@ static int check_share_mode( share_mode_entry *share, int deny_mode,
open a file with a share mode
****************************************************************************/
void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int share_mode,int ofun,
mode_t mode,int oplock_request, int *Access,int *action)
mode_t mode,int *oplock_request, int *Access,int *action)
{
int flags=0;
int flags2=0;
@ -922,24 +922,34 @@ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (dou
be extended to level II oplocks (multiple reader
oplocks). */
if(oplock_request && (num_share_modes == 0) && lp_oplocks(SNUM(conn)) &&
if((*oplock_request) && (num_share_modes == 0) && lp_oplocks(SNUM(conn)) &&
!IS_VETO_OPLOCK_PATH(conn,fname))
{
#if defined(HAVE_KERNEL_OPLOCKS)
/*
* Try and get a *real* oplock on this file.
* If we fail, set the port and oplock request to
* zero so that we don't tell other SMB's that we
* got an oplock.
*/
if(lp_kernel_oplocks())
#endif /* HAVE_KERNEL_OPLOCKS */
fsp->granted_oplock = True;
fsp->sent_oplock_break = False;
global_oplocks_open++;
port = oplock_port;
DEBUG(5,("open_file_shared: granted oplock (%x) on file %s, \
dev = %x, inode = %.0f\n", oplock_request, fname, (unsigned int)dev, (double)inode));
dev = %x, inode = %.0f\n", *oplock_request, fname, (unsigned int)dev, (double)inode));
}
else
{
port = 0;
oplock_request = 0;
*oplock_request = 0;
}
set_share_mode(token, fsp, port, oplock_request);
set_share_mode(token, fsp, port, *oplock_request);
}
if ((flags2&O_TRUNC) && file_existed)

View File

@ -26,7 +26,11 @@ extern int DEBUGLEVEL;
/* Oplock ipc UDP socket. */
int oplock_sock = -1;
uint16 oplock_port = 0;
#if defined(HAVE_KERNEL_OPLOCKS)
static int oplock_pipes[2];
#endif /* HAVE_KERNEL_OPLOCKS */
int oplock
/* Current number of oplocks we have outstanding. */
int32 global_oplocks_open = 0;
BOOL global_oplock_break = False;
@ -678,3 +682,60 @@ BOOL attempt_close_oplocked_file(files_struct *fsp)
return False;
}
void check_kernel_oplocks(BOOL *have_oplocks)
{
static BOOL done;
int fd;
int pfd[2];
pstring tmpname;
/*
* We only do this check once on startup.
*/
if(done)
return;
done = True;
*have_oplocks = False
#if defined(HAVE_KERNEL_OPLOCKS)
slprintf( tmpname, sizeof(tmpname)-1, "/tmp/ot.%d.XXXXXX", getpid());
mktemp(tmpname);
if(pipe(pfd) != 0) {
DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error was %s\n",
strerror(errno) ));
return;
}
if((fd = open(tmpname, O_RDWR)) < 0) {
DEBUG(0,("check_kernel_oplocks: Unable to open temp test file %s. Error was %s\n",
tmpname, strerror(errno) ));
unlink( tmpname );
close(pfd[0]);
close(pfd[1]);
return;
}
unlink( tmpname );
if(fcntl(fd, F_OPLKREG, pfd[1]) == -1) {
DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not available on this machine. \
Disabling kernel oplock supprt.\n" ));
close(pfd[0]);
close(pfd[1]);
close(fd);
return;
}
fcntl(fd, F_OPLKACK, OP_REVOKE);
close(pfd[0]);
close(pfd[1]);
close(fd);
DEBUG(3,("check_kernel_oplocks: Kernel oplocks enabled.\n"));
*have_oplocks = True;
#endif /* HAVE_KERNEL_OPLOCKS */
}