From c8071c3522abefb651596e2335e724ae50cb8a90 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Dec 2007 16:20:44 -0800 Subject: Use the %*s feature of snprintf to remove anothe static fstring. Jeremy. (This used to be commit 4ae4b2358688bf289305a2db0ed01b653ac073b2) --- source3/lib/util.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 73b035b22b..11c14ea538 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2227,17 +2227,12 @@ void dump_data_pw(const char *msg, const uchar * data, size_t len) #endif } -char *tab_depth(int depth) +const char *tab_depth(int level, int depth) { - static fstring spaces; - size_t len = depth * 4; - if (len > sizeof(fstring)-1) { - len = sizeof(fstring)-1; + if( DEBUGLVL(level) ) { + dbgtext("%*s", depth*4, ""); } - - memset(spaces, ' ', len); - spaces[len] = 0; - return spaces; + return ""; } /***************************************************************************** -- cgit From afc93255d183eefb68e45b8ec6275f6a62cf9795 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 26 Dec 2007 17:12:36 -0800 Subject: Add SMB encryption. Still fixing client decrypt but negotiation works. Jeremy. (This used to be commit d78045601af787731f0737b8627450018902b104) --- source3/lib/util.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 11c14ea538..7f8a297fac 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -605,32 +605,30 @@ void show_msg(char *buf) } /******************************************************************* - Set the length and marker of an smb packet. + Set the length and marker of an encrypted smb packet. ********************************************************************/ -void smb_setlen(char *buf,int len) +void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num) { _smb_setlen(buf,len); SCVAL(buf,4,0xFF); - SCVAL(buf,5,'S'); - SCVAL(buf,6,'M'); - SCVAL(buf,7,'B'); + SCVAL(buf,5,'E'); + SSVAL(buf,6,enc_ctx_num); } /******************************************************************* - Setup the word count and byte count for a smb message. + Set the length and marker of an smb packet. ********************************************************************/ -int set_message(char *buf,int num_words,int num_bytes,bool zero) +void smb_setlen(char *buf,int len) { - if (zero && (num_words || num_bytes)) { - memset(buf + smb_size,'\0',num_words*2 + num_bytes); - } - SCVAL(buf,smb_wct,num_words); - SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); - smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); - return (smb_size + num_words*2 + num_bytes); + _smb_setlen(buf,len); + + SCVAL(buf,4,0xFF); + SCVAL(buf,5,'S'); + SCVAL(buf,6,'M'); + SCVAL(buf,7,'B'); } /******************************************************************* @@ -641,20 +639,10 @@ int set_message_bcc(char *buf,int num_bytes) { int num_words = CVAL(buf,smb_wct); SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); - smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); + _smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); return (smb_size + num_words*2 + num_bytes); } -/******************************************************************* - Setup only the byte count for a smb message, using the end of the - message as a marker. -********************************************************************/ - -int set_message_end(void *outbuf,void *end_ptr) -{ - return set_message_bcc((char *)outbuf,PTR_DIFF(end_ptr,smb_buf((char *)outbuf))); -} - /******************************************************************* Add a data blob to the end of a smb_buf, adjusting bcc and smb_len. Return the bytes added -- cgit From 9baa97a46ebb92a5968ceba0fb5c2de51e6fa8f0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 00:23:35 -0800 Subject: Add general '-e' option to enable smb encryption on tools. Jeremy. (This used to be commit 757653966fc1384159bd2d57c5670cd8af0cae96) --- source3/lib/util.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 7f8a297fac..81b9fc817b 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -289,7 +289,8 @@ static struct user_auth_info cmdline_auth_info = { NULL, /* password */ false, /* got_pass */ false, /* use_kerberos */ - Undefined /* signing state */ + Undefined, /* signing state */ + false /* smb_encrypt */ }; const char *get_cmdline_auth_info_username(void) @@ -362,11 +363,22 @@ void set_cmdline_auth_info_use_krb5_ticket(void) cmdline_auth_info.got_pass = true; } +/* This should only be used by lib/popt_common.c JRA */ +bool set_cmdline_auth_info_smb_encrypt(void) +{ + cmdline_auth_info.smb_encrypt = true; +} + bool get_cmdline_auth_info_got_pass(void) { return cmdline_auth_info.got_pass; } +bool get_cmdline_auth_info_smb_encrypt(void) +{ + return cmdline_auth_info.smb_encrypt; +} + bool get_cmdline_auth_info_copy(struct user_auth_info *info) { *info = cmdline_auth_info; -- cgit From 3d7a8a9fa14625279bcce03654465a88afe6db86 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 01:16:09 -0800 Subject: Fix missing return - should be void. Jeremy. (This used to be commit 45ae90b77e53cd0cdf50939528dac4d2ca39b5c5) --- source3/lib/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 81b9fc817b..c69a1450a0 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -364,7 +364,7 @@ void set_cmdline_auth_info_use_krb5_ticket(void) } /* This should only be used by lib/popt_common.c JRA */ -bool set_cmdline_auth_info_smb_encrypt(void) +void set_cmdline_auth_info_smb_encrypt(void) { cmdline_auth_info.smb_encrypt = true; } -- cgit From 02f67cfcfa09245e79ecbe41dfadd04f5418253a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 14:15:48 +0100 Subject: Add free_local_machine_name(). Guenther (This used to be commit f3ebb4f96bb0364dae9924e798652e759b63bb52) --- source3/lib/util.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index c69a1450a0..25b2700ae3 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -183,6 +183,7 @@ void gfree_names(void) SAFE_FREE( smb_myworkgroup ); SAFE_FREE( smb_scope ); free_netbios_names_array(); + free_local_machine_name(); } void gfree_all( void ) -- cgit From 5661ac6a389620ac543a384832de9ee9b64893c7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 13:30:43 +0100 Subject: Correctly abstract the transfer_file mechanism with callbacks and void ptrs. This removes the in_fsp and out_fsp global variables hack from smbd/vfs.c. Michael (This used to be commit b2e7cdc6e899ca3c16edbb6c8786ff9aa999fa6e) --- source3/lib/util.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 25b2700ae3..3509294e8e 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -905,8 +905,12 @@ int set_blocking(int fd, bool set) #define TRANSFER_BUF_SIZE 65536 #endif -ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn)(int, void *, size_t), - ssize_t (*write_fn)(int, const void *, size_t)) + +ssize_t transfer_file_internal(void *in_file, + void *out_file, + size_t n, + ssize_t (*read_fn)(void *, void *, size_t), + ssize_t (*write_fn)(void *, void *, size_t)) { char *buf; size_t total = 0; @@ -921,7 +925,7 @@ ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn) while (total < n) { num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE); - read_ret = (*read_fn)(infd, buf, num_to_read_thistime); + read_ret = (*read_fn)(in_file, buf, num_to_read_thistime); if (read_ret == -1) { DEBUG(0,("transfer_file_internal: read failure. Error = %s\n", strerror(errno) )); SAFE_FREE(buf); @@ -933,7 +937,7 @@ ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn) num_written = 0; while (num_written < read_ret) { - write_ret = (*write_fn)(outfd,buf + num_written, read_ret - num_written); + write_ret = (*write_fn)(out_file, buf + num_written, read_ret - num_written); if (write_ret == -1) { DEBUG(0,("transfer_file_internal: write failure. Error = %s\n", strerror(errno) )); @@ -953,9 +957,23 @@ ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn) return (ssize_t)total; } +static ssize_t sys_read_fn(void *file, void *buf, size_t len) +{ + int *fd = (int *)file; + + return sys_read(*fd, buf, len); +} + +static ssize_t sys_write_fn(void *file, void *buf, size_t len) +{ + int *fd = (int *)file; + + return sys_read(*fd, buf, len); +} + SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n) { - return (SMB_OFF_T)transfer_file_internal(infd, outfd, (size_t)n, sys_read, sys_write); + return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, sys_read_fn, sys_write_fn); } /******************************************************************* -- cgit From 9f6d0479d795ca4f8d91a3e170f66e29cf16a16b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 14:18:46 +0100 Subject: Fix a really silly typo. Michael (This used to be commit 7b0af7cdc97d4bbcbd73a9474871217511b92c3a) --- source3/lib/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 3509294e8e..d635078f37 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -968,7 +968,7 @@ static ssize_t sys_write_fn(void *file, void *buf, size_t len) { int *fd = (int *)file; - return sys_read(*fd, buf, len); + return sys_write(*fd, buf, len); } SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n) -- cgit From 386caead47e97b9fdc991b713cb597f1a1c4a365 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 13:55:46 +0100 Subject: Reformat some code I just touched. Michael (This used to be commit 4ed238b1e46f7680a29ebdbfe9500d16718f9057) --- source3/lib/util.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index d635078f37..44eaa85ab0 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -919,34 +919,41 @@ ssize_t transfer_file_internal(void *in_file, size_t num_to_read_thistime; size_t num_written = 0; - if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL) + if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL) { return -1; + } while (total < n) { num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE); read_ret = (*read_fn)(in_file, buf, num_to_read_thistime); if (read_ret == -1) { - DEBUG(0,("transfer_file_internal: read failure. Error = %s\n", strerror(errno) )); + DEBUG(0,("transfer_file_internal: read failure. " + "Error = %s\n", strerror(errno) )); SAFE_FREE(buf); return -1; } - if (read_ret == 0) + if (read_ret == 0) { break; + } num_written = 0; - + while (num_written < read_ret) { - write_ret = (*write_fn)(out_file, buf + num_written, read_ret - num_written); - + write_ret = (*write_fn)(out_file, buf + num_written, + read_ret - num_written); + if (write_ret == -1) { - DEBUG(0,("transfer_file_internal: write failure. Error = %s\n", strerror(errno) )); + DEBUG(0,("transfer_file_internal: " + "write failure. Error = %s\n", + strerror(errno) )); SAFE_FREE(buf); return -1; } - if (write_ret == 0) + if (write_ret == 0) { return (ssize_t)total; - + } + num_written += (size_t)write_ret; } @@ -954,7 +961,7 @@ ssize_t transfer_file_internal(void *in_file, } SAFE_FREE(buf); - return (ssize_t)total; + return (ssize_t)total; } static ssize_t sys_read_fn(void *file, void *buf, size_t len) @@ -971,9 +978,10 @@ static ssize_t sys_write_fn(void *file, void *buf, size_t len) return sys_write(*fd, buf, len); } -SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n) +SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n) { - return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, sys_read_fn, sys_write_fn); + return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, + sys_read_fn, sys_write_fn); } /******************************************************************* -- cgit From ba2a2552822ded95358c11972005f2c353580439 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 14:27:52 +0100 Subject: Move transfer_file and transfer_file_internal to a module of their own. Also, don't auto-generate prototypes of the (two) exported functions but make a start in having handwritten prototypes in dedicated header files (not in includes.h ... :-) Michael (This used to be commit 395f29d8b768a56af20b37f185eccdc5f37b68d5) --- source3/lib/util.c | 87 ------------------------------------------------------ 1 file changed, 87 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 44eaa85ab0..0653fc9d3f 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -897,93 +897,6 @@ int set_blocking(int fd, bool set) #undef FLAG_TO_SET } -/**************************************************************************** - Transfer some data between two fd's. -****************************************************************************/ - -#ifndef TRANSFER_BUF_SIZE -#define TRANSFER_BUF_SIZE 65536 -#endif - - -ssize_t transfer_file_internal(void *in_file, - void *out_file, - size_t n, - ssize_t (*read_fn)(void *, void *, size_t), - ssize_t (*write_fn)(void *, void *, size_t)) -{ - char *buf; - size_t total = 0; - ssize_t read_ret; - ssize_t write_ret; - size_t num_to_read_thistime; - size_t num_written = 0; - - if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL) { - return -1; - } - - while (total < n) { - num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE); - - read_ret = (*read_fn)(in_file, buf, num_to_read_thistime); - if (read_ret == -1) { - DEBUG(0,("transfer_file_internal: read failure. " - "Error = %s\n", strerror(errno) )); - SAFE_FREE(buf); - return -1; - } - if (read_ret == 0) { - break; - } - - num_written = 0; - - while (num_written < read_ret) { - write_ret = (*write_fn)(out_file, buf + num_written, - read_ret - num_written); - - if (write_ret == -1) { - DEBUG(0,("transfer_file_internal: " - "write failure. Error = %s\n", - strerror(errno) )); - SAFE_FREE(buf); - return -1; - } - if (write_ret == 0) { - return (ssize_t)total; - } - - num_written += (size_t)write_ret; - } - - total += (size_t)read_ret; - } - - SAFE_FREE(buf); - return (ssize_t)total; -} - -static ssize_t sys_read_fn(void *file, void *buf, size_t len) -{ - int *fd = (int *)file; - - return sys_read(*fd, buf, len); -} - -static ssize_t sys_write_fn(void *file, void *buf, size_t len) -{ - int *fd = (int *)file; - - return sys_write(*fd, buf, len); -} - -SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n) -{ - return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, - sys_read_fn, sys_write_fn); -} - /******************************************************************* Sleep for a specified number of milliseconds. ********************************************************************/ -- cgit From 68694369fc96354452979b07425f3f48c4f73bbe Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:09:48 +0300 Subject: Merge CTDB-related fixes from samba-ctdb 3.0 branch (http://samba.org/~tridge/3_0-ctdb) Signed-off-by: Alexander Bokovoy (This used to be commit 0c8e23afbbb2d081fc23908bafcad04650bfacea) --- source3/lib/util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 0653fc9d3f..bc3eaa8d5e 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -505,6 +505,19 @@ bool file_exist(const char *fname,SMB_STRUCT_STAT *sbuf) return((S_ISREG(sbuf->st_mode)) || (S_ISFIFO(sbuf->st_mode))); } +/******************************************************************* + Check if a unix domain socket exists - call vfs_file_exist for samba files. +********************************************************************/ + +bool socket_exist(const char *fname) +{ + SMB_STRUCT_STAT st; + if (sys_stat(fname,&st) != 0) + return(False); + + return S_ISSOCK(st.st_mode); +} + /******************************************************************* Check a files mod time. ********************************************************************/ -- cgit From 2411c6cb90e485bd289b8b654db1c632556bfb2d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 23:10:09 +0100 Subject: Add "split_ntfs_stream_name()" together with a torture test (This used to be commit d813bd9e02d9baf916eb96c478be89f0c435e07c) --- source3/lib/util.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index bc3eaa8d5e..11f3660df8 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -3273,3 +3273,93 @@ void *talloc_zeronull(const void *context, size_t size, const char *name) return talloc_named_const(context, size, name); } #endif + +/* Split a path name into filename and stream name components. Canonicalise + * such that an implicit $DATA token is always explicit. + * + * The "specification" of this function can be found in the + * run_local_stream_name() function in torture.c, I've tried those + * combinations against a W2k3 server. + */ + +NTSTATUS split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname, + char **pbase, char **pstream) +{ + char *base = NULL; + char *stream = NULL; + char *sname; /* stream name */ + const char *stype; /* stream type */ + + DEBUG(10, ("split_ntfs_stream_name called for [%s]\n", fname)); + + sname = strchr_m(fname, ':'); + + if (lp_posix_pathnames() || (sname == NULL)) { + if (pbase != NULL) { + base = talloc_strdup(mem_ctx, fname); + NT_STATUS_HAVE_NO_MEMORY(base); + } + goto done; + } + + if (pbase != NULL) { + base = talloc_strndup(mem_ctx, fname, PTR_DIFF(sname, fname)); + NT_STATUS_HAVE_NO_MEMORY(base); + } + + sname += 1; + + stype = strchr_m(sname, ':'); + + if (stype == NULL) { + sname = talloc_strdup(mem_ctx, sname); + stype = "$DATA"; + } + else { + if (StrCaseCmp(stype, ":$DATA") != 0) { + /* + * If there is an explicit stream type, so far we only + * allow $DATA. Is there anything else allowed? -- vl + */ + DEBUG(10, ("[%s] is an invalid stream type\n", stype)); + TALLOC_FREE(base); + return NT_STATUS_OBJECT_NAME_INVALID; + } + sname = talloc_strndup(mem_ctx, sname, PTR_DIFF(stype, sname)); + stype += 1; + } + + if (sname == NULL) { + TALLOC_FREE(base); + return NT_STATUS_NO_MEMORY; + } + + if (sname[0] == '\0') { + /* + * no stream name, so no stream + */ + goto done; + } + + if (pstream != NULL) { + stream = talloc_asprintf(mem_ctx, "%s:%s", sname, stype); + if (stream == NULL) { + TALLOC_FREE(sname); + TALLOC_FREE(base); + return NT_STATUS_NO_MEMORY; + } + /* + * upper-case the type field + */ + strupper_m(strchr_m(stream, ':')+1); + } + + done: + if (pbase != NULL) { + *pbase = base; + } + if (pstream != NULL) { + *pstream = stream; + } + return NT_STATUS_OK; +} -- cgit From a60b913a37d577d6bb52fbdb0987eb7c9ea9edcc Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 23 Jan 2008 00:30:28 +0100 Subject: Fix tab_depth: it should not create an extra debug header. In pstring removal 4ae4b23586, the behaviour of tab_depth was changed to create an extra debug header (by using the DEBUGLVL macro). This extracts the debug level check from DEBUGLVL into a macro CHECK_DEBUGLVL without the debug header creation and uses this instead of DEBUGLVL in tab_depth. Michael (This used to be commit cbc7d921fa696e6c3c5197ad9f87442ba679df82) --- source3/lib/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 11f3660df8..e5ac3752f5 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2182,7 +2182,7 @@ void dump_data_pw(const char *msg, const uchar * data, size_t len) const char *tab_depth(int level, int depth) { - if( DEBUGLVL(level) ) { + if( CHECK_DEBUGLVL(level) ) { dbgtext("%*s", depth*4, ""); } return ""; -- cgit From 54db1839878641be1a9987ad3e0ddedbd6123b7c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 27 Jan 2008 17:31:56 +1100 Subject: Adding missing calls to va_end(). Just a small commit to get a handle on this git thingy. This patch fixes some missing calls to va_end() to match various calls to va_start() and VA_COPY(). Tim. (This used to be commit ec367f307dff7948722b9ac97beb960efd91991f) --- source3/lib/util.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index e5ac3752f5..dba7142bad 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2431,6 +2431,7 @@ char *smb_xstrndup(const char *s, size_t n) if (n == -1 || ! *ptr) { smb_panic("smb_xvasprintf: out of memory"); } + va_end(ap2); return n; } -- cgit