[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Dec 11 14:02:03 UTC 2016


The branch, master has been updated
       via  8be0a0d lib: Remove xfile
       via  8a0174d nmbd: xfile->stdio
       via  899b088 lib: smbreadline xfile->stdio
       via  c07a9b5 libnbt: lmhosts xfile->stdio
       via  3af7ff5 printing: Convert aix_cache_reload to stdio
       via  a366463 printing: std_pcap_cache_reload xfile->stdio
       via  2d94093 rpc_server: svcctl xfile->stdio
       via  9d12b01 vfs: expand_msdfs xfile->stdio
       via  2adcbc9 ntlm_auth3: xfile->stdio
       via  9535340 torture: upload_printer_driver_file xfile->stdio
       via  9c41467 smbd: username map file handling xfile->stdio
       via  9a6243e lib: Add fgets_slash
       via  74371503 lib: popt_common xfile->stdio
       via  d7362ba idmap_hash: xfile->stdio
       via  2cd1299 smbclient: xfile->stdio
       via  b62abd7 smbclient4: xfile->stdio
       via  9fbd544 s3: ntlm_auth: Don't corrupt the output stream with debug messages.
      from  b5c0745 s3: torture: Adds regression test case for se_access_check() owner rights issue.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8be0a0dc76f0f1f63e29beb1ed20f46e1c8f058c
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Nov 26 15:42:42 2016 +0100

    lib: Remove xfile
    
    The days of operating systems with a 255 file
    descriptor limit on FILE (I'm looking at you
    Solaris - Solaris 10 finally fixed this) are
    long gone.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Sun Dec 11 15:01:12 CET 2016 on sn-devel-144

commit 8a0174dca503a6c290c7d565a6bf2c10363964a4
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Nov 26 09:50:33 2016 +0100

    nmbd: xfile->stdio
    
    Unfortunately this is a larger patch. Doing it in small pieces would
    have been pretty difficult, as everybody calls everybody else.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 899b0883c8d500545133b0bf85743525fb1452bf
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 23 10:07:48 2016 +0100

    lib: smbreadline xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c07a9b5bebf300d87fb682417950ec31f83d04e0
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 23 08:55:16 2016 +0100

    libnbt: lmhosts xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3af7ff5c820bef1e90fd8bed477e10245c9335bd
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Nov 26 15:33:06 2016 +0100

    printing: Convert aix_cache_reload to stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a366463ff9ad7c51734bc977e087f4f18095250b
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Nov 26 09:27:19 2016 +0100

    printing: std_pcap_cache_reload xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2d9409341f63564b94797c0dc22e924a0a596985
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 22 01:44:48 2016 +0100

    rpc_server: svcctl xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9d12b014967e0eea7579b7ab6e1ee492170a4c5d
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 22 01:42:36 2016 +0100

    vfs: expand_msdfs xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2adcbc94b8ec0426c451a436d78432d0dde73c89
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Nov 19 09:25:12 2016 +0000

    ntlm_auth3: xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 95353409acd2fe9f8ffe40f9b5f7b5b52254bb4d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Nov 25 22:01:38 2016 +0100

    torture: upload_printer_driver_file xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9c414677d85367fe393445c7357e9ed749a64d30
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 22 01:38:16 2016 +0100

    smbd: username map file handling xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9a6243eb9dac2ce7d9d678b11ec1ca955b5b4b4d
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 21 19:20:10 2016 +0100

    lib: Add fgets_slash
    
    Copy x_fgets_slash with conversion to stdio and talloc.
    
    Probably I'd do this functionality a bit differently, but for simplicity I
    chose to make it the same as what is there.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7437150381dfd6acbbf3c325c1a498c44a615a3b
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 22 01:26:08 2016 +0100

    lib: popt_common xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d7362baf7908a4a3b46b832e4ae927506cc7d40b
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 22 01:30:29 2016 +0100

    idmap_hash: xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2cd129946161f1748bd803f65c78f53437345390
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 22 01:59:22 2016 +0100

    smbclient: xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b62abd73a4e398ef30985fa829113b96c1bd7749
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Nov 23 10:11:13 2016 +0100

    smbclient4: xfile->stdio
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9fbd544b90c2b27985637a9bb3fa520f891f8696
Author: Jeremy Allison <jra at samba.org>
Date:   Sat Dec 10 13:56:18 2016 -0800

    s3: ntlm_auth: Don't corrupt the output stream with debug messages.
    
    Calling programs expect to cleanly read from STDOUT.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=12467
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/util/samba_util.h                      |   2 +
 lib/util/util_file.c                       |  82 +++++
 lib/util/wscript_build                     |   4 +-
 lib/util/xfile.c                           | 524 -----------------------------
 lib/util/xfile.h                           | 114 -------
 libcli/nbt/libnbt.h                        |   9 +-
 libcli/nbt/lmhosts.c                       |  19 +-
 libcli/smbreadline/smbreadline.c           |  11 +-
 source3/auth/user_util.c                   |  13 +-
 source3/client/client.c                    |  33 +-
 source3/lib/popt_common.c                  |  13 +-
 source3/modules/vfs_expand_msdfs.c         |   9 +-
 source3/nmbd/nmbd.h                        |   1 -
 source3/nmbd/nmbd_lmhosts.c                |   2 +-
 source3/nmbd/nmbd_namelistdb.c             |  45 ++-
 source3/nmbd/nmbd_proto.h                  |   8 +-
 source3/nmbd/nmbd_serverlistdb.c           |  32 +-
 source3/nmbd/nmbd_synclists.c              |  25 +-
 source3/nmbd/nmbd_winsserver.c             |  49 +--
 source3/printing/print_aix.c               |  27 +-
 source3/printing/print_standard.c          |  20 +-
 source3/rpc_server/svcctl/srv_svcctl_reg.c |   9 +-
 source3/utils/ntlm_auth.c                  | 237 +++++++------
 source3/winbindd/idmap_hash/mapfile.c      |  11 +-
 source4/client/client.c                    |  30 +-
 source4/torture/rpc/spoolss.c              |  14 +-
 26 files changed, 418 insertions(+), 925 deletions(-)
 delete mode 100644 lib/util/xfile.c
 delete mode 100644 lib/util/xfile.h


Changeset truncated at 500 lines:

diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 7863555..897e0f5 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -336,6 +336,8 @@ const char **str_list_make_v3_const(TALLOC_CTX *mem_ctx,
  */
 _PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint);
 
+char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, int maxlen, FILE *f);
+
 /**
 load a file into memory from a fd.
 **/
