mirror of
https://github.com/samba-team/samba.git
synced 2025-12-23 00:23:53 +03:00
Patch from Paul Green <Paul.Green@stratus.com> to be more POSIX-compatible
This commit is contained in:
@@ -216,7 +216,11 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
|
#ifdef WITH_SYSLOG
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
|
||||||
#ifdef HAVE_NETINET_TCP_H
|
#ifdef HAVE_NETINET_TCP_H
|
||||||
|
|||||||
@@ -871,7 +871,7 @@ static BOOL matchname(char *remotehost,struct in_addr addr)
|
|||||||
|
|
||||||
/* Look up the host address in the address list we just got. */
|
/* Look up the host address in the address list we just got. */
|
||||||
for (i = 0; hp->h_addr_list[i]; i++) {
|
for (i = 0; hp->h_addr_list[i]; i++) {
|
||||||
if (memcmp(hp->h_addr_list[i], (caddr_t) & addr, sizeof(addr)) == 0)
|
if (memcmp(hp->h_addr_list[i], (char *) & addr, sizeof(addr)) == 0)
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ uint32 unix_perms_to_wire(mode_t perms)
|
|||||||
ret |= ((perms & S_ISGID) ? UNIX_SET_GID : 0);
|
ret |= ((perms & S_ISGID) ? UNIX_SET_GID : 0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef S_ISUID
|
#ifdef S_ISUID
|
||||||
ret |= ((perms & S_ISVTX) ? UNIX_SET_UID : 0);
|
ret |= ((perms & S_ISUID) ? UNIX_SET_UID : 0);
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_SELECT_H
|
||||||
|
#include <sys/select.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -21,7 +21,9 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
|
#ifdef WITH_PROFILE
|
||||||
#define IPC_PERMS ((SHM_R | SHM_W) | (SHM_R>>3) | (SHM_R>>6))
|
#define IPC_PERMS ((SHM_R | SHM_W) | (SHM_R>>3) | (SHM_R>>6))
|
||||||
|
#endif /* WITH_PROFILE */
|
||||||
|
|
||||||
static int shm_id;
|
static int shm_id;
|
||||||
static BOOL read_only;
|
static BOOL read_only;
|
||||||
@@ -45,6 +47,7 @@ void profile_message(int msg_type, pid_t src, void *buf, size_t len)
|
|||||||
int level;
|
int level;
|
||||||
|
|
||||||
memcpy(&level, buf, sizeof(int));
|
memcpy(&level, buf, sizeof(int));
|
||||||
|
#ifdef WITH_PROFILE
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case 0: /* turn off profiling */
|
case 0: /* turn off profiling */
|
||||||
do_profile_flag = False;
|
do_profile_flag = False;
|
||||||
@@ -66,6 +69,9 @@ void profile_message(int msg_type, pid_t src, void *buf, size_t len)
|
|||||||
DEBUG(1,("INFO: Profiling values cleared from pid %d\n", (int)src));
|
DEBUG(1,("INFO: Profiling values cleared from pid %d\n", (int)src));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else /* WITH_PROFILE */
|
||||||
|
DEBUG(1,("INFO: Profiling support unavailable in this build.\n"));
|
||||||
|
#endif /* WITH_PROFILE */
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -87,6 +93,7 @@ void reqprofile_message(int msg_type, pid_t src, void *buf, size_t len)
|
|||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
open the profiling shared memory area
|
open the profiling shared memory area
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
#ifdef WITH_PROFILE
|
||||||
BOOL profile_setup(BOOL rdonly)
|
BOOL profile_setup(BOOL rdonly)
|
||||||
{
|
{
|
||||||
struct shmid_ds shm_ds;
|
struct shmid_ds shm_ds;
|
||||||
@@ -154,3 +161,4 @@ BOOL profile_setup(BOOL rdonly)
|
|||||||
message_register(MSG_REQ_PROFILELEVEL, reqprofile_message);
|
message_register(MSG_REQ_PROFILELEVEL, reqprofile_message);
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
#endif /* WITH_PROFILE */
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid,
|
|||||||
******************************************************************/
|
******************************************************************/
|
||||||
static int profile_dump(void)
|
static int profile_dump(void)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_PROFILE
|
||||||
if (!profile_setup(True)) {
|
if (!profile_setup(True)) {
|
||||||
fprintf(stderr,"Failed to initialise profile memory\n");
|
fprintf(stderr,"Failed to initialise profile memory\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -482,6 +483,9 @@ static int profile_dump(void)
|
|||||||
d_printf("run_elections_time: %u\n", profile_p->run_elections_time);
|
d_printf("run_elections_time: %u\n", profile_p->run_elections_time);
|
||||||
d_printf("election_count: %u\n", profile_p->election_count);
|
d_printf("election_count: %u\n", profile_p->election_count);
|
||||||
d_printf("election_time: %u\n", profile_p->election_time);
|
d_printf("election_time: %u\n", profile_p->election_time);
|
||||||
|
#else /* WITH_PROFILE */
|
||||||
|
fprintf(stderr, "Profile data unavailable\n");
|
||||||
|
#endif /* WITH_PROFILE */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -549,7 +553,9 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
|
|||||||
{"conf", 's', POPT_ARG_STRING, 0, 's'},
|
{"conf", 's', POPT_ARG_STRING, 0, 's'},
|
||||||
{"user", 'u', POPT_ARG_STRING, 0, 'u'},
|
{"user", 'u', POPT_ARG_STRING, 0, 'u'},
|
||||||
{"brief", 'b', POPT_ARG_NONE, &brief},
|
{"brief", 'b', POPT_ARG_NONE, &brief},
|
||||||
|
#ifdef WITH_PROFILE
|
||||||
{"profile", 'P', POPT_ARG_NONE, &profile_only},
|
{"profile", 'P', POPT_ARG_NONE, &profile_only},
|
||||||
|
#endif /* WITH_PROFILE */
|
||||||
{"byterange", 'B', POPT_ARG_NONE, &show_brl},
|
{"byterange", 'B', POPT_ARG_NONE, &show_brl},
|
||||||
{ NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
|
{ NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
|
||||||
{ 0, 0, 0, 0}
|
{ 0, 0, 0, 0}
|
||||||
|
|||||||
Reference in New Issue
Block a user