mirror of
https://github.com/samba-team/samba.git
synced 2025-03-29 02:50:28 +03:00
replaced stdio in many parts of samba with a XFILE. XFILE is a cut-down
replacemnt of stdio that doesn't suffer from the 8-bit filedescriptor limit that we hit with nasty consequences on some systems I would eventually prefer us to have a configure test to see if we need to replace stdio, but for now this code needs to be tested widely so I'm enabling it by default. (This used to be commit 1af8bf34f1caa3e7ec312d8109c07d32a945a448)
This commit is contained in:
parent
ba8e3e0343
commit
b30e75692d
@ -107,7 +107,7 @@ LIB_OBJ = lib/charcnv.o lib/debug.o lib/fault.o \
|
||||
lib/interfaces.o lib/pidfile.o lib/replace.o \
|
||||
lib/signal.o lib/system.o lib/time.o \
|
||||
lib/ufc.o lib/genrand.o lib/username.o lib/access.o lib/smbrun.o \
|
||||
lib/bitmap.o lib/crc32.o lib/snprintf.o lib/dprintf.o lib/wins_srv.o \
|
||||
lib/bitmap.o lib/crc32.o lib/snprintf.o lib/dprintf.o lib/xfile.o lib/wins_srv.o \
|
||||
lib/util_array.o lib/util_str.o lib/util_sid.o \
|
||||
lib/util_unistr.o lib/util_file.o lib/sysacls.o \
|
||||
lib/util.o lib/util_sock.o lib/util_sec.o smbd/ssl.o \
|
||||
|
@ -52,7 +52,7 @@ typedef char fstring[FSTRING_LEN];
|
||||
#define True 1
|
||||
|
||||
/* zero a structure given a pointer to the structure */
|
||||
#define ZERO_STRUCTP(x) { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); }
|
||||
#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
|
||||
|
||||
#define MAX_UNISTRLEN 256
|
||||
#define MAX_STRINGLEN 256
|
||||
|
@ -135,17 +135,17 @@ static int writefile(int f, char *b, int n)
|
||||
read from a file with LF->CR/LF translation if appropriate. return the
|
||||
number read. read approx n bytes.
|
||||
****************************************************************************/
|
||||
static int readfile(char *b, int n, FILE *f)
|
||||
static int readfile(char *b, int n, XFILE *f)
|
||||
{
|
||||
int i;
|
||||
int c;
|
||||
|
||||
if (!translation)
|
||||
return fread(b,1,n,f);
|
||||
return x_fread(b,1,n,f);
|
||||
|
||||
i = 0;
|
||||
while (i < (n - 1) && (i < BUFFER_SIZE)) {
|
||||
if ((c = getc(f)) == EOF) {
|
||||
if ((c = x_getc(f)) == EOF) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -981,7 +981,7 @@ static void cmd_mkdir(void)
|
||||
static void do_put(char *rname,char *lname)
|
||||
{
|
||||
int fnum;
|
||||
FILE *f;
|
||||
XFILE *f;
|
||||
int nread=0;
|
||||
char *buf=NULL;
|
||||
int maxwrite=io_bufsize;
|
||||
@ -999,10 +999,10 @@ static void do_put(char *rname,char *lname)
|
||||
/* allow files to be piped into smbclient
|
||||
jdblair 24.jun.98 */
|
||||
if (!strcmp(lname, "-")) {
|
||||
f = stdin;
|
||||
f = x_stdin;
|
||||
/* size of file is not known */
|
||||
} else {
|
||||
f = sys_fopen(lname,"r");
|
||||
f = x_fopen(lname,O_RDONLY, 0);
|
||||
}
|
||||
|
||||
if (!f) {
|
||||
@ -1019,12 +1019,12 @@ static void do_put(char *rname,char *lname)
|
||||
d_printf("ERROR: Not enough memory!\n");
|
||||
return;
|
||||
}
|
||||
while (!feof(f)) {
|
||||
while (!x_feof(f)) {
|
||||
int n = maxwrite;
|
||||
int ret;
|
||||
|
||||
if ((n = readfile(buf,n,f)) < 1) {
|
||||
if((n == 0) && feof(f))
|
||||
if((n == 0) && x_feof(f))
|
||||
break; /* Empty local file. */
|
||||
|
||||
d_printf("Error reading local file: %s\n", strerror(errno));
|
||||
@ -1043,13 +1043,13 @@ static void do_put(char *rname,char *lname)
|
||||
|
||||
if (!cli_close(cli, fnum)) {
|
||||
d_printf("%s closing remote file %s\n",cli_errstr(cli),rname);
|
||||
fclose(f);
|
||||
x_fclose(f);
|
||||
if (buf) free(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
fclose(f);
|
||||
x_fclose(f);
|
||||
if (buf) free(buf);
|
||||
|
||||
{
|
||||
@ -1068,7 +1068,7 @@ static void do_put(char *rname,char *lname)
|
||||
put_total_size / (1.024*put_total_time_ms)));
|
||||
}
|
||||
|
||||
if (f == stdin) {
|
||||
if (f == x_stdin) {
|
||||
cli_shutdown(cli);
|
||||
exit(0);
|
||||
}
|
||||
@ -2280,7 +2280,7 @@ static int do_message_op(void)
|
||||
fstring base_directory;
|
||||
char *pname = argv[0];
|
||||
int opt;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int old_debug;
|
||||
@ -2315,7 +2315,7 @@ static int do_message_op(void)
|
||||
|
||||
for (opt = 1; opt < argc; opt++) {
|
||||
if (strcmp(argv[opt], "-E") == 0)
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
else if(strncmp(argv[opt], "-s", 2) == 0) {
|
||||
if(argv[opt][2] != '\0')
|
||||
pstrcpy(servicesf, &argv[opt][2]);
|
||||
@ -2473,7 +2473,7 @@ static int do_message_op(void)
|
||||
break;
|
||||
case 'E':
|
||||
display_set_stderr();
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
break;
|
||||
case 'U':
|
||||
{
|
||||
@ -2490,22 +2490,22 @@ static int do_message_op(void)
|
||||
|
||||
case 'A':
|
||||
{
|
||||
FILE *auth;
|
||||
XFILE *auth;
|
||||
fstring buf;
|
||||
uint16 len = 0;
|
||||
char *ptr, *val, *param;
|
||||
|
||||
if ((auth=sys_fopen(optarg, "r")) == NULL)
|
||||
if ((auth=x_fopen(optarg, O_RDONLY, 0)) == NULL)
|
||||
{
|
||||
/* fail if we can't open the credentials file */
|
||||
d_printf("ERROR: Unable to open credentials file!\n");
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
while (!feof(auth))
|
||||
while (!x_feof(auth))
|
||||
{
|
||||
/* get a line from the file */
|
||||
if (!fgets (buf, sizeof(buf), auth))
|
||||
if (!x_fgets(buf, sizeof(buf), auth))
|
||||
continue;
|
||||
len = strlen(buf);
|
||||
|
||||
@ -2539,7 +2539,7 @@ static int do_message_op(void)
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
}
|
||||
fclose(auth);
|
||||
x_fclose(auth);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -71,7 +71,7 @@ stack dir_stack = {NULL, 0}; /* Want an empty stack */
|
||||
#define SEPARATORS " \t\n\r"
|
||||
extern int DEBUGLEVEL;
|
||||
extern struct cli_state *cli;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
|
||||
/* These defines are for the do_setrattr routine, to indicate
|
||||
* setting and reseting of file attributes in the function call */
|
||||
@ -1533,7 +1533,7 @@ accordingly.
|
||||
***************************************************************************/
|
||||
static int read_inclusion_file(char *filename)
|
||||
{
|
||||
FILE *inclusion = NULL;
|
||||
XFILE *inclusion = NULL;
|
||||
char buf[MAXPATHLEN + 1];
|
||||
char *inclusion_buffer = NULL;
|
||||
int inclusion_buffer_size = 0;
|
||||
@ -1545,7 +1545,7 @@ static int read_inclusion_file(char *filename)
|
||||
|
||||
clipn = 0;
|
||||
buf[MAXPATHLEN] = '\0'; /* guarantee null-termination */
|
||||
if ((inclusion = sys_fopen(filename, "r")) == NULL) {
|
||||
if ((inclusion = x_fopen(filename, O_RDONLY, 0)) == NULL) {
|
||||
/* XXX It would be better to include a reason for failure, but without
|
||||
* autoconf, it's hard to use strerror, sys_errlist, etc.
|
||||
*/
|
||||
@ -1553,7 +1553,7 @@ static int read_inclusion_file(char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((! error) && (fgets(buf, sizeof(buf)-1, inclusion))) {
|
||||
while ((! error) && (x_fgets(buf, sizeof(buf)-1, inclusion))) {
|
||||
if (inclusion_buffer == NULL) {
|
||||
inclusion_buffer_size = 1024;
|
||||
if ((inclusion_buffer = malloc(inclusion_buffer_size)) == NULL) {
|
||||
@ -1584,7 +1584,7 @@ static int read_inclusion_file(char *filename)
|
||||
inclusion_buffer_sofar += strlen(buf) + 1;
|
||||
clipn++;
|
||||
}
|
||||
fclose(inclusion);
|
||||
x_fclose(inclusion);
|
||||
|
||||
if (! error) {
|
||||
/* Allocate an array of clipn + 1 char*'s for cliplist */
|
||||
@ -1827,7 +1827,7 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind)
|
||||
* tar output
|
||||
*/
|
||||
if (tarhandle == 1)
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
} else {
|
||||
if (tar_type=='c' && (dry_run || strcmp(argv[Optind], "/dev/null")==0))
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ static struct cli_state *do_connection(char *service)
|
||||
if (have_ip) ip = dest_ip;
|
||||
|
||||
/* have to open a new connection */
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, smb_port) != port) ||
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, smb_port) != smb_port) ||
|
||||
!cli_connect(c, server_n, &ip)) {
|
||||
DEBUG(0,("%d: Connection to %s failed\n", getpid(), server_n));
|
||||
if (c) {
|
||||
|
@ -640,6 +640,7 @@ extern int errno;
|
||||
#include "messages.h"
|
||||
#include "util_list.h"
|
||||
#include "charset.h"
|
||||
#include "xfile.h"
|
||||
|
||||
#include "util_getent.h"
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
|
||||
|
||||
/* zero a structure given a pointer to the structure */
|
||||
#define ZERO_STRUCTP(x) { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); }
|
||||
#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
|
||||
|
||||
/* zero a structure given a pointer to the structure - no zero check */
|
||||
#define ZERO_STRUCTPN(x) memset((char *)(x), 0, sizeof(*(x)))
|
||||
|
@ -198,16 +198,6 @@ do a (presumably graceful) quit...
|
||||
****************************************************************************/
|
||||
static uint32 cmd_quit(struct client_info *info, int argc, char *argv[])
|
||||
{
|
||||
#ifdef MEM_MAN
|
||||
{
|
||||
extern FILE *dbf;
|
||||
smb_mem_write_status(dbf);
|
||||
smb_mem_write_errors(dbf);
|
||||
smb_mem_write_verbose(dbf);
|
||||
dbgflush();
|
||||
}
|
||||
#endif
|
||||
|
||||
free_connections();
|
||||
exit(0);
|
||||
|
||||
@ -927,7 +917,7 @@ static uint32 cmd_set(CLIENT_INFO *info, int argc, char *argv[])
|
||||
BOOL interactive = True;
|
||||
char *cmd_str = NULL;
|
||||
int opt;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
extern char *optarg;
|
||||
static pstring servicesf = CONFIGFILE;
|
||||
pstring term_code;
|
||||
@ -1048,7 +1038,7 @@ static uint32 cmd_set(CLIENT_INFO *info, int argc, char *argv[])
|
||||
case 'E':
|
||||
{
|
||||
cmd_set_options |= CMD_DBG;
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
||||
* levels higher than DEBUGLEVEL will not be processed.
|
||||
*/
|
||||
|
||||
FILE *dbf = NULL;
|
||||
XFILE *dbf = NULL;
|
||||
pstring debugf = "";
|
||||
BOOL append_log = False;
|
||||
|
||||
@ -308,7 +308,7 @@ void setup_logging(char *pname, BOOL interactive)
|
||||
|
||||
if (interactive) {
|
||||
stdout_logging = True;
|
||||
dbf = stdout;
|
||||
dbf = x_stdout;
|
||||
}
|
||||
#ifdef WITH_SYSLOG
|
||||
else {
|
||||
@ -337,7 +337,7 @@ BOOL reopen_logs( void )
|
||||
{
|
||||
pstring fname;
|
||||
mode_t oldumask;
|
||||
FILE *new_dbf = NULL;
|
||||
XFILE *new_dbf = NULL;
|
||||
BOOL ret = True;
|
||||
|
||||
if (stdout_logging)
|
||||
@ -351,20 +351,20 @@ BOOL reopen_logs( void )
|
||||
|
||||
pstrcpy( debugf, fname );
|
||||
if (append_log)
|
||||
new_dbf = sys_fopen( debugf, "a" );
|
||||
new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644);
|
||||
else
|
||||
new_dbf = sys_fopen( debugf, "w" );
|
||||
new_dbf = x_fopen( debugf, O_WRONLY|O_CREAT|O_TRUNC, 0644 );
|
||||
|
||||
if (!new_dbf) {
|
||||
log_overflow = True;
|
||||
DEBUG(0, ("Unable to open new log file %s: %s\n", debugf, strerror(errno)));
|
||||
log_overflow = False;
|
||||
fflush(dbf);
|
||||
x_fflush(dbf);
|
||||
ret = False;
|
||||
} else {
|
||||
setbuf(new_dbf, NULL);
|
||||
x_setbuf(new_dbf, NULL);
|
||||
if (dbf)
|
||||
(void) fclose(dbf);
|
||||
(void) x_fclose(dbf);
|
||||
dbf = new_dbf;
|
||||
}
|
||||
|
||||
@ -429,7 +429,7 @@ void check_log_size( void )
|
||||
|
||||
maxlog = lp_max_log_size() * 1024;
|
||||
|
||||
if( sys_fstat( fileno( dbf ), &st ) == 0 && st.st_size > maxlog ) {
|
||||
if( sys_fstat( x_fileno( dbf ), &st ) == 0 && st.st_size > maxlog ) {
|
||||
(void)reopen_logs();
|
||||
if( dbf && get_file_size( debugf ) > maxlog ) {
|
||||
pstring name;
|
||||
@ -456,7 +456,7 @@ void check_log_size( void )
|
||||
startup or when the log level is increased from zero.
|
||||
-dwg 6 June 2000
|
||||
*/
|
||||
dbf = sys_fopen( "/dev/console", "w" );
|
||||
dbf = x_fopen( "/dev/console", O_WRONLY, 0);
|
||||
if(dbf) {
|
||||
DEBUG(0,("check_log_size: open of debug file %s failed - using console.\n",
|
||||
debugf ));
|
||||
@ -484,7 +484,7 @@ void check_log_size( void )
|
||||
{
|
||||
va_start( ap, format_str );
|
||||
if(dbf)
|
||||
(void)vfprintf( dbf, format_str, ap );
|
||||
(void)x_vfprintf( dbf, format_str, ap );
|
||||
va_end( ap );
|
||||
errno = old_errno;
|
||||
return( 0 );
|
||||
@ -499,13 +499,13 @@ void check_log_size( void )
|
||||
mode_t oldumask = umask( 022 );
|
||||
|
||||
if( append_log )
|
||||
dbf = sys_fopen( debugf, "a" );
|
||||
dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644 );
|
||||
else
|
||||
dbf = sys_fopen( debugf, "w" );
|
||||
dbf = x_fopen( debugf, O_WRONLY|O_CREAT|O_TRUNC, 0644 );
|
||||
(void)umask( oldumask );
|
||||
if( dbf )
|
||||
{
|
||||
setbuf( dbf, NULL );
|
||||
x_setbuf( dbf, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -554,10 +554,10 @@ void check_log_size( void )
|
||||
{
|
||||
va_start( ap, format_str );
|
||||
if(dbf)
|
||||
(void)vfprintf( dbf, format_str, ap );
|
||||
(void)x_vfprintf( dbf, format_str, ap );
|
||||
va_end( ap );
|
||||
if(dbf)
|
||||
(void)fflush( dbf );
|
||||
(void)x_fflush( dbf );
|
||||
}
|
||||
|
||||
errno = old_errno;
|
||||
@ -647,7 +647,7 @@ void dbgflush( void )
|
||||
{
|
||||
bufr_print();
|
||||
if(dbf)
|
||||
(void)fflush( dbf );
|
||||
(void)x_fflush( dbf );
|
||||
} /* dbgflush */
|
||||
|
||||
/* ************************************************************************** **
|
||||
|
@ -49,14 +49,14 @@ static char *smb_readline_replacement(char *prompt, void (*callback)(void),
|
||||
int end))
|
||||
{
|
||||
fd_set fds;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
static pstring line;
|
||||
struct timeval timeout;
|
||||
int fd = fileno(stdin);
|
||||
char *ret;
|
||||
|
||||
fprintf(dbf, "%s", prompt);
|
||||
fflush(dbf);
|
||||
x_fprintf(dbf, "%s", prompt);
|
||||
x_fflush(dbf);
|
||||
|
||||
while (1) {
|
||||
timeout.tv_sec = 5;
|
||||
|
@ -630,16 +630,6 @@ BOOL yesno(char *p)
|
||||
return(False);
|
||||
}
|
||||
|
||||
#ifdef HPUX
|
||||
/****************************************************************************
|
||||
this is a version of setbuffer() for those machines that only have setvbuf
|
||||
****************************************************************************/
|
||||
void setbuffer(FILE *f,char *buf,int bufsize)
|
||||
{
|
||||
setvbuf(f,buf,_IOFBF,bufsize);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
expand a pointer to be a particular size
|
||||
****************************************************************************/
|
||||
|
@ -666,7 +666,7 @@ static void usage(char *pname)
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int opt;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
extern char *optarg;
|
||||
extern BOOL append_log;
|
||||
|
||||
@ -876,7 +876,7 @@ static void usage(char *pname)
|
||||
process();
|
||||
|
||||
if (dbf)
|
||||
fclose(dbf);
|
||||
x_fclose(dbf);
|
||||
return(0);
|
||||
} /* main */
|
||||
|
||||
|
@ -126,7 +126,7 @@ END {
|
||||
gotstart = 1;
|
||||
}
|
||||
|
||||
if( $0 ~ /^smb_iconv_t|^long|^char|^uint|^NTSTATUS|^WERROR|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) {
|
||||
if( $0 ~ /^smb_iconv_t|^long|^char|^uint|^NTSTATUS|^WERROR|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^XFILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) {
|
||||
gotstart = 1;
|
||||
}
|
||||
|
||||
|
@ -781,11 +781,6 @@ static void usage(char *pname)
|
||||
/* Setup the main smbd so that we can get messages. */
|
||||
claim_connection(NULL,"",MAXSTATUS,True);
|
||||
|
||||
/* Attempt to migrate from an old 2.0.x machine account file. */
|
||||
if (!migrate_from_old_password_file(global_myworkgroup)) {
|
||||
DEBUG(0,("Failed to migrate from old MAC file.\n"));
|
||||
}
|
||||
|
||||
if (!open_sockets(is_daemon,port))
|
||||
exit(1);
|
||||
|
||||
|
@ -42,9 +42,9 @@ int main(int argc, char *argv[])
|
||||
int opt;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
|
||||
dbf = stdout;
|
||||
dbf = x_stdout;
|
||||
smbw_setup_shared();
|
||||
|
||||
while ((opt = getopt(argc, argv, "W:U:R:d:P:l:hL:")) != EOF) {
|
||||
|
@ -47,7 +47,7 @@ void smbw_init(void)
|
||||
extern BOOL in_client;
|
||||
static int initialised;
|
||||
static pstring servicesf = CONFIGFILE;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
char *p;
|
||||
int eno;
|
||||
pstring line;
|
||||
@ -62,7 +62,7 @@ void smbw_init(void)
|
||||
DEBUGLEVEL = 0;
|
||||
setup_logging("smbsh",True);
|
||||
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
|
||||
if ((p=smbw_getshared("LOGFILE"))) {
|
||||
dbf = sys_fopen(p, "a");
|
||||
|
@ -545,7 +545,7 @@ static void usage(void)
|
||||
char *share[NSERVERS];
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
int opt;
|
||||
char *p;
|
||||
int seed, server;
|
||||
@ -553,7 +553,7 @@ static void usage(void)
|
||||
|
||||
setlinebuf(stdout);
|
||||
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
|
||||
if (argc < 3 || argv[1][0] == '-') {
|
||||
usage();
|
||||
|
@ -533,7 +533,7 @@ static void usage(void)
|
||||
char *share1, *share2, *nfspath1, *nfspath2;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
int opt;
|
||||
char *p;
|
||||
int seed;
|
||||
@ -541,7 +541,7 @@ static void usage(void)
|
||||
|
||||
setlinebuf(stdout);
|
||||
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
|
||||
if (argc < 5 || argv[1][0] == '-') {
|
||||
usage();
|
||||
|
@ -420,7 +420,7 @@ static void usage(void)
|
||||
struct cli_state *cli;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
int opt;
|
||||
char *p;
|
||||
int seed;
|
||||
@ -428,7 +428,7 @@ static void usage(void)
|
||||
|
||||
setlinebuf(stdout);
|
||||
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
|
||||
if (argv[1][0] == '-' || argc < 2) {
|
||||
usage();
|
||||
|
@ -229,7 +229,7 @@ enum client_action
|
||||
{
|
||||
char *pname = argv[0];
|
||||
int opt;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
static pstring servicesf = CONFIGFILE;
|
||||
@ -412,7 +412,7 @@ enum client_action
|
||||
|
||||
case 'E':
|
||||
{
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3077,11 +3077,11 @@ static void usage(void)
|
||||
int gotpass = 0;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
static pstring servicesf = CONFIGFILE;
|
||||
BOOL correct = True;
|
||||
|
||||
dbf = stdout;
|
||||
dbf = x_stdout;
|
||||
|
||||
#ifdef HAVE_SETBUFFER
|
||||
setbuffer(stdout, NULL, 0);
|
||||
|
@ -802,7 +802,7 @@ You can string acls together with spaces, commas or newlines\n\
|
||||
pstring filename;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
int opt;
|
||||
char *p;
|
||||
static pstring servicesf = CONFIGFILE;
|
||||
@ -816,7 +816,7 @@ You can string acls together with spaces, commas or newlines\n\
|
||||
|
||||
setlinebuf(stdout);
|
||||
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
|
||||
if (argc < 3 || argv[1][0] == '-') {
|
||||
usage();
|
||||
|
@ -325,7 +325,7 @@ static BOOL print_tree(struct user_auth_info *user_info)
|
||||
{
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
int opt;
|
||||
char *p;
|
||||
pstring servicesf = CONFIGFILE;
|
||||
@ -336,7 +336,7 @@ static BOOL print_tree(struct user_auth_info *user_info)
|
||||
|
||||
setlinebuf(stdout);
|
||||
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
|
||||
setup_logging(argv[0],True);
|
||||
|
||||
|
@ -45,7 +45,7 @@ struct session_record{
|
||||
} *srecs;
|
||||
|
||||
extern int DEBUGLEVEL;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
|
||||
static pstring Ucrit_username = ""; /* added by OH */
|
||||
static pid_t Ucrit_pid[100]; /* Ugly !!! */ /* added by OH */
|
||||
@ -556,7 +556,7 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
|
||||
setup_logging(argv[0],True);
|
||||
|
||||
DEBUGLEVEL = 0;
|
||||
dbf = stderr;
|
||||
dbf = x_stderr;
|
||||
|
||||
if (getuid() != geteuid()) {
|
||||
d_printf("smbstatus should not be run setuid\n");
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "smb.h"
|
||||
|
||||
/* these live in util.c */
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
extern int DEBUGLEVEL;
|
||||
|
||||
/***********************************************
|
||||
@ -210,7 +210,7 @@ int main(int argc, char *argv[])
|
||||
else if ((argc == 2) || (argc == 4))
|
||||
pstrcpy(configfile,argv[optind]);
|
||||
|
||||
dbf = stdout;
|
||||
dbf = x_stdout;
|
||||
DEBUGLEVEL = 2;
|
||||
|
||||
printf("Load smb config files from %s\n",configfile);
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "smb.h"
|
||||
|
||||
/* these live in util.c */
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
extern int DEBUGLEVEL;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
||||
printf("Usage: testprns printername [printcapfile]\n");
|
||||
else
|
||||
{
|
||||
dbf = sys_fopen("test.log", "w");
|
||||
dbf = x_fopen("test.log", O_WRONLY|O_CREAT|O_TRUNC, 0644);
|
||||
if (dbf == NULL) {
|
||||
printf("Unable to open logfile.\n");
|
||||
} else {
|
||||
@ -62,7 +62,7 @@ int main(int argc, char *argv[])
|
||||
printf("Printer name %s is not valid.\n", argv[1]);
|
||||
else
|
||||
printf("Printer name %s is valid.\n", argv[1]);
|
||||
fclose(dbf);
|
||||
x_fclose(dbf);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
|
@ -149,9 +149,9 @@ void cgi_load_variables(FILE *f1)
|
||||
len = content_length;
|
||||
}
|
||||
} else {
|
||||
fseek(f, 0, SEEK_END);
|
||||
len = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
struct stat st;
|
||||
fstat(fileno(f), &st);
|
||||
len = st.st_size;
|
||||
}
|
||||
|
||||
|
||||
|
@ -999,7 +999,7 @@ static void printers_page(void)
|
||||
{
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern FILE *dbf;
|
||||
extern XFILE *dbf;
|
||||
int opt;
|
||||
char *page;
|
||||
|
||||
@ -1016,8 +1016,8 @@ static void printers_page(void)
|
||||
/* we don't want any SIGPIPE messages */
|
||||
BlockSignals(True,SIGPIPE);
|
||||
|
||||
dbf = sys_fopen("/dev/null", "w");
|
||||
if (!dbf) dbf = stderr;
|
||||
dbf = x_fopen("/dev/null", O_WRONLY, 0);
|
||||
if (!dbf) dbf = x_stderr;
|
||||
|
||||
/* we don't want stderr screwing us up */
|
||||
close(2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user