diff --git a/lib/util/util_file.c b/lib/util/util_file.c
index 4948afb..ac82060 100644
--- a/lib/util/util_file.c
+++ b/lib/util/util_file.c
@@ -79,6 +79,88 @@ _PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint)
 	return data;
 }
 
+char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, int maxlen, FILE *f)
+{
+	char *s = s2;
+	int len = 0;
+	int c;
+	bool start_of_line = true;
+
+	if (feof(f)) {
+		return NULL;
+	}
+
+	if (maxlen < 2) {
+		return NULL;
+	}
+
+	if (s2 == NULL) {
+		maxlen = MIN(maxlen,8);
+		s = talloc_array(mem_ctx, char, maxlen);
+	}
+
+	if (s == NULL) {
+		return NULL;
+	}
+
+	*s = 0;
+
+	while (len < maxlen-1) {
+		c = getc(f);
+		switch (c)
+		{
+		    case '\r':
+			    break;
+		    case '\n':
+			    while (len > 0 && s[len-1] == ' ') {
+				    s[--len] = 0;
+			    }
+			    if (len > 0 && s[len-1] == '\\') {
+				    s[--len] = 0;
+				    start_of_line = true;
+				    break;
+			    }
+			    return s;
+		    case EOF:
+			    if (len <= 0 && (s2 == NULL)) {
+				    TALLOC_FREE(s);
+			    }
+			    return (len>0) ? s : NULL;
+		    case ' ':
+			    if (start_of_line) {
+				    break;
+			    }
+			    /* fall through */
+		    default:
+			    start_of_line = false;
+			    s[len++] = c;
+			    s[len] = 0;
+		}
+		if ((s2 == NULL) && (len > maxlen-3)) {
+			int m;
+			char *t;
+
+			m = maxlen * 2;
+			if (m < maxlen) {
+				DBG_ERR("length overflow");
+				TALLOC_FREE(s);
+				return NULL;
+			}
+			maxlen = m;
+
+			t = talloc_realloc(mem_ctx, s, char, maxlen);
+			if (t == NULL) {
+				DBG_ERR("failed to expand buffer!\n");
+				TALLOC_FREE(s);
+				return NULL;
+			}
+
+			s = t;
+		}
+	}
+
+	return s;
+}
 
 /**
 load a file into memory from a fd.
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 0a911a2..27d0a55 100755
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -68,7 +68,7 @@ bld.SAMBA_LIBRARY('talloc_report',
                   )
 
 bld.SAMBA_SUBSYSTEM('samba-util-core',
-                    source='''xfile.c data_blob.c util_file.c time.c
+                    source='''data_blob.c util_file.c time.c
                               signal.c util.c idtree.c fault.c
                               substitute.c util_process.c util_strlist.c
                               strv_util.c''',
@@ -123,7 +123,7 @@ else:
                     tevent_debug.c memcache.c unix_match.c''',
                   deps='samba-util-core DYNCONFIG close-low-fd tini tiniparser genrand',
                   public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid systemd systemd-daemon',
-                  public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h string_wrappers.h idtree.h idtree_random.h blocking.h signal.h substitute.h fault.h genrand.h',
+                  public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h string_wrappers.h idtree.h idtree_random.h blocking.h signal.h substitute.h fault.h genrand.h',
                   header_path= [ ('dlinklist.h samba_util.h', '.'), ('*', 'util') ],
                   local_include=False,
                   vnum='0.0.1',
diff --git a/lib/util/xfile.c b/lib/util/xfile.c
deleted file mode 100644
index b22cb98..0000000
--- a/lib/util/xfile.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   stdio replacement
-   Copyright (C) Andrew Tridgell 2001
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file
- * @brief scalable FILE replacement
- */
-
-/*
-  stdio is very convenient, but on some systems the file descriptor
-  in FILE* is 8 bits, so it fails when more than 255 files are open. 
-
-  XFILE replaces stdio. It is less efficient, but at least it works
-  when you have lots of files open
-
-  The main restriction on XFILE is that it doesn't support seeking,
-  and doesn't support O_RDWR. That keeps the code simple.
-*/
-
-#include "replace.h"
-#include "system/filesys.h"
-#include "memory.h"
-#include "xfile.h"
-#include "lib/util/debug.h"
-#include "lib/util/samba_util.h"
-
-#define XBUFSIZE BUFSIZ
-
-static XFILE _x_stdin =  { 0, NULL, NULL, XBUFSIZE, 0, O_RDONLY, X_IOFBF, 0 };
-static XFILE _x_stdout = { 1, NULL, NULL, XBUFSIZE, 0, O_WRONLY, X_IOLBF, 0 };
-static XFILE _x_stderr = { 2, NULL, NULL, 0, 0, O_WRONLY, X_IONBF, 0 };
-
-XFILE *x_stdin = &_x_stdin;
-XFILE *x_stdout = &_x_stdout;
-XFILE *x_stderr = &_x_stderr;
-
-#define X_FLAG_EOF 1
-#define X_FLAG_ERROR 2
-#define X_FLAG_EINVAL 3
-
-/** simulate setvbuf() */
-int x_setvbuf(XFILE *f, char *buf, int mode, size_t size)
-{
-	x_fflush(f);
-	if (f->bufused) return -1;
-
-	/* on files being read full buffering is the only option */
-	if ((f->open_flags & O_ACCMODE) == O_RDONLY) {
-		mode = X_IOFBF;
-	}
-
-	/* destroy any earlier buffer */
-	SAFE_FREE(f->buf);
-	f->buf = 0;
-	f->bufsize = 0;
-	f->next = NULL;
-	f->bufused = 0;
-	f->buftype = mode;
-
-	if (f->buftype == X_IONBF) return 0;
-
-	/* if buffering then we need some size */
-	if (size == 0) size = XBUFSIZE;
-
-	f->bufsize = size;
-	f->bufused = 0;
-
-	return 0;
-}
-
-/* allocate the buffer */
-static int x_allocate_buffer(XFILE *f)
-{
-	if (f->buf) return 1;
-	if (f->bufsize == 0) return 0;
-	f->buf = (char *)malloc(f->bufsize);
-	if (!f->buf) return 0;
-	f->next = f->buf;
-	return 1;
-}
-
-
-/** this looks more like open() than fopen(), but that is quite deliberate.
-   I want programmers to *think* about O_EXCL, O_CREAT etc not just
-   get them magically added 
-*/
-XFILE *x_fopen(const char *fname, int flags, mode_t mode)
-{
-	XFILE *ret;
-
-	ret = (XFILE *)malloc_p(XFILE);
-	if (!ret) return NULL;
-
-	memset(ret, 0, sizeof(XFILE));
-
-	if ((flags & O_ACCMODE) == O_RDWR) {
-		/* we don't support RDWR in XFILE - use file 
-		   descriptors instead */
-		SAFE_FREE(ret);
-		errno = EINVAL;
-		return NULL;
-	}
-
-	ret->open_flags = flags;
-
-	ret->fd = open(fname, flags, mode);
-	if (ret->fd == -1) {
-		SAFE_FREE(ret);
-		return NULL;
-	}
-
-	x_setvbuf(ret, NULL, X_IOFBF, XBUFSIZE);
-	
-	return ret;
-}
-
-/** simulate fclose() */
-int x_fclose(XFILE *f)
-{
-	int ret;
-
-	/* make sure we flush any buffered data */
-	x_fflush(f);
-
-	ret = close(f->fd);
-	f->fd = -1;
-	if (f->buf) {
-		/* make sure data can't leak into a later malloc */
-		memset(f->buf, 0, f->bufsize);
-		SAFE_FREE(f->buf);
-	}
-	/* check the file descriptor given to the function is NOT one of the static
-	 * descriptor of this libreary or we will free unallocated memory
-	 * --sss */
-	if (f != x_stdin && f != x_stdout && f != x_stderr) {
-		SAFE_FREE(f);
-	}
-	return ret;
-}
-
-/** simulate fwrite() */
-size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f)
-{
-	ssize_t ret;
-	size_t total=0;
-
-	/* we might be writing unbuffered */
-	if (f->buftype == X_IONBF || 
-	    (!f->buf && !x_allocate_buffer(f))) {
-		ret = write(f->fd, p, size*nmemb);
-		if (ret == -1) return -1;
-		return ret/size;
-	} 
-
-
-	while (total < size*nmemb) {
-		size_t n = f->bufsize - f->bufused;
-		n = MIN(n, (size*nmemb)-total);
-
-		if (n == 0) {
-			/* it's full, flush it */
-			x_fflush(f);
-			continue;
-		}
-
-		memcpy(f->buf + f->bufused, total+(const char *)p, n);
-		f->bufused += n;
-		total += n;
-	}
-
-	/* when line buffered we need to flush at the last linefeed. This can
-	   flush a bit more than necessary, but that is harmless */
-	if (f->buftype == X_IOLBF && f->bufused) {
-		int i;
-		for (i=(size*nmemb)-1; i>=0; i--) {
-			if (*(i+(const char *)p) == '\n') {
-				x_fflush(f);
-				break;
-			}
-		}
-	}
-
-	return total/size;
-}
-
-/** thank goodness for asprintf() */
- int x_vfprintf(XFILE *f, const char *format, va_list ap)
-{
-	char *p;
-	int len, ret;
-	va_list ap2;
-
-	va_copy(ap2, ap);
-	len = vasprintf(&p, format, ap2);
-	va_end(ap2);
-	if (len <= 0) return len;
-	ret = x_fwrite(p, 1, len, f);
-	SAFE_FREE(p);
-	return ret;
-}
-
- int x_fprintf(XFILE *f, const char *format, ...)
-{
-	va_list ap;
-	int ret;
-
-	va_start(ap, format);
-	ret = x_vfprintf(f, format, ap);
-	va_end(ap);
-	return ret;
-}
-
-/* at least fileno() is simple! */
-int x_fileno(const XFILE *f)
-{
-	return f->fd;
-}
-
-/** simulate fflush() */
-int x_fflush(XFILE *f)
-{
-	int ret;
-
-	if (f->flags & X_FLAG_ERROR) return -1;
-
-	if ((f->open_flags & O_ACCMODE) != O_WRONLY) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (f->bufused == 0) return 0;
-
-	ret = write(f->fd, f->buf, f->bufused);
-	if (ret == -1) return -1;
-	
-	f->bufused -= ret;
-	if (f->bufused > 0) {
-		f->flags |= X_FLAG_ERROR;
-		memmove(f->buf, ret + (char *)f->buf, f->bufused);
-		return -1;
-	}
-
-	return 0;
-}
-
-/** simulate setbuffer() */
-void x_setbuffer(XFILE *f, char *buf, size_t size)
-{
-	x_setvbuf(f, buf, buf?X_IOFBF:X_IONBF, size);
-}
-
-/** simulate setbuf() */
-void x_setbuf(XFILE *f, char *buf)
-{
-	x_setvbuf(f, buf, buf?X_IOFBF:X_IONBF, XBUFSIZE);
-}
-
-/** simulate setlinebuf() */
-void x_setlinebuf(XFILE *f)
-{
-	x_setvbuf(f, NULL, X_IOLBF, 0);
-}
-
-
-/** simulate feof() */
-int x_feof(XFILE *f)
-{
-	if (f->flags & X_FLAG_EOF) return 1;
-	return 0;
-}
-
-/** simulate ferror() */
-int x_ferror(XFILE *f)
-{
-	if (f->flags & X_FLAG_ERROR) return 1;
-	return 0;
-}
-
-/* fill the read buffer */
-static void x_fillbuf(XFILE *f)
-{
-	int n;
-
-	if (f->bufused) return;
-
-	if (!f->buf && !x_allocate_buffer(f)) return;
-
-	n = read(f->fd, f->buf, f->bufsize);
-	if (n <= 0) return;
-	f->bufused = n;
-	f->next = f->buf;
-}
-
-/** simulate fgetc() */
-int x_fgetc(XFILE *f)
-{
-	int ret;
-
-	if (f->flags & (X_FLAG_EOF | X_FLAG_ERROR)) return EOF;
-	
-	if (f->bufused == 0) x_fillbuf(f);
-
-	if (f->bufused == 0) {
-		f->flags |= X_FLAG_EOF;
-		return EOF;
-	}
-
-	ret = *(uint8_t *)(f->next);
-	f->next++;
-	f->bufused--;
-	return ret;
-}
-
-/** simulate fread */
-size_t x_fread(void *p, size_t size, size_t nmemb, XFILE *f)
-{
-	size_t remaining = size * nmemb;
-	size_t total = 0;
-
-	while (remaining > 0) {
-		size_t thistime;
-
-		x_fillbuf(f);
-
-		if (f->bufused == 0) {
-			f->flags |= X_FLAG_EOF;
-			break;
-		}
-
-		thistime = MIN(f->bufused, remaining);
-
-		memcpy((char *)p+total, f->next, thistime);
-
-		f->next += thistime;
-		f->bufused -= thistime;
-		remaining -= thistime;
-		total += thistime;
-	}
-	return total/size;
-}
-
-/** simulate fgets() */
-char *x_fgets(char *s, int size, XFILE *stream) 
-{
-	char *s0 = s;
-	int l = size;
-	while (l>1) {
-		int c = x_fgetc(stream);
-		if (c == EOF) break;
-		*s++ = (char)c;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list