[SCM] Samba Shared Repository - branch master updated
The branch, master has been updated via 0ee1985... [Bug 7345] Incomplete description of function return values in libsmbclient.h from 59d6889... s3: Use sizeof(chal) instead of a constant http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 0ee1985b05bd1a650f712a6d458b20c31eae8734 Author: Derrell Lipman derr...@dworkin.(none) Date: Sun Apr 11 11:37:00 2010 -0400 [Bug 7345] Incomplete description of function return values in libsmbclient.h - Fixed documentation on smbc_fstat(), smbc_statvfs(), and smbc_fstatvfs(): All were missing return value upon success - Fixed documentation on smbc_read: Documented return value upon EOF Derrell --- Summary of changes: source3/include/libsmbclient.h | 22 ++ 1 files changed, 14 insertions(+), 8 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index dd6f93e..978f657 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -1267,13 +1267,15 @@ int smbc_creat(const char *furl, mode_t mode); * * @param bufsize Size of buf in bytes * - * @return Number of bytes read, 0 on error with errno set: + * @return Number of bytes read; + * 0 upon EOF; + * 0 on error, with errno set: * - EISDIR fd refers to a directory * - EBADF fd is not a valid file descriptor or - * is not open for reading. + *is not open for reading. * - EINVAL fd is attached to an object which is - * unsuitable for reading, or no buffer passed or - * smbc_init not called. + *unsuitable for reading, or no buffer passed or + * smbc_init not called. * * @see smbc_open(), smbc_write() * @@ -1618,7 +1620,8 @@ int smbc_stat(const char *url, struct stat *st); * @param stpointer to a buffer that will be filled with * standard Unix struct stat information. * - * @return EBADF filedes is bad. + * @return 0 on success, 0 on error with errno set: + * - EBADF filedes is bad. * - EACCES Permission denied. * - EBADF fd is not a valid file descriptor * - EINVAL Problems occurred in the underlying routines @@ -1639,7 +1642,8 @@ int smbc_fstat(int fd, struct stat *st); * @param stpointer to a buffer that will be filled with * standard Unix struct statvfs information. * - * @return EBADF filedes is bad. + * @return 0 on success, 0 on error with errno set: + * - EBADF filedes is bad. * - EACCES Permission denied. * - EBADF fd is not a valid file descriptor * - EINVAL Problems occurred in the underlying routines @@ -1662,7 +1666,8 @@ smbc_statvfs(char *url, * @param stpointer to a buffer that will be filled with * standard Unix struct statvfs information. * - * @return EBADF filedes is bad. + * @return 0 on success, 0 on error with errno set: + * - EBADF filedes is bad. * - EACCES Permission denied. * - EBADF fd is not a valid file descriptor * - EINVAL Problems occurred in the underlying routines @@ -1684,7 +1689,8 @@ smbc_fstatvfs(int fd, * * @param size size to truncate the file to * - * @return EBADF filedes is bad. + * @return 0 on success, 0 on error with errno set: + * - EBADF filedes is bad. * - EACCES Permission denied. * - EBADF fd is not a valid file descriptor * - EINVAL Problems occurred in the underlying routines -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1597-ge03b9ae
The branch, master has been updated via e03b9ae609a3ef856c483832332e307975a1bf0a (commit) from 652251701df7dec1401eab9b1dbc7e3ac5c7e7ad (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit e03b9ae609a3ef856c483832332e307975a1bf0a Author: Derrell Lipman derr...@dworkin.(none) Date: Wed May 13 09:49:59 2009 -0400 Allow a parameter to smb_thread_once's initialization function - This should make life easier for ourselves. We're no longer constrained to the semantics of pthread_once, so let's allow passing a parameter to the initialization function. Some of Samba's init functions return a value. Although I haven't searched, I suspect that some of the init functions require in input parameters. The parameter added here can be used for input, output, or both, as necessary... or ignored, as is now done in talloc_stackframe_init(). Derrell --- Summary of changes: lib/util/smb_threads.c | 23 +-- lib/util/smb_threads.h |4 +++- lib/util/smb_threads_internal.h | 12 ++-- lib/util/talloc_stack.c |4 ++-- 4 files changed, 28 insertions(+), 15 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/smb_threads.c b/lib/util/smb_threads.c index e2d01f7..ffe2eb0 100644 --- a/lib/util/smb_threads.c +++ b/lib/util/smb_threads.c @@ -105,33 +105,44 @@ int smb_thread_set_functions(const struct smb_thread_functions *tf) implementation's once type. / -int smb_thread_once(smb_thread_once_t *ponce, void (*init_fn)(void)) +int smb_thread_once(smb_thread_once_t *ponce, +void (*init_fn)(void *pdata), +void *pdata) { int ret; /* Lock our once mutex in order to test and initialize ponce */ - if ((ret = SMB_THREAD_LOCK(once_mutex, SMB_THREAD_LOCK)) != 0) { + if (SMB_THREAD_LOCK(once_mutex, SMB_THREAD_LOCK) != 0) { smb_panic(error locking 'once'); } +/* Keep track of whether we ran their init function */ +ret = ! *ponce; + /* * See if another thread got here after we tested it initially but * before we got our lock. */ if (! *ponce) { /* Nope, we need to run the initialization function */ -(*init_fn)(); +(*init_fn)(pdata); /* Now we can indicate that the function has been run */ *ponce = true; } /* Unlock the mutex */ - if ((ret = SMB_THREAD_LOCK(once_mutex, SMB_THREAD_UNLOCK)) != 0) { + if (SMB_THREAD_LOCK(once_mutex, SMB_THREAD_UNLOCK) != 0) { smb_panic(error unlocking 'once'); } - - return 0; + +/* + * Tell 'em whether we ran their init function. If they passed a data + * pointer to the init function and the init function could change + * something in the pointed-to data, this will tell them whether that + * data is valid or not. + */ + return ret; } diff --git a/lib/util/smb_threads.h b/lib/util/smb_threads.h index 5079b17..809673a 100644 --- a/lib/util/smb_threads.h +++ b/lib/util/smb_threads.h @@ -52,7 +52,9 @@ struct smb_thread_functions { }; int smb_thread_set_functions(const struct smb_thread_functions *tf); -int smb_thread_once(smb_thread_once_t *ponce, void (*init_fn)(void)); +int smb_thread_once(smb_thread_once_t *ponce, +void (*init_fn)(void *pdata), +void *pdata); extern const struct smb_thread_functions *global_tfp; diff --git a/lib/util/smb_threads_internal.h b/lib/util/smb_threads_internal.h index 29a581b..038c584 100644 --- a/lib/util/smb_threads_internal.h +++ b/lib/util/smb_threads_internal.h @@ -33,12 +33,12 @@ #define SMB_THREAD_LOCK(plock, type) \ (global_tfp ? global_tfp-lock_mutex((plock), (type), __location__) : 0) -#define SMB_THREAD_ONCE(ponce, init_fn) \ -(global_tfp \ - ? (! *(ponce) \ -? smb_thread_once((ponce), (init_fn)) \ -: 0)\ - : ((init_fn()), 0)) +#define SMB_THREAD_ONCE(ponce, init_fn, pdata) \ +(global_tfp \ + ? (! *(ponce) \ +? smb_thread_once((ponce), (init_fn), (pdata)) \ +: 0)\ + : ((init_fn(pdata)), 0)) #define SMB_THREAD_CREATE_TLS(keyname, key) \ (global_tfp ? global_tfp-create_tls
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1604-g636fbd1
The branch, master has been updated via 636fbd1028bf22d9a93ae5029f6881e144f58fe1 (commit) via 045af600f299f55f5a5b09a23b753ba97880aa06 (commit) via 088906b0641e48c704c5cd529f620023616f561f (commit) from b9f3a78169be962c4f1fce625ca3a291d9f93c7c (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 636fbd1028bf22d9a93ae5029f6881e144f58fe1 Author: Derrell Lipman derr...@dworkin.(none) Date: Wed May 13 14:37:17 2009 -0400 Thread-safe protection: libsmbclient initialization - Begin converting init functions to use SMB_THREAD_ONCE. libsmbclient module-wide initialization is now moved into a separate function and called via SMB_THREAD_ONCE. - libsmbclient counts users (contexts) so that it can release global resources when the last context is closed. That count of contexts is now protected by a mutex. Derrell commit 045af600f299f55f5a5b09a23b753ba97880aa06 Author: Derrell Lipman derr...@dworkin.(none) Date: Wed May 13 14:33:21 2009 -0400 Take advantage of the easier-to-use thread macros - Now that we initialize for the non-thread-safe case in the macro, there's no need to do it here too. Derrell commit 088906b0641e48c704c5cd529f620023616f561f Author: Derrell Lipman derr...@dworkin.(none) Date: Wed May 13 14:31:40 2009 -0400 Make the thread functions a bit easier to use - Create separate macros for lock and unlock so that it's easier to identify which request is being made. - Initialize *ponce in the SMB_THREAD_ONCE macro in the non-thread-safe case, rather than requiring each init function to determine if it's in the non-thread-safe case and manually initialize. Derrell --- Summary of changes: lib/util/smb_threads.c |6 +- lib/util/smb_threads.h |2 - lib/util/smb_threads_internal.h | 12 ++- lib/util/talloc_stack.c |8 -- source3/libsmb/libsmb_context.c | 227 +++ 5 files changed, 145 insertions(+), 110 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/smb_threads.c b/lib/util/smb_threads.c index ffe2eb0..58ea2da 100644 --- a/lib/util/smb_threads.c +++ b/lib/util/smb_threads.c @@ -43,7 +43,7 @@ void **global_lock_array; Mutex used for our internal once function */ -void *once_mutex = NULL; +static void *once_mutex = NULL; /* @@ -112,7 +112,7 @@ int smb_thread_once(smb_thread_once_t *ponce, int ret; /* Lock our once mutex in order to test and initialize ponce */ - if (SMB_THREAD_LOCK(once_mutex, SMB_THREAD_LOCK) != 0) { + if (SMB_THREAD_LOCK(once_mutex) != 0) { smb_panic(error locking 'once'); } @@ -132,7 +132,7 @@ int smb_thread_once(smb_thread_once_t *ponce, } /* Unlock the mutex */ - if (SMB_THREAD_LOCK(once_mutex, SMB_THREAD_UNLOCK) != 0) { + if (SMB_THREAD_UNLOCK(once_mutex) != 0) { smb_panic(error unlocking 'once'); } diff --git a/lib/util/smb_threads.h b/lib/util/smb_threads.h index 809673a..9a09616 100644 --- a/lib/util/smb_threads.h +++ b/lib/util/smb_threads.h @@ -22,8 +22,6 @@ typedef bool smb_thread_once_t; #define SMB_THREAD_ONCE_INIT false -#define SMB_THREAD_ONCE_IS_INITIALIZED(val) ((val) == true) -#define SMB_THREAD_ONCE_INITIALIZE(val) ((val) = true) enum smb_thread_lock_type { SMB_THREAD_LOCK = 1, diff --git a/lib/util/smb_threads_internal.h b/lib/util/smb_threads_internal.h index 038c584..afd7559 100644 --- a/lib/util/smb_threads_internal.h +++ b/lib/util/smb_threads_internal.h @@ -30,15 +30,21 @@ }; \ } while (0) -#define SMB_THREAD_LOCK(plock, type) \ - (global_tfp ? global_tfp-lock_mutex((plock), (type), __location__) : 0) +#define SMB_THREAD_LOCK_INTERNAL(plock, type, location) \ + (global_tfp ? global_tfp-lock_mutex((plock), (type), location) : 0) + +#define SMB_THREAD_LOCK(plock) \ +SMB_THREAD_LOCK_INTERNAL(plock, SMB_THREAD_LOCK, __location__) + +#define SMB_THREAD_UNLOCK(plock) \ +SMB_THREAD_LOCK_INTERNAL(plock, SMB_THREAD_UNLOCK, __location__) #define SMB_THREAD_ONCE(ponce, init_fn, pdata) \ (global_tfp \ ? (! *(ponce) \ ? smb_thread_once((ponce), (init_fn), (pdata)) \ : 0)\ - : ((init_fn(pdata)), 0)) + : ((init_fn(pdata)), *(ponce) = true, 1)) #define SMB_THREAD_CREATE_TLS(keyname, key) \ (global_tfp
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1605-ga13ba43
The branch, master has been updated via a13ba4347f92afc63497991210bc59e6bd2434d0 (commit) from 636fbd1028bf22d9a93ae5029f6881e144f58fe1 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit a13ba4347f92afc63497991210bc59e6bd2434d0 Author: Derrell Lipman derr...@dworkin.(none) Date: Wed May 13 14:51:43 2009 -0400 What to do about debugging in a multi-threaded application? - For now, punt. Any thread that requests debug to stderr will establish that for all threads. Derrell --- Summary of changes: source3/libsmb/libsmb_context.c | 17 ++--- 1 files changed, 10 insertions(+), 7 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index 03cd00d..bacd907 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -48,13 +48,6 @@ SMBC_module_init(void * punused) setup_logging(libsmbclient, True); -#if 0 /* need a place to put this (thread local storage) */ -if (context-internal-debug_stderr) { -dbf = x_stderr; -x_setbuf(x_stderr, NULL); -} -#endif - /* Here we would open the smb.conf file if needed ... */ lp_set_in_client(True); @@ -553,6 +546,16 @@ smbc_init_context(SMBCCTX *context) return NULL; } +if (context-internal-debug_stderr) { +/* + * Hmmm... Do we want a unique dbf per-thread? For now, we'll just + * leave it up to the user. If any one context spefies debug to + * stderr then all will be. + */ +dbf = x_stderr; +x_setbuf(x_stderr, NULL); +} + if ((!smbc_getFunctionAuthData(context) !smbc_getFunctionAuthDataWithContext(context)) || smbc_getDebug(context) 0 || -- Samba Shared Repository
Re: [SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1567-g3fa6943
On Tue, May 12, 2009 at 12:02 PM, Volker Lendecke vlen...@samba.org wrote: - Log - commit 3fa69438b9fafc13d522720e188e82455856fc1d Author: Volker Lendecke v...@samba.org Date: Tue May 12 17:47:22 2009 +0200 Convert response.extra_data.data from malloc to talloc /* Must copy domain into response first for debugging in parent */ @@ -519,8 +517,8 @@ enum winbindd_result winbindd_dual_list_users(struct winbindd_domain *domain, /* Allocate some memory for extra data. Note that we limit account names to sizeof(fstring) = 256 characters. +1 for the ',' between group names */ - extra_data = (char *)SMB_REALLOC(extra_data, - (sizeof(fstring) + 1) * num_entries); + extra_data = talloc_array(state-mem_ctx, char, + (sizeof(fstring) + 1) * num_entries); It looks like previously, extra_data could already contain some data which was then realloc'ed to add more space, whereas now you always overwrite extra_data each time. Is that correct? Is this potentially losing previously initialized data that needs to stick around? Derrell
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1586-g8a60c26
The branch, master has been updated via 8a60c26c7cb788fe181fb8db10e454b96dda23a9 (commit) from 3627ceb5e25cdecd1a8113a5028cc898a1424349 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 8a60c26c7cb788fe181fb8db10e454b96dda23a9 Author: Derrell Lipman derr...@dworkin.(none) Date: Tue May 12 21:22:23 2009 -0400 Fix broken smb_thread_once function - We can't set *ponce=true before running the function because although other threads wouldn't re-run the initialization function, they could potentially proceed beyond the initialization point while the first thread was still running the initialization function. If a second thread gets to an SMB_THREAD_ONCE() call while one with the same ponce is running, we need to ensure that it enters smb_thread_once() to await the mutex and then recheck whether *ponce is set or not. My original comment about other once functions possibly being called from within this once function is irrelevant since those other ones would have their own unique ponce. Derrell --- Summary of changes: lib/util/smb_threads.c | 22 +++--- 1 files changed, 3 insertions(+), 19 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/smb_threads.c b/lib/util/smb_threads.c index 0407976..6f84a2e 100644 --- a/lib/util/smb_threads.c +++ b/lib/util/smb_threads.c @@ -108,29 +108,19 @@ int smb_thread_set_functions(const struct smb_thread_functions *tf) int smb_thread_once(smb_thread_once_t *ponce, void (*init_fn)(void)) { int ret; -bool need_func_call; /* Lock our once mutex in order to test and initialize ponce */ if ((ret = SMB_THREAD_LOCK(once_mutex, SMB_THREAD_LOCK)) != 0) { smb_panic(error locking 'once'); } -/* Store whether we're going to need to issue the function call */ -need_func_call = ! *ponce; - /* * See if another thread got here after we tested it initially but * before we got our lock. */ -if (need_func_call) { -/* - * Nope, we still need to issue the call. Set the once - * variable to true now so we can unlock the mutex. (We don't - * want to leave it locked during the call to the - * initialization function in case there's yet another once - * function needed to be called from therein.) - */ -*ponce = true; +if (! *ponce) { +/* Nope, we need to run the initialization function */ +(*init_fn)(); } /* Unlock the mutex */ @@ -138,12 +128,6 @@ int smb_thread_once(smb_thread_once_t *ponce, void (*init_fn)(void)) smb_panic(error unlocking 'once'); } -/* Finally, if we need to call the user-provided function, ... */ -if (need_func_call) { -/* ... then do so now. */ -(*init_fn)(); -} - return 0; } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1587-g7c39e45
The branch, master has been updated via 7c39e450fc4216e1138e4f30d2c1e2b6ba3854a8 (commit) from 8a60c26c7cb788fe181fb8db10e454b96dda23a9 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 7c39e450fc4216e1138e4f30d2c1e2b6ba3854a8 Author: Derrell Lipman derr...@dworkin.(none) Date: Tue May 12 21:32:33 2009 -0400 Fix broken smb_thread_once function (again) - It would help if smb_thread_once did, eventually, set the variable that prevents the init function from being run again. Sigh. It must be getting late. Derrell --- Summary of changes: lib/util/smb_threads.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/smb_threads.c b/lib/util/smb_threads.c index 6f84a2e..e2d01f7 100644 --- a/lib/util/smb_threads.c +++ b/lib/util/smb_threads.c @@ -121,6 +121,9 @@ int smb_thread_once(smb_thread_once_t *ponce, void (*init_fn)(void)) if (! *ponce) { /* Nope, we need to run the initialization function */ (*init_fn)(); + +/* Now we can indicate that the function has been run */ +*ponce = true; } /* Unlock the mutex */ -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1546-gbd9d4e5
The branch, master has been updated via bd9d4e5212a4c1fcdf28d2abcee3ad24a27f2d03 (commit) from 6d1e21bd1b38e8a3c7df3f7fdb8a17fcdd997d42 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit bd9d4e5212a4c1fcdf28d2abcee3ad24a27f2d03 Author: Derrell Lipman derr...@dworkin.(none) Date: Mon May 11 14:16:52 2009 -0400 Correct typos; semicolons instead of commas --- Summary of changes: source3/include/libsmbclient.h | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index 3b38b30..7de5000 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -2783,24 +2783,24 @@ smbc_thread_impl( /* Mutex functions. */ int (*create_mutex)(const char *lockname, void **pplock, -const char *location); +const char *location), void (*destroy_mutex)(void *plock, - const char *location); + const char *location), int (*lock_mutex)(void *plock, int lock_type, - const char *location); + const char *location), /* Thread local storage. */ int (*create_tls)(const char *keyname, void **ppkey, - const char *location); + const char *location), void (*destroy_tls)(void **ppkey, -const char *location); +const char *location), int (*set_tls)(void *pkey, const void *pval, - const char *location); + const char *location), void *(*get_tls)(void *pkey, - const char *location); + const char *location) ); -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1530-g404327a
The branch, master has been updated via 404327ad41c5f24f9ace5cad31509149d87197fd (commit) via db69ebcbcebbd3882d2eee7df8de15c3dc9c309b (commit) via 418a2eeae8912d14e32b0119232b897e78221037 (commit) via d3434477e6d42432a0acf426fcfbe39eb11b1fd0 (commit) from 831b73ec82717c3c73ea1250f9c94228d251c1ec (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 404327ad41c5f24f9ace5cad31509149d87197fd Author: Derrell Lipman derr...@dworkin.(none) Date: Sun May 10 22:40:20 2009 -0400 Panic upon mutex lock or unlock failure - It's a serious error if we can't lock or unlock a mutex in smb_thread_once(). Panic instead of just displaying a DEBUG message. Derrell commit db69ebcbcebbd3882d2eee7df8de15c3dc9c309b Author: Derrell Lipman derr...@dworkin.(none) Date: Sun May 10 22:31:37 2009 -0400 Provide a libsmbclient interface for programs requiring threads - This adds two functions: smbc_thread_posix() which provides access to the internal threading implementation using pthread; and smbc_thread_impl() where the user provides each of the functions required by Samba, to give access to the thread implementation's native capabilities. Derrell commit 418a2eeae8912d14e32b0119232b897e78221037 Author: Derrell Lipman derr...@dworkin.(none) Date: Sun May 10 22:27:54 2009 -0400 Don't require external use of internal enum smb_thread_lock_type - Internally, when locking or unlocking a mutex, we'll pass one of the values of enum smb_thread_lock_type. That enum is not available to users providing a thread implementation. Externally, we'll document the integer values which will be passed to their lock_mutex function, but not require them to access our internal header file. Derrell commit d3434477e6d42432a0acf426fcfbe39eb11b1fd0 Author: Derrell Lipman derr...@dworkin.(none) Date: Sun May 10 21:55:23 2009 -0400 Replace external thread once with an internal implementation Jeremy, please check... - I'm in the process of providing an interface in libsmbclient to the recently-added threading capabilities. In the process, I discovered that different thread implementations have varying types for the variable passed to the thread_impl_once() function. pthreads, for example, uses type pthread_once_t. Since Samba needs to internally declare these variables, it would need to know the exact type required by each thread implementation's function. After considering multiple methods of obtaining an appropriately sized variable, I decided that for the basic once functionality required by Samba, it would be much simpler to just implement our own once functionality. We don't require cancellation points et all. This commit adds an smb_thread_once() function that is implemented using an internal mutex. The mutex itself uses the implementation's create_mutex function. This eliminates the need for the user to provide a smb_thread_once function pointer and the entire issue of that function's first parameter. Derrell --- Summary of changes: lib/util/smb_threads.c | 64 +- lib/util/smb_threads.h | 29 ++-- lib/util/smb_threads_internal.h |2 +- source3/Makefile.in |4 +- source3/include/libsmbclient.h | 109 + source3/libsmb/libsmb_thread_impl.c | 127 ++ source3/libsmb/libsmb_thread_posix.c | 49 + 7 files changed, 358 insertions(+), 26 deletions(-) create mode 100644 source3/libsmb/libsmb_thread_impl.c create mode 100644 source3/libsmb/libsmb_thread_posix.c Changeset truncated at 500 lines: diff --git a/lib/util/smb_threads.c b/lib/util/smb_threads.c index 1998211..132ad48 100644 --- a/lib/util/smb_threads.c +++ b/lib/util/smb_threads.c @@ -40,6 +40,13 @@ const struct smb_thread_functions *global_tfp; void **global_lock_array; /* + Mutex used for our internal once function +*/ + +void *once_mutex = NULL; + + +/* Function to set the locking primitives used by libsmbclient. */ @@ -80,9 +87,64 @@ int smb_thread_set_functions(const struct smb_thread_functions *tf) SAFE_FREE(name); } +/* Create the mutex we'll use for our once function */ + if (SMB_THREAD_CREATE_MUTEX(smb_once, once_mutex) != 0) { + smb_panic(smb_thread_set_functions: failed to create 'once' mutex
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1531-g9a93dc0
The branch, master has been updated via 9a93dc092c6951cdfa6e05c3885a006e5e56d7d3 (commit) from 404327ad41c5f24f9ace5cad31509149d87197fd (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 9a93dc092c6951cdfa6e05c3885a006e5e56d7d3 Author: Derrell Lipman derr...@dworkin.(none) Date: Sun May 10 22:58:12 2009 -0400 Optimize smb_thread_once usage by not calling it if known already called - The macro SMB_THREAD_ONCE now tests whether the once variable is already set, and if so avoids calling smb_thread_once(). Derrell --- Summary of changes: lib/util/smb_threads_internal.h |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/smb_threads_internal.h b/lib/util/smb_threads_internal.h index 0260934..29a581b 100644 --- a/lib/util/smb_threads_internal.h +++ b/lib/util/smb_threads_internal.h @@ -33,8 +33,12 @@ #define SMB_THREAD_LOCK(plock, type) \ (global_tfp ? global_tfp-lock_mutex((plock), (type), __location__) : 0) -#define SMB_THREAD_ONCE(ponce, init_fn) \ - (global_tfp ? smb_thread_once((ponce), (init_fn)) : ((init_fn()), 0)) +#define SMB_THREAD_ONCE(ponce, init_fn) \ +(global_tfp \ + ? (! *(ponce) \ +? smb_thread_once((ponce), (init_fn)) \ +: 0)\ + : ((init_fn()), 0)) #define SMB_THREAD_CREATE_TLS(keyname, key) \ (global_tfp ? global_tfp-create_tls((keyname), (key), __location__) : 0) -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1532-g915518c
The branch, master has been updated via 915518c0db30689f3508736238a9e8bb8ab03088 (commit) from 9a93dc092c6951cdfa6e05c3885a006e5e56d7d3 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 915518c0db30689f3508736238a9e8bb8ab03088 Author: Derrell Lipman derr...@dworkin.(none) Date: Sun May 10 23:04:00 2009 -0400 Use bool instead of int for a boolean variable --- Summary of changes: lib/util/smb_threads.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/smb_threads.c b/lib/util/smb_threads.c index 132ad48..22afcd3 100644 --- a/lib/util/smb_threads.c +++ b/lib/util/smb_threads.c @@ -107,7 +107,7 @@ int smb_thread_set_functions(const struct smb_thread_functions *tf) void smb_thread_once(smb_thread_once_t *ponce, void (*init_fn)(void)) { int ret; -int need_func_call; +bool need_func_call; /* Lock our once mutex in order to test and initialize ponce */ if ((ret = SMB_THREAD_LOCK(once_mutex, SMB_THREAD_LOCK)) != 0) { -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1289-g641e125
The branch, master has been updated via 641e12561ad863f8bff8c3a98485a010c138ec30 (commit) from 65527216f1289f366d83beb936a668b32cf44d38 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 641e12561ad863f8bff8c3a98485a010c138ec30 Author: Derrell Lipman derr...@dworkin.(none) Date: Mon Apr 27 09:27:52 2009 -0400 [FIX Bug 6235] domain enumeration breaks if master browser has space in name Jeremy: please review to ensure this doesn't appear to break anything The function name_status_find() is documented as used for finding a server's name given its IP address. It was, however, looking for the first matching name which could be a group name at times. This fix ensures that group names are skipped when scanning for a matching name. Derrell --- Summary of changes: source3/libsmb/namequery.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 19d89ce..50fb9f1 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -408,7 +408,8 @@ bool name_status_find(const char *q_name, goto done; for (i=0;icount;i++) { - if (status[i].type == type) +/* Find first one of the requested type that's not a GROUP. */ + if (status[i].type == type ! (status[i].flags 0x80)) break; } if (i == count) -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-770-g21ad907
The branch, master has been updated via 21ad907aa01d839d405b10809517d491b72184da (commit) via c33f3d5cba21c8cf267daab5450bc95ea7e68967 (commit) from 4b88f2c17e18f87d8ba0e35e057d7bb8a27614dd (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 21ad907aa01d839d405b10809517d491b72184da Author: Derrell Lipman derr...@dworkin.(none) Date: Fri Mar 27 18:03:00 2009 -0400 Ensure parameter types match format string commit c33f3d5cba21c8cf267daab5450bc95ea7e68967 Author: Derrell Lipman derr...@dworkin.(none) Date: Fri Mar 27 18:02:46 2009 -0400 [Bug 6228] SMBC_open_ctx failure due to path resolve failure doesn't set errno Fixed. It turns out there were a number of places where cli_resolve_path() was called and the error path upon that function failing did not set errno. There were a couple of places the failure handling code did set errno to ENOENT, so I made them all consistent, although I think better errno choices for this condition exist, e.g. EHOSTUNREACH. Derrell --- Summary of changes: examples/libsmbclient/testbrowse.c |2 +- examples/libsmbclient/testfstatvfs.c | 21 ++--- examples/libsmbclient/testsmbc.c | 12 +--- examples/libsmbclient/teststatvfs.c | 21 ++--- source3/libsmb/libsmb_dir.c |8 +++- source3/libsmb/libsmb_file.c |7 +++ source3/libsmb/libsmb_stat.c |1 + 7 files changed, 53 insertions(+), 19 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/testbrowse.c b/examples/libsmbclient/testbrowse.c index a6e6395..c3fb394 100644 --- a/examples/libsmbclient/testbrowse.c +++ b/examples/libsmbclient/testbrowse.c @@ -197,7 +197,7 @@ get_auth_data_with_context_fn(SMBCCTX * context, char * pPassword, int maxLenPassword) { -printf(Authenticating with context 0x%lx, context); +printf(Authenticating with context %p, context); if (context != NULL) { char *user_data = smbc_getOptionUserData(context); printf( with user data %s, user_data); diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c index b4dafef..73f42d4 100644 --- a/examples/libsmbclient/testfstatvfs.c +++ b/examples/libsmbclient/testfstatvfs.c @@ -75,13 +75,20 @@ int main(int argc, char * argv[]) printf(\n); printf(Block Size: %lu\n, statvfsbuf.f_bsize); printf(Fragment Size: %lu\n, statvfsbuf.f_frsize); -printf(Blocks: %llu\n, statvfsbuf.f_blocks); -printf(Free Blocks: %llu\n, statvfsbuf.f_bfree); -printf(Available Blocks: %llu\n, statvfsbuf.f_bavail); -printf(Files : %llu\n, statvfsbuf.f_files); -printf(Free Files: %llu\n, statvfsbuf.f_ffree); -printf(Available Files: %llu\n, statvfsbuf.f_favail); -printf(File System ID: %lu\n, statvfsbuf.f_fsid); +printf(Blocks: %llu\n, + (unsigned long long) statvfsbuf.f_blocks); +printf(Free Blocks: %llu\n, + (unsigned long long) statvfsbuf.f_bfree); +printf(Available Blocks: %llu\n, + (unsigned long long) statvfsbuf.f_bavail); +printf(Files : %llu\n, + (unsigned long long) statvfsbuf.f_files); +printf(Free Files: %llu\n, + (unsigned long long) statvfsbuf.f_ffree); +printf(Available Files: %llu\n, + (unsigned long long) statvfsbuf.f_favail); +printf(File System ID: %lu\n, + (unsigned long) statvfsbuf.f_fsid); printf(\n); printf(Flags: 0x%lx\n, statvfsbuf.f_flag); diff --git a/examples/libsmbclient/testsmbc.c b/examples/libsmbclient/testsmbc.c index 1f06437..de42428 100644 --- a/examples/libsmbclient/testsmbc.c +++ b/examples/libsmbclient/testsmbc.c @@ -21,6 +21,7 @@ #include stdio.h #include errno.h +#include time.h #include sys/time.h #include string.h #include unistd.h @@ -33,8 +34,12 @@ int global_id = 0; void print_list_fn(struct print_job_info *pji) { - fprintf(stdout, Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n, - pji-id, pji-priority, pji-size, pji-user, pji-name); + fprintf(stdout, Print job: ID: %u, Prio: %u, Size: %lu, User: %s, Name: %s\n, + pji-id, + pji-priority, + (unsigned long) pji-size, + pji-user, + pji-name); global_id = pji-id; @@ -137,7 +142,8 @@ int main(int argc, char *argv[]) } - fprintf(stdout, Wrote %d bytes to file: %s\n, sizeof(buff), buff); + fprintf(stdout, Wrote %lu bytes to file: %s\n, + (unsigned long
[SCM] Samba Shared Repository - branch v3-4-test updated - release-4-0-0alpha7-594-g63d9694
The branch, v3-4-test has been updated via 63d9694d7a0198375fba3a713d6e5d3bbed7a458 (commit) via ebc4c0b50db16cdb11222c3d536a211bb86bcdfd (commit) from 0d7a37be40d7748cb8d685af5412624678b27208 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test - Log - commit 63d9694d7a0198375fba3a713d6e5d3bbed7a458 Author: Derrell Lipman derr...@dworkin.(none) Date: Fri Mar 27 18:01:39 2009 -0400 Ensure parameter types match format string commit ebc4c0b50db16cdb11222c3d536a211bb86bcdfd Author: Derrell Lipman derr...@dworkin.(none) Date: Fri Mar 27 17:59:09 2009 -0400 [Bug 6228] SMBC_open_ctx failure due to path resolve failure doesn't set errno Fixed. It turns out there were a number of places where cli_resolve_path() was called and the error path upon that function failing did not set errno. There were a couple of places the failure handling code did set errno to ENOENT, so I made them all consistent, although I think better errno choices for this condition exist, e.g. EHOSTUNREACH. Derrell --- Summary of changes: examples/libsmbclient/testbrowse.c |2 +- examples/libsmbclient/testfstatvfs.c | 21 ++--- examples/libsmbclient/testsmbc.c | 12 +--- examples/libsmbclient/teststatvfs.c | 21 ++--- source3/libsmb/libsmb_dir.c |8 +++- source3/libsmb/libsmb_file.c |7 +++ source3/libsmb/libsmb_stat.c |1 + 7 files changed, 53 insertions(+), 19 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/testbrowse.c b/examples/libsmbclient/testbrowse.c index a6e6395..c3fb394 100644 --- a/examples/libsmbclient/testbrowse.c +++ b/examples/libsmbclient/testbrowse.c @@ -197,7 +197,7 @@ get_auth_data_with_context_fn(SMBCCTX * context, char * pPassword, int maxLenPassword) { -printf(Authenticating with context 0x%lx, context); +printf(Authenticating with context %p, context); if (context != NULL) { char *user_data = smbc_getOptionUserData(context); printf( with user data %s, user_data); diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c index b4dafef..73f42d4 100644 --- a/examples/libsmbclient/testfstatvfs.c +++ b/examples/libsmbclient/testfstatvfs.c @@ -75,13 +75,20 @@ int main(int argc, char * argv[]) printf(\n); printf(Block Size: %lu\n, statvfsbuf.f_bsize); printf(Fragment Size: %lu\n, statvfsbuf.f_frsize); -printf(Blocks: %llu\n, statvfsbuf.f_blocks); -printf(Free Blocks: %llu\n, statvfsbuf.f_bfree); -printf(Available Blocks: %llu\n, statvfsbuf.f_bavail); -printf(Files : %llu\n, statvfsbuf.f_files); -printf(Free Files: %llu\n, statvfsbuf.f_ffree); -printf(Available Files: %llu\n, statvfsbuf.f_favail); -printf(File System ID: %lu\n, statvfsbuf.f_fsid); +printf(Blocks: %llu\n, + (unsigned long long) statvfsbuf.f_blocks); +printf(Free Blocks: %llu\n, + (unsigned long long) statvfsbuf.f_bfree); +printf(Available Blocks: %llu\n, + (unsigned long long) statvfsbuf.f_bavail); +printf(Files : %llu\n, + (unsigned long long) statvfsbuf.f_files); +printf(Free Files: %llu\n, + (unsigned long long) statvfsbuf.f_ffree); +printf(Available Files: %llu\n, + (unsigned long long) statvfsbuf.f_favail); +printf(File System ID: %lu\n, + (unsigned long) statvfsbuf.f_fsid); printf(\n); printf(Flags: 0x%lx\n, statvfsbuf.f_flag); diff --git a/examples/libsmbclient/testsmbc.c b/examples/libsmbclient/testsmbc.c index 1f06437..de42428 100644 --- a/examples/libsmbclient/testsmbc.c +++ b/examples/libsmbclient/testsmbc.c @@ -21,6 +21,7 @@ #include stdio.h #include errno.h +#include time.h #include sys/time.h #include string.h #include unistd.h @@ -33,8 +34,12 @@ int global_id = 0; void print_list_fn(struct print_job_info *pji) { - fprintf(stdout, Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n, - pji-id, pji-priority, pji-size, pji-user, pji-name); + fprintf(stdout, Print job: ID: %u, Prio: %u, Size: %lu, User: %s, Name: %s\n, + pji-id, + pji-priority, + (unsigned long) pji-size, + pji-user, + pji-name); global_id = pji-id; @@ -137,7 +142,8 @@ int main(int argc, char *argv[]) } - fprintf(stdout, Wrote %d bytes to file: %s\n, sizeof(buff), buff); + fprintf(stdout, Wrote %lu bytes to file: %s\n, + (unsigned long
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-5177-gb24583e
The branch, v3-3-test has been updated via b24583e17ac845d327e1f20f4c6f30215bb3815e (commit) via d72271908e0d67eb31fbc1d818d6f2c720bd7fbb (commit) from 58d3ec1cb81d6086d65cd12acd16cd591cf0c71f (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit b24583e17ac845d327e1f20f4c6f30215bb3815e Merge: d72271908e0d67eb31fbc1d818d6f2c720bd7fbb 58d3ec1cb81d6086d65cd12acd16cd591cf0c71f Author: Derrell Lipman derr...@dworkin.(none) Date: Fri Mar 27 18:03:36 2009 -0400 Merge branch 'v3-3-test' of ssh://git.samba.org/data/git/samba into v3-3-test commit d72271908e0d67eb31fbc1d818d6f2c720bd7fbb Author: Derrell Lipman derr...@dworkin.(none) Date: Fri Mar 27 16:56:33 2009 -0400 [Bug 6228] SMBC_open_ctx failure due to path resolve failure doesn't set errno Fixed. It turns out there were a number of places where cli_resolve_path() was called and the error path upon that function failing did not set errno. There were a couple of places the failure handling code did set errno to ENOENT, so I made them all consistent, although I think better errno choices for this condition exist, e.g. EHOSTUNREACH. Derrell --- Summary of changes: source/libsmb/libsmb_dir.c |8 +++- source/libsmb/libsmb_file.c |7 +++ source/libsmb/libsmb_stat.c |1 + 3 files changed, 15 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c index 89782ce..8846abb 100644 --- a/source/libsmb/libsmb_dir.c +++ b/source/libsmb/libsmb_dir.c @@ -1169,7 +1169,8 @@ SMBC_mkdir_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); - TALLOC_FREE(frame); +errno = ENOENT; +TALLOC_FREE(frame); return -1; } /*d_printf(mkdir: resolved path as %s\n, targetpath);*/ @@ -1276,6 +1277,7 @@ SMBC_rmdir_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -1558,6 +1560,7 @@ SMBC_chmod_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -1749,6 +1752,7 @@ SMBC_unlink_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -1921,6 +1925,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext, if (!cli_resolve_path(frame, , srv-cli, path1, targetcli1, targetpath1)) { d_printf(Could not resolve %s\n, path1); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -1936,6 +1941,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext, if (!cli_resolve_path(frame, , srv-cli, path2, targetcli2, targetpath2)) { d_printf(Could not resolve %s\n, path2); +errno = ENOENT; TALLOC_FREE(frame); return -1; } diff --git a/source/libsmb/libsmb_file.c b/source/libsmb/libsmb_file.c index 1bbb47d..8741ed6 100644 --- a/source/libsmb/libsmb_file.c +++ b/source/libsmb/libsmb_file.c @@ -118,6 +118,7 @@ SMBC_open_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; SAFE_FREE(file); TALLOC_FREE(frame); return NULL; @@ -298,6 +299,7 @@ SMBC_read_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , file-srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -387,6 +389,7 @@ SMBC_write_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , file-srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3528-gf4e68b0
The branch, v3-2-test has been updated via f4e68b09a6ba30d968bccfad8bf6b67b4456b111 (commit) from 52fe104996439db24a7e6b17baa7fec47ba230bb (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit f4e68b09a6ba30d968bccfad8bf6b67b4456b111 Author: Derrell Lipman derr...@dworkin.(none) Date: Fri Mar 27 17:10:04 2009 -0400 [Bug 6228] SMBC_open_ctx failure due to path resolve failure doesn't set errno Fixed. It turns out there were a number of places where cli_resolve_path() was called and the error path upon that function failing did not set errno. There were a couple of places the failure handling code did set errno to ENOENT, so I made them all consistent, although I think better errno choices for this condition exist, e.g. EHOSTUNREACH. Derrell --- Summary of changes: source/libsmb/libsmb_dir.c |8 +++- source/libsmb/libsmb_file.c |7 +++ source/libsmb/libsmb_stat.c |1 + 3 files changed, 15 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c index b0762e8..8ce660a 100644 --- a/source/libsmb/libsmb_dir.c +++ b/source/libsmb/libsmb_dir.c @@ -1168,7 +1168,8 @@ SMBC_mkdir_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); - TALLOC_FREE(frame); +errno = ENOENT; +TALLOC_FREE(frame); return -1; } /*d_printf(mkdir: resolved path as %s\n, targetpath);*/ @@ -1275,6 +1276,7 @@ SMBC_rmdir_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -1738,6 +1740,8 @@ SMBC_unlink_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -1904,6 +1908,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext, if (!cli_resolve_path(frame, , srv-cli, path1, targetcli1, targetpath1)) { d_printf(Could not resolve %s\n, path1); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -1912,6 +1917,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext, if (!cli_resolve_path(frame, , srv-cli, path2, targetcli2, targetpath2)) { d_printf(Could not resolve %s\n, path2); +errno = ENOENT; TALLOC_FREE(frame); return -1; } diff --git a/source/libsmb/libsmb_file.c b/source/libsmb/libsmb_file.c index 27b7e4f..a8c2629 100644 --- a/source/libsmb/libsmb_file.c +++ b/source/libsmb/libsmb_file.c @@ -118,6 +118,7 @@ SMBC_open_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; SAFE_FREE(file); TALLOC_FREE(frame); return NULL; @@ -298,6 +299,7 @@ SMBC_read_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , file-srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -387,6 +389,7 @@ SMBC_write_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , file-srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -462,6 +465,7 @@ SMBC_close_ctx(SMBCCTX *context, if (!cli_resolve_path(frame, , file-srv-cli, path, targetcli, targetpath)) { d_printf(Could not resolve %s\n, path); +errno = ENOENT; TALLOC_FREE(frame); return -1; } @@ -544,6 +548,7 @@ SMBC_getatr(SMBCCTX * context, if (!cli_resolve_path(frame, , srv-cli, fixedpath, targetcli, targetpath)) { d_printf(Couldn't resolve %s\n, path); +errno
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-5010-g53fea3a
The branch, v3-3-test has been updated via 53fea3a7aef481151c3a15d01481cb0f11ae2e8b (commit) from 1bfdbb093f7c5e434ea3e653d389e1ccec578af6 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 53fea3a7aef481151c3a15d01481cb0f11ae2e8b Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Tue Feb 24 09:49:21 2009 -0500 Make char* parameters const - Use const in function signatures whenever appropriate, to help prevent errant scribbling on users' buffers. smbc_set_credentials() always acted as if its formal parameters were const char *, and changing the formal declaration to specify that should not cause any change to the ABI. It is still allowable to pass a writable buffer to a function which specifies that it will not write to the buffer. Derrell --- Summary of changes: source/include/libsmbclient.h |8 source/libsmb/libsmb_context.c | 22 ++ 2 files changed, 10 insertions(+), 20 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 8c642b1..869aeb6 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -2677,11 +2677,11 @@ smbc_version(void); */ void -smbc_set_credentials(char *workgroup, - char *user, - char *password, +smbc_set_credentials(const char *workgroup, + const char *user, + const char *password, smbc_bool use_kerberos, - char *signing_state); + const char *signing_state); /* * Wrapper around smbc_set_credentials. diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c index 90f18ac..ec16311 100644 --- a/source/libsmb/libsmb_context.c +++ b/source/libsmb/libsmb_context.c @@ -630,11 +630,11 @@ smbc_version(void) * Set the credentials so DFS will work when following referrals. */ void -smbc_set_credentials(char *workgroup, - char *user, - char *password, +smbc_set_credentials(const char *workgroup, + const char *user, + const char *password, smbc_bool use_kerberos, - char *signing_state) + const char *signing_state) { set_cmdline_auth_info_username(user); @@ -675,18 +675,8 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context, signing_state = force; } - /* Using CONST_DISCARD here is ugly, but -* we know that smbc_set_credentials() doesn't -* actually modify the strings, and should have -* been const from the start. We're constrained -* by the ABI here. -*/ - - smbc_set_credentials(CONST_DISCARD(char *,workgroup), -CONST_DISCARD(char *,user), -CONST_DISCARD(char *,password), -use_kerberos, -CONST_DISCARD(char *,signing_state)); + smbc_set_credentials(workgroup, user, password, + use_kerberos, signing_state); if (smbc_getOptionFallbackAfterKerberos(context)) { cli_cm_set_fallback_after_kerberos(); -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-1097-gcf7539a
The branch, master has been updated via cf7539abfb0f6e6956bed7a478e0cda6ab734674 (commit) from ca24822234d9dc77dbe3f351d6dbab5558efac39 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit cf7539abfb0f6e6956bed7a478e0cda6ab734674 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Mon Feb 23 13:50:11 2009 -0500 Make char* parameters const - Use const in function signatures whenever appropriate, to help prevent errant scribbling on users' buffers. smbc_set_credentials() always acted as if its formal parameters were const char *, and changing the formal declaration to specify that should not cause any change to the ABI. It is still allowable to pass a writable buffer to a function which specifies that it will not write to the buffer. I'm making this change only in master. Derrell --- Summary of changes: source3/include/libsmbclient.h |8 source3/libsmb/libsmb_context.c | 22 ++ 2 files changed, 10 insertions(+), 20 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index 8c642b1..869aeb6 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -2677,11 +2677,11 @@ smbc_version(void); */ void -smbc_set_credentials(char *workgroup, - char *user, - char *password, +smbc_set_credentials(const char *workgroup, + const char *user, + const char *password, smbc_bool use_kerberos, - char *signing_state); + const char *signing_state); /* * Wrapper around smbc_set_credentials. diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index c7c9903..4c12d18 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -630,11 +630,11 @@ smbc_version(void) * Set the credentials so DFS will work when following referrals. */ void -smbc_set_credentials(char *workgroup, - char *user, - char *password, +smbc_set_credentials(const char *workgroup, + const char *user, + const char *password, smbc_bool use_kerberos, - char *signing_state) + const char *signing_state) { struct user_auth_info *auth_info; @@ -681,18 +681,8 @@ void smbc_set_credentials_with_fallback(SMBCCTX *context, signing_state = force; } - /* Using CONST_DISCARD here is ugly, but -* we know that smbc_set_credentials() doesn't -* actually modify the strings, and should have -* been const from the start. We're constrained -* by the ABI here. -*/ - - smbc_set_credentials(CONST_DISCARD(char *,workgroup), -CONST_DISCARD(char *,user), -CONST_DISCARD(char *,password), -use_kerberos, -CONST_DISCARD(char *,signing_state)); + smbc_set_credentials(workgroup, user, password, + use_kerberos, signing_state); if (smbc_getOptionFallbackAfterKerberos(context)) { cli_cm_set_fallback_after_kerberos(); -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4997-gf84fd04
The branch, v3-3-test has been updated via f84fd046fcff6c3310ef595fb3e4cbe774703d2a (commit) via 8457e7bba4ef2ba479340829bb89a3a8772f958b (commit) from 8c978a66168fd22c817e0710d7a70daf7d07b1ab (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit f84fd046fcff6c3310ef595fb3e4cbe774703d2a Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Feb 20 10:03:55 2009 -0500 variable grouping: just my OCD desire to keep similar things together commit 8457e7bba4ef2ba479340829bb89a3a8772f958b Author: Bo Yang boy...@novell.com Date: Fri Feb 20 12:21:52 2009 +0800 Make libsmbclient work with DFS Signed-off-by: Derrell Lipman derrell.lip...@unwireduniverse.com --- Summary of changes: source/include/libsmbclient.h | 12 source/libsmb/libsmb_context.c | 39 +++ source/libsmb/libsmb_dir.c | 27 +-- source/libsmb/libsmb_file.c|2 +- source/libsmb/libsmb_path.c| 15 ++- source/libsmb/libsmb_server.c | 19 ++- source/libsmb/libsmb_stat.c|2 +- 7 files changed, 110 insertions(+), 6 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index f8a6c8a..efc471c 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -2683,6 +2683,18 @@ smbc_set_credentials(char *workgroup, smbc_bool use_kerberos, char *signing_state); +/* + * Wrapper around smbc_set_credentials. + * Used to set correct credentials that will + * be used to connect to DFS target share + * in libsmbclient + */ + +void +smbc_set_credentials_with_fallback(SMBCCTX *ctx, + char *workgroup, + char *user, + char *password); /** * @ingroup structure diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c index 3f8e0c5..489cc01 100644 --- a/source/libsmb/libsmb_context.c +++ b/source/libsmb/libsmb_context.c @@ -646,3 +646,42 @@ smbc_set_credentials(char *workgroup, set_global_myworkgroup(workgroup); cli_cm_set_credentials(); } + +void smbc_set_credentials_with_fallback(SMBCCTX *context, + char *workgroup, + char *user, + char *password) +{ + smbc_bool use_kerberos = false; + const char *signing_state = off; + + if (!context || + ! workgroup || ! *workgroup || + ! user || ! *user || + ! password || ! *password) { + + return; + } + + if (smbc_getOptionUseKerberos(context)) { + use_kerberos = True; + } + + if (lp_client_signing()) { + signing_state = on; + } + + if (lp_client_signing() == Required) { + signing_state = force; + } + + smbc_set_credentials(workgroup, +user, +password, +use_kerberos, +(char *)signing_state); + + if (smbc_getOptionFallbackAfterKerberos(context)) { + cli_cm_set_fallback_after_kerberos(); + } +} diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c index 761b805..610cfcd 100644 --- a/source/libsmb/libsmb_dir.c +++ b/source/libsmb/libsmb_dir.c @@ -1501,6 +1501,8 @@ SMBC_chmod_ctx(SMBCCTX *context, char *user = NULL; char *password = NULL; char *workgroup = NULL; + char *targetpath = NULL; + struct cli_state *targetcli = NULL; char *path = NULL; uint16 mode; TALLOC_CTX *frame = talloc_stackframe(); @@ -1551,6 +1553,14 @@ SMBC_chmod_ctx(SMBCCTX *context, TALLOC_FREE(frame); return -1; /* errno set by SMBC_server */ } + + /*d_printf(unlink: resolving %s\n, path);*/ + if (!cli_resolve_path(frame, , srv-cli, path, + targetcli, targetpath)) { + d_printf(Could not resolve %s\n, path); + TALLOC_FREE(frame); + return -1; + } mode = 0; @@ -1559,8 +1569,8 @@ SMBC_chmod_ctx(SMBCCTX *context, if ((newmode S_IXGRP) lp_map_system(-1)) mode |= aSYSTEM; if ((newmode S_IXOTH) lp_map_hidden(-1)) mode |= aHIDDEN; - if (!cli_setatr(srv-cli, path, mode, 0)) { - errno = SMBC_errno(context, srv-cli); + if (!cli_setatr(targetcli, targetpath, mode, 0)) { + errno = SMBC_errno(context, targetcli); TALLOC_FREE(frame
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-1030-g45630c4
The branch, master has been updated via 45630c47fcc1ab96264d816313475af405079db3 (commit) via e256d72f0cd66c374f14a122623668de888aa5e7 (commit) from 27307be0f726c899c0e8a0edfdf200650037bb61 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 45630c47fcc1ab96264d816313475af405079db3 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Feb 20 09:51:36 2009 -0500 variable grouping: just my OCD desire to keep similar things together commit e256d72f0cd66c374f14a122623668de888aa5e7 Author: Bo Yang boy...@novell.com Date: Fri Feb 20 12:00:46 2009 +0800 Make libsmbclient work with DFS Signed-off-by: Derrell Lipman derrell.lip...@unwireduniverse.com --- Summary of changes: source3/include/libsmbclient.h | 12 source3/libsmb/libsmb_context.c | 39 +++ source3/libsmb/libsmb_dir.c | 27 +-- source3/libsmb/libsmb_file.c|2 +- source3/libsmb/libsmb_path.c| 15 ++- source3/libsmb/libsmb_server.c | 19 ++- source3/libsmb/libsmb_stat.c|2 +- 7 files changed, 110 insertions(+), 6 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index f8a6c8a..efc471c 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -2683,6 +2683,18 @@ smbc_set_credentials(char *workgroup, smbc_bool use_kerberos, char *signing_state); +/* + * Wrapper around smbc_set_credentials. + * Used to set correct credentials that will + * be used to connect to DFS target share + * in libsmbclient + */ + +void +smbc_set_credentials_with_fallback(SMBCCTX *ctx, + char *workgroup, + char *user, + char *password); /** * @ingroup structure diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index c1af485..e4df7fc 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -652,3 +652,42 @@ smbc_set_credentials(char *workgroup, cli_cm_set_credentials(auth_info); TALLOC_FREE(auth_info); } + +void smbc_set_credentials_with_fallback(SMBCCTX *context, + char *workgroup, + char *user, + char *password) +{ + smbc_bool use_kerberos = false; + const char *signing_state = off; + + if (! context || + ! workgroup || ! *workgroup || + ! user || ! *user || + ! password || ! *password) { + + return; + } + + if (smbc_getOptionUseKerberos(context)) { + use_kerberos = True; + } + + if (lp_client_signing()) { + signing_state = on; + } + + if (lp_client_signing() == Required) { + signing_state = force; + } + + smbc_set_credentials(workgroup, +user, +password, +use_kerberos, +(char *)signing_state); + + if (smbc_getOptionFallbackAfterKerberos(context)) { + cli_cm_set_fallback_after_kerberos(); + } +} diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index e9b7b4f..1843fe2 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -1500,6 +1500,8 @@ SMBC_chmod_ctx(SMBCCTX *context, char *user = NULL; char *password = NULL; char *workgroup = NULL; + char *targetpath = NULL; + struct cli_state *targetcli = NULL; char *path = NULL; uint16 mode; TALLOC_CTX *frame = talloc_stackframe(); @@ -1550,6 +1552,14 @@ SMBC_chmod_ctx(SMBCCTX *context, TALLOC_FREE(frame); return -1; /* errno set by SMBC_server */ } + + /*d_printf(unlink: resolving %s\n, path);*/ + if (!cli_resolve_path(frame, , srv-cli, path, + targetcli, targetpath)) { + d_printf(Could not resolve %s\n, path); + TALLOC_FREE(frame); + return -1; + } mode = 0; @@ -1558,8 +1568,8 @@ SMBC_chmod_ctx(SMBCCTX *context, if ((newmode S_IXGRP) lp_map_system(-1)) mode |= aSYSTEM; if ((newmode S_IXOTH) lp_map_hidden(-1)) mode |= aHIDDEN; - if (!cli_setatr(srv-cli, path, mode, 0)) { - errno = SMBC_errno(context, srv-cli); + if (!cli_setatr(targetcli, targetpath, mode, 0)) { + errno = SMBC_errno(context, targetcli); TALLOC_FREE(frame
Re: [SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4999-g07c7085
On Fri, Feb 20, 2009 at 7:41 PM, Jeremy Allison j...@samba.org wrote: - smbc_set_credentials(workgroup, -user, -password, + /* Using CONST_DISCARD here is ugly, but +* we know that smbc_set_credentials() doesn't +* actually modify the strings, and should have +* been const from the start. We're constrained +* by the ABI here. +*/ + + smbc_set_credentials(CONST_DISCARD(char *,workgroup), +CONST_DISCARD(char *,user), +CONST_DISCARD(char *,password), use_kerberos, -(char *)signing_state); +CONST_DISCARD(char *,signing_state)); Jeremy, this is fugly. Would you please either convince me that changing smbc_set_credentials to have const parameters would, in fact, change the ABI (it is my contention that it does not), or let's remove this crap and add const to the smbc_set_credentials parameters. Thanks. Derrell
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4963-gf11d4d0
The branch, v3-3-test has been updated via f11d4d088c17db77ba259972c05de72da0d3ac93 (commit) from c0aa23d119737bbb197eaadaa2eedc853b5179a1 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit f11d4d088c17db77ba259972c05de72da0d3ac93 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sun Feb 15 15:00:25 2009 -0500 Remove compiler warnings about unknown structure pointer --- Summary of changes: source/include/libsmbclient.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index a3a5d70..f8a6c8a 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -75,6 +75,7 @@ extern C { /* Make sure we have the following includes for now ... */ #include sys/types.h #include sys/stat.h +#include sys/statvfs.h #include fcntl.h #include utime.h -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4956-gf5e5dae
The branch, v3-3-test has been updated via f5e5daeb8fd6133211dfbc4f4b309d5432dddb16 (commit) via 4d2598282bb9f0c08da9f949ff23ff253c0ca7ac (commit) from 31d854fff40799f056748333c35df81466c3614c (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit f5e5daeb8fd6133211dfbc4f4b309d5432dddb16 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 09:43:46 2009 -0500 ignore new test program executables commit 4d2598282bb9f0c08da9f949ff23ff253c0ca7ac Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 09:42:59 2009 -0500 Check for the right error return value --- Summary of changes: .gitignore |2 ++ source/libsmb/libsmb_stat.c |5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) Changeset truncated at 500 lines: diff --git a/.gitignore b/.gitignore index edb1b3d..acaf24e 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,8 @@ examples/libsmbclient/teststat3 examples/libsmbclient/testutime examples/libsmbclient/testwrite examples/libsmbclient/testtruncate +examples/libsmbclient/testfstatvfs +examples/libsmbclient/teststatvfs examples/libsmbclient/tree examples/libsmbclient/Makefile.internal source/librpc/gen_ndr/cli_krb5pac.* diff --git a/source/libsmb/libsmb_stat.c b/source/libsmb/libsmb_stat.c index bfcacdc..38a4441 100644 --- a/source/libsmb/libsmb_stat.c +++ b/source/libsmb/libsmb_stat.c @@ -323,13 +323,14 @@ SMBC_statvfs_ctx(SMBCCTX *context, /* Is it a file or a directory? */ if (S_ISDIR(statbuf.st_mode)) { /* It's a directory. */ -if ((pFile = SMBC_opendir_ctx(context, path)) 0) { +if ((pFile = SMBC_opendir_ctx(context, path)) == NULL) { return -1; } bIsDir = true; } else if (S_ISREG(statbuf.st_mode)) { /* It's a file. */ -if ((pFile = SMBC_open_ctx(context, path, O_RDONLY, 0)) 0) { +if ((pFile = SMBC_open_ctx(context, path, + O_RDONLY, 0)) == NULL) { return -1; } bIsDir = false; -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-894-gc2661ae
The branch, master has been updated via c2661aec24f244c1cf94dca02592b3410b9b6f31 (commit) via 352c97561e9de6ccd0102859d18ed15913042622 (commit) via 1c9630bf4df4315e0c7b72ac126c43b49f499834 (commit) from 6c07b9b7e7f65f4c5b0e347147ed60117c85c6f5 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit c2661aec24f244c1cf94dca02592b3410b9b6f31 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 09:41:55 2009 -0500 Check for the right error return value commit 352c97561e9de6ccd0102859d18ed15913042622 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Feb 13 16:47:54 2009 -0500 [Bug 6069] Add a fstatvfs function for libsmbclient - Revert Tim's changes for the moment. I need to see what the issue is and arrange to use struct statvfs if at all possible. Derrell commit 1c9630bf4df4315e0c7b72ac126c43b49f499834 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Feb 13 16:42:26 2009 -0500 ignore new test program executables --- Summary of changes: .gitignore |2 ++ examples/libsmbclient/testfstatvfs.c |3 ++- examples/libsmbclient/teststatvfs.c |3 ++- source3/include/libsmb_internal.h|4 ++-- source3/include/libsmbclient.h | 25 + source3/libsmb/libsmb_compat.c |4 ++-- source3/libsmb/libsmb_stat.c |9 + 7 files changed, 20 insertions(+), 30 deletions(-) Changeset truncated at 500 lines: diff --git a/.gitignore b/.gitignore index 703f7e3..f1440ca 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,8 @@ examples/libsmbclient/testtruncate examples/libsmbclient/testutime examples/libsmbclient/testwrite examples/libsmbclient/tree +examples/libsmbclient/testfstatvfs +examples/libsmbclient/teststatvfs examples/VFS/config.log examples/VFS/config.status examples/VFS/configure diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c index 815afac..b4dafef 100644 --- a/examples/libsmbclient/testfstatvfs.c +++ b/examples/libsmbclient/testfstatvfs.c @@ -1,4 +1,5 @@ #include sys/types.h +#include sys/statvfs.h #include stdio.h #include unistd.h #include string.h @@ -17,7 +18,7 @@ int main(int argc, char * argv[]) char * p; charpath[2048]; struct stat statbuf; -struct smbc_statvfs statvfsbuf; +struct statvfs statvfsbuf; smbc_init(get_auth_data_fn, debug); diff --git a/examples/libsmbclient/teststatvfs.c b/examples/libsmbclient/teststatvfs.c index b9509d2..8812002 100644 --- a/examples/libsmbclient/teststatvfs.c +++ b/examples/libsmbclient/teststatvfs.c @@ -1,4 +1,5 @@ #include sys/types.h +#include sys/statvfs.h #include stdio.h #include unistd.h #include string.h @@ -17,7 +18,7 @@ int main(int argc, char * argv[]) char * p; charpath[2048]; struct stat statbuf; -struct smbc_statvfs statvfsbuf; +struct statvfs statvfsbuf; smbc_init(get_auth_data_fn, debug); diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index d3683eb..166685c 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -506,13 +506,13 @@ SMBC_fstat_ctx(SMBCCTX *context, int SMBC_statvfs_ctx(SMBCCTX *context, char *path, - struct smbc_statvfs *st); + struct statvfs *st); int SMBC_fstatvfs_ctx(SMBCCTX *context, SMBCFILE *file, - struct smbc_statvfs *st); + struct statvfs *st); /* Functions in libsmb_xattr.c */ diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index 3bea089..d35d9de 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -75,6 +75,7 @@ extern C { /* Make sure we have the following includes for now ... */ #include sys/types.h #include sys/stat.h +#include sys/statvfs.h #include fcntl.h #include utime.h @@ -173,22 +174,6 @@ typedef enum smbc_smb_encrypt_level SMBC_ENCRYPTLEVEL_REQUIRE = 2 } smbc_smb_encrypt_level; -/** - * Use a system independent statvfs struct for smbclient. - */ -struct smbc_statvfs { - fsblkcnt_t f_bavail; - fsblkcnt_t f_bfree; - fsblkcnt_t f_blocks; - fsfilcnt_t f_favail; - fsfilcnt_t f_ffree; - fsfilcnt_t f_files; - unsigned long f_bsize; - unsigned long f_flag; - unsigned long f_frsize; - unsigned long f_fsid; - unsigned long f_namemax; -}; /** * Capabilities set in the f_flag field of struct statvfs, from @@ -887,13 +872,13 @@ void smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4957-g3b7e35a
The branch, v3-3-test has been updated via 3b7e35a54f1aa7d31df60b0264cc171cf5d97954 (commit) from f5e5daeb8fd6133211dfbc4f4b309d5432dddb16 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 3b7e35a54f1aa7d31df60b0264cc171cf5d97954 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 10:07:51 2009 -0500 Ensure consistency of values on stack (caught by AIX compiler) --- Summary of changes: source/libsmb/libsmb_xattr.c | 32 1 files changed, 16 insertions(+), 16 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmb_xattr.c b/source/libsmb/libsmb_xattr.c index 21a3b01..bbaaaeb 100644 --- a/source/libsmb/libsmb_xattr.c +++ b/source/libsmb/libsmb_xattr.c @@ -1273,7 +1273,7 @@ cacl_get(SMBCCTX *context, p = talloc_asprintf(ctx, ,%s:%lu, attr_strings.create_time_attr, -create_time); +(unsigned long) create_time); if (!p) { errno = ENOMEM; return -1; @@ -1283,11 +1283,11 @@ cacl_get(SMBCCTX *context, n = snprintf(buf, bufsize, ,%s:%lu, attr_strings.create_time_attr, - create_time); + (unsigned long) create_time); } } else if (StrCaseCmp(name, attr_strings.create_time_attr) == 0) { if (determine_size) { -p = talloc_asprintf(ctx, %lu, create_time); +p = talloc_asprintf(ctx, %lu, (unsigned long) create_time); if (!p) { errno = ENOMEM; return -1; @@ -1295,7 +1295,7 @@ cacl_get(SMBCCTX *context, n = strlen(p); } else { n = snprintf(buf, bufsize, - %lu, create_time); + %lu, (unsigned long) create_time); } } @@ -1315,7 +1315,7 @@ cacl_get(SMBCCTX *context, p = talloc_asprintf(ctx, ,%s:%lu, attr_strings.access_time_attr, -access_time); +(unsigned long) access_time); if (!p) { errno = ENOMEM; return -1; @@ -1325,11 +1325,11 @@ cacl_get(SMBCCTX *context, n = snprintf(buf, bufsize, ,%s:%lu, attr_strings.access_time_attr, - access_time); + (unsigned long) access_time); } } else if (StrCaseCmp(name, attr_strings.access_time_attr) == 0) { if (determine_size) { -p = talloc_asprintf(ctx, %lu, access_time); +p = talloc_asprintf(ctx, %lu, (unsigned long) access_time); if (!p) { errno = ENOMEM; return -1; @@ -1337,7 +1337,7 @@ cacl_get(SMBCCTX *context, n = strlen(p); } else { n = snprintf(buf, bufsize, - %lu, access_time); + %lu, (unsigned long) access_time
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-895-gfcb2e89
The branch, master has been updated via fcb2e8904e27c8ab4904d8cd2172adb9081cfa6d (commit) from c2661aec24f244c1cf94dca02592b3410b9b6f31 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit fcb2e8904e27c8ab4904d8cd2172adb9081cfa6d Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 10:08:10 2009 -0500 Ensure consistency of values on stack (caught by AIX compiler) --- Summary of changes: source3/libsmb/libsmb_xattr.c | 32 1 files changed, 16 insertions(+), 16 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c index 4c5a758..70fbc27 100644 --- a/source3/libsmb/libsmb_xattr.c +++ b/source3/libsmb/libsmb_xattr.c @@ -1273,7 +1273,7 @@ cacl_get(SMBCCTX *context, p = talloc_asprintf(ctx, ,%s:%lu, attr_strings.create_time_attr, -create_time); +(unsigned long) create_time); if (!p) { errno = ENOMEM; return -1; @@ -1283,11 +1283,11 @@ cacl_get(SMBCCTX *context, n = snprintf(buf, bufsize, ,%s:%lu, attr_strings.create_time_attr, - create_time); + (unsigned long) create_time); } } else if (StrCaseCmp(name, attr_strings.create_time_attr) == 0) { if (determine_size) { -p = talloc_asprintf(ctx, %lu, create_time); +p = talloc_asprintf(ctx, %lu, (unsigned long) create_time); if (!p) { errno = ENOMEM; return -1; @@ -1295,7 +1295,7 @@ cacl_get(SMBCCTX *context, n = strlen(p); } else { n = snprintf(buf, bufsize, - %lu, create_time); + %lu, (unsigned long) create_time); } } @@ -1315,7 +1315,7 @@ cacl_get(SMBCCTX *context, p = talloc_asprintf(ctx, ,%s:%lu, attr_strings.access_time_attr, -access_time); +(unsigned long) access_time); if (!p) { errno = ENOMEM; return -1; @@ -1325,11 +1325,11 @@ cacl_get(SMBCCTX *context, n = snprintf(buf, bufsize, ,%s:%lu, attr_strings.access_time_attr, - access_time); + (unsigned long) access_time); } } else if (StrCaseCmp(name, attr_strings.access_time_attr) == 0) { if (determine_size) { -p = talloc_asprintf(ctx, %lu, access_time); +p = talloc_asprintf(ctx, %lu, (unsigned long) access_time); if (!p) { errno = ENOMEM; return -1; @@ -1337,7 +1337,7 @@ cacl_get(SMBCCTX *context, n = strlen(p); } else { n = snprintf(buf, bufsize, - %lu, access_time); + %lu, (unsigned long) access_time
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-896-g20b5e64
The branch, master has been updated via 20b5e6465938ee81e4d0657f8dd493ff97ec53aa (commit) from fcb2e8904e27c8ab4904d8cd2172adb9081cfa6d (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 20b5e6465938ee81e4d0657f8dd493ff97ec53aa Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 12:27:40 2009 -0500 The f_fsid field is not always an integer type. Don't set it in that case. --- Summary of changes: source3/libsmb/libsmb_stat.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c index 3eec15f..dbe9f37 100644 --- a/source3/libsmb/libsmb_stat.c +++ b/source3/libsmb/libsmb_stat.c @@ -441,9 +441,14 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, (fsfilcnt_t) total_file_nodes; st-f_ffree = (fsfilcnt_t) free_file_nodes; +#if HAVE_FSID_INT st-f_fsid = (unsigned long) fs_identifier; +#else +#warning f_fsid is not an integer type so is not available +/* We don't know the type, so don't try to set it */ +#endif } } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-897-g7caadef
The branch, master has been updated via 7caadefaa20afeb98a77f14c2948f03cde1d8786 (commit) from 20b5e6465938ee81e4d0657f8dd493ff97ec53aa (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 7caadefaa20afeb98a77f14c2948f03cde1d8786 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 12:30:23 2009 -0500 f_frsize field is not ubiquitous. Check for it. --- Summary of changes: source3/libsmb/libsmb_stat.c |4 1 files changed, 4 insertions(+), 0 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c index dbe9f37..8987c2e 100644 --- a/source3/libsmb/libsmb_stat.c +++ b/source3/libsmb/libsmb_stat.c @@ -398,8 +398,12 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, /* ... then provide it */ st-f_bsize = (unsigned long) bytes_per_sector; +#if HAVE_FRSIZE st-f_frsize = (unsigned long) sectors_per_allocation_unit; +#else +#warning f_frsize field is not available +#endif st-f_blocks = (fsblkcnt_t) total_allocation_units; st-f_bfree = -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-908-g2b097cb
The branch, master has been updated via 2b097cbb4e83291ffaea0c8904891f031caba898 (commit) from b222de4eb3abab618f740a89279af2a7dc0985a7 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 2b097cbb4e83291ffaea0c8904891f031caba898 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 16:00:51 2009 -0500 It seems some systems use f_flags instead of f_flag. Use the appropriate one. --- Summary of changes: source3/configure.in | 17 + source3/libsmb/libsmb_stat.c | 15 +++ 2 files changed, 28 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/configure.in b/source3/configure.in index 97f3511..4a8d594 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -4789,6 +4789,23 @@ if test x$samba_cv_frsize = xyes; then AC_DEFINE(HAVE_FRSIZE, 1, [Whether statvfs.f_frsize exists]) fi +# Some systems use f_flag in struct statvfs while others use f_flags +AC_CACHE_CHECK([that statvfs.statvfs_f_flag works],samba_cv_statvfs_f_flag, [ +AC_TRY_COMPILE([#include sys/types.h +#include sys/statvfs.h],[struct statvfs buf; buf.f_flag = 0], + samba_cv_statvfs_f_flag=yes,samba_cv_statvfs_f_flag=no)]) +if test x$samba_cv_statvfs_f_flag = xyes; then +AC_DEFINE(HAVE_STATVFS_F_FLAG, 1, [Whether statvfs.f_flag exists]) +fi + +AC_CACHE_CHECK([that statvfs.statvfs_f_flags works],samba_cv_statvfs_f_flags, [ +AC_TRY_COMPILE([#include sys/types.h +#include sys/statvfs.h],[struct statvfs buf; buf.f_flags = 0], + samba_cv_statvfs_f_flags=yes,samba_cv_statvfs_f_flags=no)]) +if test x$samba_cv_statvfs_f_flags = xyes; then +AC_DEFINE(HAVE_STATVFS_F_FLAGS, 1, [Whether statvfs.f_flags exists]) +fi + if test $space = no; then # DEC Alpha running OSF/1 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c index 8987c2e..8a950b6 100644 --- a/source3/libsmb/libsmb_stat.c +++ b/source3/libsmb/libsmb_stat.c @@ -363,6 +363,7 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, SMBCFILE *file, struct statvfs *st) { +unsigned long flags = 0; uint32 fs_attrs = 0; struct cli_state *cli = file-srv-cli; @@ -410,7 +411,7 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, (fsblkcnt_t) actual_allocation_units; } -st-f_flag |= SMBC_VFS_FEATURE_NO_UNIXCIFS; +flags |= SMBC_VFS_FEATURE_NO_UNIXCIFS; } else { uint32 optimal_transfer_size; uint32 block_size; @@ -464,18 +465,24 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, * user-specified case sensitivity setting. */ if (! smbc_getOptionCaseSensitive(context)) { -st-f_flag |= SMBC_VFS_FEATURE_CASE_INSENSITIVE; +flags |= SMBC_VFS_FEATURE_CASE_INSENSITIVE; } } else { if (! (fs_attrs FILE_CASE_SENSITIVE_SEARCH)) { -st-f_flag |= SMBC_VFS_FEATURE_CASE_INSENSITIVE; +flags |= SMBC_VFS_FEATURE_CASE_INSENSITIVE; } } /* See if DFS is supported */ if ((cli-capabilities CAP_DFS) cli-dfsroot) { -st-f_flag |= SMBC_VFS_FEATURE_DFS; +flags |= SMBC_VFS_FEATURE_DFS; } +#if HAVE_STATVFS_F_FLAG +st-f_flag = flags; +#elif HAVE_STATVFS_F_FLAGS +st-f_flags = flags; +#endif + return 0; } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4958-g3b12ab7
The branch, v3-3-test has been updated via 3b12ab74252c850348c2d15adf930aa01e0652ff (commit) from 3b7e35a54f1aa7d31df60b0264cc171cf5d97954 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 3b12ab74252c850348c2d15adf930aa01e0652ff Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 16:11:50 2009 -0500 It seems some systems use f_flags instead of f_flag. Use the appropriate one. --- Summary of changes: source/configure.in | 18 ++ source/libsmb/libsmb_stat.c | 24 2 files changed, 38 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/source/configure.in b/source/configure.in index c518921..cfb97b5 100644 --- a/source/configure.in +++ b/source/configure.in @@ -5047,6 +5047,24 @@ if test x$samba_cv_frsize = xyes; then AC_DEFINE(HAVE_FRSIZE, 1, [Whether statvfs.f_frsize exists]) fi +# Some systems use f_flag in struct statvfs while others use f_flags +AC_CACHE_CHECK([that statvfs.statvfs_f_flag works],samba_cv_statvfs_f_flag, [ +AC_TRY_COMPILE([#include sys/types.h +#include sys/statvfs.h],[struct statvfs buf; buf.f_flag = 0], + samba_cv_statvfs_f_flag=yes,samba_cv_statvfs_f_flag=no)]) +if test x$samba_cv_statvfs_f_flag = xyes; then +AC_DEFINE(HAVE_STATVFS_F_FLAG, 1, [Whether statvfs.f_flag exists]) +fi + +AC_CACHE_CHECK([that statvfs.statvfs_f_flags works],samba_cv_statvfs_f_flags, [ +AC_TRY_COMPILE([#include sys/types.h +#include sys/statvfs.h],[struct statvfs buf; buf.f_flags = 0], + samba_cv_statvfs_f_flags=yes,samba_cv_statvfs_f_flags=no)]) +if test x$samba_cv_statvfs_f_flags = xyes; then +AC_DEFINE(HAVE_STATVFS_F_FLAGS, 1, [Whether statvfs.f_flags exists]) +fi + + if test $space = no; then # DEC Alpha running OSF/1 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) diff --git a/source/libsmb/libsmb_stat.c b/source/libsmb/libsmb_stat.c index 38a4441..b09afac 100644 --- a/source/libsmb/libsmb_stat.c +++ b/source/libsmb/libsmb_stat.c @@ -363,6 +363,7 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, SMBCFILE *file, struct statvfs *st) { +unsigned long flags = 0; uint32 fs_attrs = 0; struct cli_state *cli = file-srv-cli; @@ -398,15 +399,19 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, /* ... then provide it */ st-f_bsize = (unsigned long) bytes_per_sector; +#if HAVE_FRSIZE st-f_frsize = (unsigned long) sectors_per_allocation_unit; +#else +#warning f_frsize field is not available +#endif st-f_blocks = (fsblkcnt_t) total_allocation_units; st-f_bfree = (fsblkcnt_t) actual_allocation_units; } -st-f_flag |= SMBC_VFS_FEATURE_NO_UNIXCIFS; +flags |= SMBC_VFS_FEATURE_NO_UNIXCIFS; } else { uint32 optimal_transfer_size; uint32 block_size; @@ -441,8 +446,13 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, (fsfilcnt_t) total_file_nodes; st-f_ffree = (fsfilcnt_t) free_file_nodes; +#if HAVE_FSID_INT st-f_fsid = (unsigned long) fs_identifier; +#else +#warning f_fsid is not an integer type so is not available +/* We don't know the type, so don't try to set it */ +#endif } } @@ -455,18 +465,24 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, * user-specified case sensitivity setting. */ if (! smbc_getOptionCaseSensitive(context)) { -st-f_flag |= SMBC_VFS_FEATURE_CASE_INSENSITIVE; +flags |= SMBC_VFS_FEATURE_CASE_INSENSITIVE; } } else { if (! (fs_attrs FILE_CASE_SENSITIVE_SEARCH)) { -st-f_flag |= SMBC_VFS_FEATURE_CASE_INSENSITIVE; +flags |= SMBC_VFS_FEATURE_CASE_INSENSITIVE; } } /* See if DFS is supported */ if ((cli-capabilities CAP_DFS) cli-dfsroot) { -st-f_flag |= SMBC_VFS_FEATURE_DFS; +flags |= SMBC_VFS_FEATURE_DFS; } +#if HAVE_STATVFS_F_FLAG +st-f_flag = flags; +#elif HAVE_STATVFS_F_FLAGS +st-f_flags = flags; +#endif + return 0; } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4959-gf38c50b
The branch, v3-3-test has been updated via f38c50b13f3ad916db884611ad4199198f6cade2 (commit) from 3b12ab74252c850348c2d15adf930aa01e0652ff (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit f38c50b13f3ad916db884611ad4199198f6cade2 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 18:56:44 2009 -0500 Get rid of the warnings I had for testing --- Summary of changes: source/libsmb/libsmb_stat.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmb_stat.c b/source/libsmb/libsmb_stat.c index b09afac..b9b14e3 100644 --- a/source/libsmb/libsmb_stat.c +++ b/source/libsmb/libsmb_stat.c @@ -402,8 +402,6 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, #if HAVE_FRSIZE st-f_frsize = (unsigned long) sectors_per_allocation_unit; -#else -#warning f_frsize field is not available #endif st-f_blocks = (fsblkcnt_t) total_allocation_units; @@ -449,9 +447,6 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, #if HAVE_FSID_INT st-f_fsid = (unsigned long) fs_identifier; -#else -#warning f_fsid is not an integer type so is not available -/* We don't know the type, so don't try to set it */ #endif } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-909-gaee9bab
The branch, master has been updated via aee9bab6e1a4b5520aa9beb5252e02fb55d28b13 (commit) from 2b097cbb4e83291ffaea0c8904891f031caba898 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit aee9bab6e1a4b5520aa9beb5252e02fb55d28b13 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 18:56:33 2009 -0500 Get rid of the warnings I had for testing --- Summary of changes: source3/libsmb/libsmb_stat.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c index 8a950b6..63661cd 100644 --- a/source3/libsmb/libsmb_stat.c +++ b/source3/libsmb/libsmb_stat.c @@ -402,8 +402,6 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, #if HAVE_FRSIZE st-f_frsize = (unsigned long) sectors_per_allocation_unit; -#else -#warning f_frsize field is not available #endif st-f_blocks = (fsblkcnt_t) total_allocation_units; @@ -450,9 +448,6 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, st-f_fsid = (unsigned long) fs_identifier; -#else -#warning f_fsid is not an integer type so is not available -/* We don't know the type, so don't try to set it */ #endif } } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-911-gf608588
The branch, master has been updated via f608588ea3facd3f2e567d2c356a3a7466a0d1b0 (commit) via a796832683295759c1979eebd0d97b77ed88eb43 (commit) from aee9bab6e1a4b5520aa9beb5252e02fb55d28b13 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit f608588ea3facd3f2e567d2c356a3a7466a0d1b0 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 22:29:28 2009 -0500 remove accidental white space commit a796832683295759c1979eebd0d97b77ed88eb43 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 22:29:11 2009 -0500 enums are traditionally signed. Avoid use of high bit in bit flags. --- Summary of changes: source3/include/libsmbclient.h |6 +++--- source3/libsmb/libsmb_stat.c |1 - 2 files changed, 3 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index d35d9de..f8a6c8a 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -186,9 +186,9 @@ typedef enum smbc_vfs_feature SMBC_VFS_FEATURE_RDONLY = (1 0), /* Specific to libsmbclient (high-order bits) */ -SMBC_VFS_FEATURE_DFS = (1 29), -SMBC_VFS_FEATURE_CASE_INSENSITIVE = (1 30), -SMBC_VFS_FEATURE_NO_UNIXCIFS = (1 31) +SMBC_VFS_FEATURE_DFS = (1 28), +SMBC_VFS_FEATURE_CASE_INSENSITIVE = (1 29), +SMBC_VFS_FEATURE_NO_UNIXCIFS = (1 30) } smbc_vfs_feature; typedef int smbc_bool; diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c index 63661cd..1ffe141 100644 --- a/source3/libsmb/libsmb_stat.c +++ b/source3/libsmb/libsmb_stat.c @@ -447,7 +447,6 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, #if HAVE_FSID_INT st-f_fsid = (unsigned long) fs_identifier; - #endif } } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4961-g82e392f
The branch, v3-3-test has been updated via 82e392f6b24518d40ea65dbdf044d8ba94e77ae2 (commit) via 480054f3625fcd4532a4cdc68bd750e93610d89f (commit) from f38c50b13f3ad916db884611ad4199198f6cade2 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 82e392f6b24518d40ea65dbdf044d8ba94e77ae2 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 22:30:21 2009 -0500 remove accidental white space commit 480054f3625fcd4532a4cdc68bd750e93610d89f Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Feb 14 22:30:13 2009 -0500 enums are traditionally signed. Avoid use of high bit in bit flags. --- Summary of changes: source/include/libsmbclient.h |6 +++--- source/libsmb/libsmb_stat.c |1 - 2 files changed, 3 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 67010a5..a3a5d70 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -185,9 +185,9 @@ typedef enum smbc_vfs_feature SMBC_VFS_FEATURE_RDONLY = (1 0), /* Specific to libsmbclient (high-order bits) */ -SMBC_VFS_FEATURE_DFS = (1 29), -SMBC_VFS_FEATURE_CASE_INSENSITIVE = (1 30), -SMBC_VFS_FEATURE_NO_UNIXCIFS = (1 31) +SMBC_VFS_FEATURE_DFS = (1 28), +SMBC_VFS_FEATURE_CASE_INSENSITIVE = (1 29), +SMBC_VFS_FEATURE_NO_UNIXCIFS = (1 30) } smbc_vfs_feature; typedef int smbc_bool; diff --git a/source/libsmb/libsmb_stat.c b/source/libsmb/libsmb_stat.c index b9b14e3..186ef13 100644 --- a/source/libsmb/libsmb_stat.c +++ b/source/libsmb/libsmb_stat.c @@ -448,7 +448,6 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, st-f_fsid = (unsigned long) fs_identifier; #endif - } } -- Samba Shared Repository
Re: [SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-868-g5e5d2b2
On Fri, Feb 13, 2009 at 4:00 PM, Tim Prouty tpro...@samba.org wrote: s3 libsmbclient: Fix fstatvfs to be more portable The statvfs struct isn't guaranteed to be portable across operating systems. Since libsmbclient isn't actually calling statvfs and just using the statvfs struct to store similar information, this patch adds a new portable smbc_statvfs struct. This fixes a few of the failures in the build farm introduced by: ae259575c447e61665c8e7070c476914161b953f I never got any alerts that the build farm had troubles with my commits. The build farm used to complain to the likely authors of offending code if there was a problem. Has that gone away? Tim, this is intended, specifically, to mirror the POSIX function, just as libsmbclient does with smbc_stat() and struct stat. I need to see what the problem identified by the build farm is before I can comment further, but adding an smbc_statvfs struct as part of the public interface is counter to the way this library works everyplace else, so I'd really like to avoid that. I'll look into it. Derrell
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4943-g0697cff
The branch, v3-3-test has been updated via 0697cffe211a922c816b6c75230c4186328498ed (commit) from a8a7040d7dbffe7b1c2bccb8b46e08fb996786ac (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 0697cffe211a922c816b6c75230c4186328498ed Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Thu Feb 12 09:16:48 2009 -0500 [Bug 6069] Add a fstatvfs function for libsmbclient - DFS is not a POSIX feature, so the state of that bit should be zero if DFS is *not* supported. Bit feature reversed. - Added smbc_statvfs function Derrell --- Summary of changes: examples/libsmbclient/Makefile |5 ++ examples/libsmbclient/testfstatvfs.c |6 +- .../libsmbclient/{testfstatvfs.c = teststatvfs.c} | 34 ++--- source/include/libsmb_internal.h |7 +++ source/include/libsmbclient.h | 31 +++- source/libsmb/libsmb_compat.c |7 +++ source/libsmb/libsmb_context.c |1 + source/libsmb/libsmb_setget.c | 12 source/libsmb/libsmb_stat.c| 56 +++- 9 files changed, 123 insertions(+), 36 deletions(-) copy examples/libsmbclient/{testfstatvfs.c = teststatvfs.c} (74%) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 7ad28dc..728dbe0 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -24,6 +24,7 @@ TESTS=testsmbc \ teststat \ teststat2 \ teststat3 \ + teststatvfs \ testfstatvfs \ testtruncate \ testchmod \ @@ -75,6 +76,10 @@ teststat3: teststat3.o @echo Linking teststat3 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt +teststatvfs: teststatvfs.o + @echo Linking teststatvfs + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt + testfstatvfs: testfstatvfs.o @echo Linking testfstatvfs $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c index f8a6870..b4dafef 100644 --- a/examples/libsmbclient/testfstatvfs.c +++ b/examples/libsmbclient/testfstatvfs.c @@ -105,13 +105,13 @@ int main(int argc, char * argv[]) printf(case_sensitive ); } -if (statvfsbuf.f_flag SMBC_VFS_FEATURE_NO_DFS) +if (statvfsbuf.f_flag SMBC_VFS_FEATURE_DFS) { -printf(NO_DFS ); +printf(DFS ); } else { -printf(dfs ); +printf(no_dfs ); } printf(\n); diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/teststatvfs.c similarity index 74% copy from examples/libsmbclient/testfstatvfs.c copy to examples/libsmbclient/teststatvfs.c index f8a6870..8812002 100644 --- a/examples/libsmbclient/testfstatvfs.c +++ b/examples/libsmbclient/teststatvfs.c @@ -38,33 +38,7 @@ int main(int argc, char * argv[]) *p = '\0'; } -/* Determine if it's a file or a folder */ -if (smbc_stat(path, statbuf) 0) -{ -perror(smbc_stat); -continue; -} - -if (S_ISREG(statbuf.st_mode)) -{ -if ((fd = smbc_open(path, O_RDONLY, 0)) 0) -{ -perror(smbc_open); -continue; -} -} -else -{ -if ((fd = smbc_opendir(path)) 0) -{ -perror(smbc_opendir); -continue; -} -} - -ret = smbc_fstatvfs(fd, statvfsbuf); - -smbc_close(fd); +ret = smbc_statvfs(path, statvfsbuf); if (ret 0) { @@ -105,13 +79,13 @@ int main(int argc, char * argv[]) printf(case_sensitive ); } -if (statvfsbuf.f_flag SMBC_VFS_FEATURE_NO_DFS) +if (statvfsbuf.f_flag SMBC_VFS_FEATURE_DFS) { -printf(NO_DFS ); +printf(DFS ); } else { -printf(dfs ); +printf(no_dfs ); } printf(\n); diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index edf3a6e..166685c 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -197,6 +197,7 @@ struct SMBC_internal_data { smbc_stat_fnstat_fn; smbc_fstat_fn fstat_fn; #endif +smbc_statvfs_fn
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-814-gae25957
The branch, master has been updated via ae259575c447e61665c8e7070c476914161b953f (commit) from 082ba6a1ad3a68aff118d96f855a2aa65eaeb359 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit ae259575c447e61665c8e7070c476914161b953f Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Thu Feb 12 10:39:17 2009 -0500 [Bug 6069] Add a fstatvfs function for libsmbclient - port functionality from v3_3_test to master Derrell --- Summary of changes: examples/libsmbclient/Makefile | 10 ++ examples/libsmbclient/testfstatvfs.c | 122 examples/libsmbclient/teststatvfs.c | 96 +++ source3/include/includes.h |1 + source3/include/libsmb_internal.h| 14 +++ source3/include/libsmbclient.h | 75 +++ source3/include/proto.h | 15 +++ source3/libsmb/clifsinfo.c | 145 + source3/libsmb/libsmb_compat.c | 15 +++ source3/libsmb/libsmb_context.c |2 + source3/libsmb/libsmb_setget.c | 24 + source3/libsmb/libsmb_stat.c | 169 ++ 12 files changed, 688 insertions(+), 0 deletions(-) create mode 100644 examples/libsmbclient/testfstatvfs.c create mode 100644 examples/libsmbclient/teststatvfs.c Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 047addc..728dbe0 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -24,6 +24,8 @@ TESTS=testsmbc \ teststat \ teststat2 \ teststat3 \ + teststatvfs \ + testfstatvfs \ testtruncate \ testchmod \ testutime \ @@ -74,6 +76,14 @@ teststat3: teststat3.o @echo Linking teststat3 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt +teststatvfs: teststatvfs.o + @echo Linking teststatvfs + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt + +testfstatvfs: testfstatvfs.o + @echo Linking testfstatvfs + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt + testtruncate: testtruncate.o @echo Linking testtruncate $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c new file mode 100644 index 000..b4dafef --- /dev/null +++ b/examples/libsmbclient/testfstatvfs.c @@ -0,0 +1,122 @@ +#include sys/types.h +#include sys/statvfs.h +#include stdio.h +#include unistd.h +#include string.h +#include time.h +#include errno.h +#include libsmbclient.h +#include get_auth_data_fn.h + + +int main(int argc, char * argv[]) +{ +int i; +int fd; +int ret; +int debug = 0; +char * p; +charpath[2048]; +struct stat statbuf; +struct statvfs statvfsbuf; + +smbc_init(get_auth_data_fn, debug); + +for (;;) +{ +fprintf(stdout, Path: ); +*path = '\0'; +fgets(path, sizeof(path) - 1, stdin); +if (strlen(path) == 0) +{ +return 0; +} + +p = path + strlen(path) - 1; +if (*p == '\n') +{ +*p = '\0'; +} + +/* Determine if it's a file or a folder */ +if (smbc_stat(path, statbuf) 0) +{ +perror(smbc_stat); +continue; +} + +if (S_ISREG(statbuf.st_mode)) +{ +if ((fd = smbc_open(path, O_RDONLY, 0)) 0) +{ +perror(smbc_open); +continue; +} +} +else +{ +if ((fd = smbc_opendir(path)) 0) +{ +perror(smbc_opendir); +continue; +} +} + +ret = smbc_fstatvfs(fd, statvfsbuf); + +smbc_close(fd); + +if (ret 0) +{ +perror(fstatvfs); +} +else +{ +printf(\n); +printf(Block Size: %lu\n, statvfsbuf.f_bsize); +printf(Fragment Size: %lu\n, statvfsbuf.f_frsize); +printf(Blocks: %llu\n, statvfsbuf.f_blocks); +printf(Free Blocks: %llu\n, statvfsbuf.f_bfree); +printf(Available Blocks: %llu\n, statvfsbuf.f_bavail); +printf(Files : %llu\n, statvfsbuf.f_files); +printf(Free Files: %llu\n, statvfsbuf.f_ffree); +printf(Available Files: %llu\n, statvfsbuf.f_favail); +printf(File System ID: %lu\n, statvfsbuf.f_fsid); +printf(\n); + +printf(Flags: 0x%lx\n, statvfsbuf.f_flag); +printf(Extended Features
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4928-g0acc962
The branch, v3-3-test has been updated via 0acc962e3968253a3f64b5a92def177ced44994d (commit) from 97f1514ce95800f1296b1979f1b34dcc5d56a376 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 0acc962e3968253a3f64b5a92def177ced44994d Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Tue Feb 10 10:28:32 2009 -0500 [Bug 6069] Add a fstatvfs function for libsmbclient - Reverse the sense of the flags. Since the fstatvfs() function on POSIX-like systems would almost certainly indicate case sensitivity (for example), leave the bit turned off if the result is the POSIX-like result just as if issued on a typical local file system on a POSIX system. Derrell --- Summary of changes: examples/libsmbclient/testfstatvfs.c | 30 +++--- source/include/libsmbclient.h| 12 ++-- source/libsmb/libsmb_stat.c | 25 + 3 files changed, 42 insertions(+), 25 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c index 9db70cf..fbb51f1 100644 --- a/examples/libsmbclient/testfstatvfs.c +++ b/examples/libsmbclient/testfstatvfs.c @@ -70,27 +70,35 @@ int main(int argc, char * argv[]) { perror(fstatvfs); } -else if (statvfsbuf.f_flag == 0) -{ -printf(No capabilities found\n); -} else { -printf(Capabilities: ); +printf(Features: ); -if (statvfsbuf.f_flag SMBC_VFS_CAP_UNIXCIFS) +if (statvfsbuf.f_flag SMBC_VFS_FEATURE_NO_UNIXCIFS) +{ +printf(NO_UNIXCIFS ); +} +else { -printf(UNIXCIFS ); +printf(unixcifs ); } -if (statvfsbuf.f_flag SMBC_VFS_CAP_CASE_SENSITIVE) +if (statvfsbuf.f_flag SMBC_VFS_FEATURE_CASE_INSENSITIVE) { -printf(CASE_SENSITIVE ); +printf(CASE_INSENSITIVE ); +} +else +{ +printf(case_sensitive ); } -if (statvfsbuf.f_flag SMBC_VFS_CAP_DFS) +if (statvfsbuf.f_flag SMBC_VFS_FEATURE_NO_DFS) +{ +printf(NO_DFS ); +} +else { -printf(DFS ); +printf(dfs ); } printf(\n); diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 575bef6..ec7e742 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -179,16 +179,16 @@ typedef enum smbc_smb_encrypt_level * smbc_statvfs(). These may be OR-ed together to reflect a full set of * available capabilities. */ -typedef enum smbc_vfs_capability +typedef enum smbc_vfs_feature { /* Defined by POSIX or in Linux include files (low-order bits) */ -SMBC_VFS_CAP_RDONLY = (1 0), +SMBC_VFS_FEATURE_RDONLY = (1 0), /* Specific to libsmbclient (high-order bits) */ -SMBC_VFS_CAP_DFS= (1 29), -SMBC_VFS_CAP_CASE_SENSITIVE = (1 30), -SMBC_VFS_CAP_UNIXCIFS = (1 31) -} smbc_vfs_capability; +SMBC_VFS_FEATURE_NO_DFS = (1 29), +SMBC_VFS_FEATURE_CASE_INSENSITIVE = (1 30), +SMBC_VFS_FEATURE_NO_UNIXCIFS = (1 31) +} smbc_vfs_feature; typedef int smbc_bool; diff --git a/source/libsmb/libsmb_stat.c b/source/libsmb/libsmb_stat.c index 71dc1d1..e5eac59 100644 --- a/source/libsmb/libsmb_stat.c +++ b/source/libsmb/libsmb_stat.c @@ -316,9 +316,18 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, /* Initialize all fields (at least until we actually use them) */ memset(st, 0, sizeof(*st)); +/* + * The state of each flag is such that the same bits are unset as + * would typically be unset on a local file system on a POSIX OS. Thus + * the bit is on, for example, only for case-insensitive file systems + * since most POSIX file systems are case sensitive and fstatvfs() + * would typically return zero in these bits on such a local file + * system. + */ + /* See if the server has UNIX CIFS support */ -if (SERVER_HAS_UNIX_CIFS(cli)) { -st-f_flag |= SMBC_VFS_CAP_UNIXCIFS; +if (! SERVER_HAS_UNIX_CIFS(cli)) { +st-f_flag |= SMBC_VFS_FEATURE_NO_UNIXCIFS; } /* See if the share is case sensitive */ @@ -328,18 +337,18 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, * the share. We have no choice but to use the * user-specified case sensitivity setting
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4929-geeeceea
The branch, v3-3-test has been updated via eeeceea8b92b8b814209f496a7ab953dcd0a8367 (commit) from 0acc962e3968253a3f64b5a92def177ced44994d (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit eeeceea8b92b8b814209f496a7ab953dcd0a8367 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Tue Feb 10 15:03:32 2009 -0500 [Bug 6069] Add a fstatvfs function for libsmbclient - Fill in the remainder of the data (or at least as much as we can get) for the fstatvfs return value. Derrell --- Summary of changes: examples/libsmbclient/testfstatvfs.c | 15 +++- source/include/includes.h|2 + source/include/proto.h | 15 source/libsmb/clifsinfo.c| 145 ++ source/libsmb/libsmb_stat.c | 64 +++ 5 files changed, 240 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c index fbb51f1..f8a6870 100644 --- a/examples/libsmbclient/testfstatvfs.c +++ b/examples/libsmbclient/testfstatvfs.c @@ -72,7 +72,20 @@ int main(int argc, char * argv[]) } else { -printf(Features: ); +printf(\n); +printf(Block Size: %lu\n, statvfsbuf.f_bsize); +printf(Fragment Size: %lu\n, statvfsbuf.f_frsize); +printf(Blocks: %llu\n, statvfsbuf.f_blocks); +printf(Free Blocks: %llu\n, statvfsbuf.f_bfree); +printf(Available Blocks: %llu\n, statvfsbuf.f_bavail); +printf(Files : %llu\n, statvfsbuf.f_files); +printf(Free Files: %llu\n, statvfsbuf.f_ffree); +printf(Available Files: %llu\n, statvfsbuf.f_favail); +printf(File System ID: %lu\n, statvfsbuf.f_fsid); +printf(\n); + +printf(Flags: 0x%lx\n, statvfsbuf.f_flag); +printf(Extended Features: ); if (statvfsbuf.f_flag SMBC_VFS_FEATURE_NO_UNIXCIFS) { diff --git a/source/include/includes.h b/source/include/includes.h index d130171..65b4242 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -470,10 +470,12 @@ typedef int VOLATILE SIG_ATOMIC_T; #define SMB_BIG_UINT unsigned long long #define SMB_BIG_INT long long #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)0x), SIVAL(p,(ofs)+4,(v)32)) +#define BIG_UINT(p, ofs) SMB_BIG_UINT) IVAL(p,(ofs)+4))32)|IVAL(p,ofs)) #else #define SMB_BIG_UINT unsigned long #define SMB_BIG_INT long #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0)) +#define BIG_UINT(p, ofs) (IVAL(p,ofs)) #endif #define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8) diff --git a/source/include/proto.h b/source/include/proto.h index 226f7be..04ceb83 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -4333,6 +4333,21 @@ bool cli_set_unix_extensions_capabilities(struct cli_state *cli, uint16 major, u bool cli_get_fs_attr_info(struct cli_state *cli, uint32 *fs_attr); bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number); bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate); +bool cli_get_fs_full_size_info(struct cli_state *cli, + SMB_BIG_UINT *total_allocation_units, + SMB_BIG_UINT *caller_allocation_units, + SMB_BIG_UINT *actual_allocation_units, + SMB_BIG_UINT *sectors_per_allocation_unit, + SMB_BIG_UINT *bytes_per_sector); +bool cli_get_posix_fs_info(struct cli_state *cli, + uint32 *optimal_transfer_size, + uint32 *block_size, + SMB_BIG_UINT *total_blocks, + SMB_BIG_UINT *blocks_available, + SMB_BIG_UINT *user_blocks_available, + SMB_BIG_UINT *total_file_nodes, + SMB_BIG_UINT *free_file_nodes, + SMB_BIG_UINT *fs_identifier); NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli, const char *user, const char *pass, diff --git a/source/libsmb/clifsinfo.c b/source/libsmb/clifsinfo.c index 5e73b61..dd56f30 100644 --- a/source/libsmb/clifsinfo.c +++ b/source/libsmb/clifsinfo.c @@ -303,6 +303,151 @@ cleanup: return ret; } +bool cli_get_fs_full_size_info(struct cli_state *cli, + SMB_BIG_UINT *total_allocation_units, + SMB_BIG_UINT *caller_allocation_units
[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-660-g76f4cc3
The branch, master has been updated via 76f4cc3c70524f1f2c1c227fd19082d5ab05da0f (commit) from 487f5e7b4768cfe9e511b0ba56f16c411e21f702 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 76f4cc3c70524f1f2c1c227fd19082d5ab05da0f Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Mon Feb 9 09:53:44 2009 -0500 eliminate compiler warnings --- Summary of changes: source3/libsmb/libsmb_xattr.c | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c index d71a318..4c5a758 100644 --- a/source3/libsmb/libsmb_xattr.c +++ b/source3/libsmb/libsmb_xattr.c @@ -1501,7 +1501,7 @@ cacl_set(TALLOC_CTX *ctx, struct cli_state *ipc_cli, POLICY_HND *pol, const char *filename, - const char *the_acl, + char *the_acl, int mode, int flags) { @@ -2113,11 +2113,13 @@ SMBC_getxattr_ctx(SMBCCTX *context, StrCaseCmp(name, system.dos_attr.inode) == 0) { /* Yup. */ +char *filename = (char *) name; ret = cacl_get(context, talloc_tos(), srv, ipc_srv == NULL ? NULL : ipc_srv-cli, ipc_srv-pol, path, - CONST_DISCARD(char *, name), - CONST_DISCARD(char *, value), size); + filename, + CONST_DISCARD(char *, value), + size); if (ret 0 errno == 0) { errno = SMBC_errno(context, srv-cli); } @@ -2236,7 +2238,8 @@ SMBC_removexattr_ctx(SMBCCTX *context, /* Yup. */ ret = cacl_set(talloc_tos(), srv-cli, ipc_srv-cli, ipc_srv-pol, path, - name + 19, SMBC_XATTR_MODE_REMOVE, 0); + CONST_DISCARD(char *, name) + 19, + SMBC_XATTR_MODE_REMOVE, 0); TALLOC_FREE(frame); return ret; } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4923-gff6a1be
The branch, v3-3-test has been updated via ff6a1bebd589637a4aecb9c76b4e33f579d7b0df (commit) from 3981603761a1cc6fb74ff135fadf4ab3340be1c5 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit ff6a1bebd589637a4aecb9c76b4e33f579d7b0df Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Mon Feb 9 12:41:29 2009 -0500 [Bug 6069] Add a fstatvfs function for libsmbclient - Add initial test implementation. This works on a Linux client to determine whether a connection's server supports UNIX CIFS. I'm eager to see what the build farm has to say about this, specifically how many, if any, hosts don't provide a statvfs.h file with the requisite struct statvfs. Derrell --- Summary of changes: examples/libsmbclient/Makefile |5 source/include/libsmb_internal.h |7 ++ source/include/libsmbclient.h| 45 ++ source/libsmb/libsmb_compat.c|8 ++ source/libsmb/libsmb_context.c |1 + source/libsmb/libsmb_setget.c| 12 ++ source/libsmb/libsmb_stat.c | 21 + 7 files changed, 99 insertions(+), 0 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 047addc..7ad28dc 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -24,6 +24,7 @@ TESTS=testsmbc \ teststat \ teststat2 \ teststat3 \ + testfstatvfs \ testtruncate \ testchmod \ testutime \ @@ -74,6 +75,10 @@ teststat3: teststat3.o @echo Linking teststat3 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt +testfstatvfs: testfstatvfs.o + @echo Linking testfstatvfs + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt + testtruncate: testtruncate.o @echo Linking testtruncate $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index 67add07..edf3a6e 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -197,6 +197,7 @@ struct SMBC_internal_data { smbc_stat_fnstat_fn; smbc_fstat_fn fstat_fn; #endif +smbc_fstatvfs_fnfstatvfs_fn; smbc_ftruncate_fn ftruncate_fn; #if 0 /* Left in libsmbclient.h for backward compatibility */ smbc_close_fn close_fn; @@ -501,6 +502,12 @@ SMBC_fstat_ctx(SMBCCTX *context, struct stat *st); +int +SMBC_fstatvfs_ctx(SMBCCTX *context, + SMBCFILE *file, + struct statvfs *st); + + /* Functions in libsmb_xattr.c */ int SMBC_setxattr_ctx(SMBCCTX *context, diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index b2d9483..575bef6 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -174,6 +174,22 @@ typedef enum smbc_smb_encrypt_level } smbc_smb_encrypt_level; +/** + * Capabilities set in the f_flag field of struct statvfs, from + * smbc_statvfs(). These may be OR-ed together to reflect a full set of + * available capabilities. + */ +typedef enum smbc_vfs_capability +{ +/* Defined by POSIX or in Linux include files (low-order bits) */ +SMBC_VFS_CAP_RDONLY = (1 0), + +/* Specific to libsmbclient (high-order bits) */ +SMBC_VFS_CAP_DFS= (1 29), +SMBC_VFS_CAP_CASE_SENSITIVE = (1 30), +SMBC_VFS_CAP_UNIXCIFS = (1 31) +} smbc_vfs_capability; + typedef int smbc_bool; @@ -853,6 +869,12 @@ typedef int (*smbc_fstat_fn)(SMBCCTX *c, smbc_fstat_fn smbc_getFunctionFstat(SMBCCTX *c); void smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn); +typedef int (*smbc_fstatvfs_fn)(SMBCCTX *c, +SMBCFILE *file, +struct statvfs *st); +smbc_fstatvfs_fn smbc_getFunctionFstatVFS(SMBCCTX *c); +void smbc_setFunctionFstatVFS(SMBCCTX *c, smbc_fstatvfs_fn fn); + typedef int (*smbc_ftruncate_fn)(SMBCCTX *c, SMBCFILE *f, off_t size); @@ -1592,6 +1614,29 @@ int smbc_fstat(int fd, struct stat *st); /*...@ingroup attribute + * Get file system information via an file descriptor. + * + * @param fdOpen file handle from smbc_open(), smbc_creat(), + * or smbc_opendir() + * + * @param stpointer to a buffer that will be filled with + * standard Unix struct statvfs information. + * + * @return EBADF filedes is bad. + * - EACCES Permission denied
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4926-gdf15e8f
The branch, v3-3-test has been updated via df15e8f84d108f8e9df1408155b0f9ccc44da3fe (commit) from c8e295a1b5216c1190ec5d555606b3eadabab82a (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit df15e8f84d108f8e9df1408155b0f9ccc44da3fe Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Mon Feb 9 22:46:29 2009 -0500 [Bug 6069] Add a fstatvfs function for libsmbclient - Complete the implementation of the f_flag field. We now return a flag indicatin UNIX CIFS, CASE SENSITIVE, and/or DFS support. Derrell --- Summary of changes: examples/libsmbclient/testfstatvfs.c | 101 ++ source/libsmb/libsmb_stat.c | 27 - 2 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 examples/libsmbclient/testfstatvfs.c Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c new file mode 100644 index 000..9db70cf --- /dev/null +++ b/examples/libsmbclient/testfstatvfs.c @@ -0,0 +1,101 @@ +#include sys/types.h +#include sys/statvfs.h +#include stdio.h +#include unistd.h +#include string.h +#include time.h +#include errno.h +#include libsmbclient.h +#include get_auth_data_fn.h + + +int main(int argc, char * argv[]) +{ +int i; +int fd; +int ret; +int debug = 0; +char * p; +charpath[2048]; +struct stat statbuf; +struct statvfs statvfsbuf; + +smbc_init(get_auth_data_fn, debug); + +for (;;) +{ +fprintf(stdout, Path: ); +*path = '\0'; +fgets(path, sizeof(path) - 1, stdin); +if (strlen(path) == 0) +{ +return 0; +} + +p = path + strlen(path) - 1; +if (*p == '\n') +{ +*p = '\0'; +} + +/* Determine if it's a file or a folder */ +if (smbc_stat(path, statbuf) 0) +{ +perror(smbc_stat); +continue; +} + +if (S_ISREG(statbuf.st_mode)) +{ +if ((fd = smbc_open(path, O_RDONLY, 0)) 0) +{ +perror(smbc_open); +continue; +} +} +else +{ +if ((fd = smbc_opendir(path)) 0) +{ +perror(smbc_opendir); +continue; +} +} + +ret = smbc_fstatvfs(fd, statvfsbuf); + +smbc_close(fd); + +if (ret 0) +{ +perror(fstatvfs); +} +else if (statvfsbuf.f_flag == 0) +{ +printf(No capabilities found\n); +} +else +{ +printf(Capabilities: ); + +if (statvfsbuf.f_flag SMBC_VFS_CAP_UNIXCIFS) +{ +printf(UNIXCIFS ); +} + +if (statvfsbuf.f_flag SMBC_VFS_CAP_CASE_SENSITIVE) +{ +printf(CASE_SENSITIVE ); +} + +if (statvfsbuf.f_flag SMBC_VFS_CAP_DFS) +{ +printf(DFS ); +} + +printf(\n); +} +} + +return 0; +} diff --git a/source/libsmb/libsmb_stat.c b/source/libsmb/libsmb_stat.c index a9c3647..71dc1d1 100644 --- a/source/libsmb/libsmb_stat.c +++ b/source/libsmb/libsmb_stat.c @@ -310,14 +310,37 @@ SMBC_fstatvfs_ctx(SMBCCTX *context, SMBCFILE *file, struct statvfs *st) { + uint32 fs_attrs = 0; + struct cli_state *cli = file-srv-cli; + /* Initialize all fields (at least until we actually use them) */ memset(st, 0, sizeof(*st)); /* See if the server has UNIX CIFS support */ -if (SERVER_HAS_UNIX_CIFS(file-srv-cli)) -{ +if (SERVER_HAS_UNIX_CIFS(cli)) { st-f_flag |= SMBC_VFS_CAP_UNIXCIFS; } +/* See if the share is case sensitive */ +if (!cli_get_fs_attr_info(cli, fs_attrs)) { +/* + * We can't determine the case sensitivity of + * the share. We have no choice but to use the + * user-specified case sensitivity setting. + */ +if (smbc_getOptionCaseSensitive(context)) { +st-f_flag |= SMBC_VFS_CAP_CASE_SENSITIVE; +} +} else { +if (fs_attrs FILE_CASE_SENSITIVE_SEARCH) { +st-f_flag |= SMBC_VFS_CAP_CASE_SENSITIVE; +} +} + +/* See if DFS is supported */ + if ((cli-capabilities CAP_DFS) cli-dfsroot) { +st-f_flag |= SMBC_VFS_CAP_DFS; +} + return 0; } -- Samba Shared
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4917-gb657020
The branch, v3-3-test has been updated via b657020d0a3d43099e55956d13a7a73324888bcb (commit) from 45d75ece3e35b5180e82dc0488b13fbd2a93c41e (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit b657020d0a3d43099e55956d13a7a73324888bcb Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sun Feb 8 22:07:25 2009 -0500 eliminate compiler warnings --- Summary of changes: source/libsmb/libsmb_xattr.c | 14 -- 1 files changed, 8 insertions(+), 6 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmb_xattr.c b/source/libsmb/libsmb_xattr.c index 4983018..21a3b01 100644 --- a/source/libsmb/libsmb_xattr.c +++ b/source/libsmb/libsmb_xattr.c @@ -1501,7 +1501,7 @@ cacl_set(TALLOC_CTX *ctx, struct cli_state *ipc_cli, POLICY_HND *pol, const char *filename, - const char *the_acl, + char *the_acl, int mode, int flags) { @@ -1531,8 +1531,7 @@ cacl_set(TALLOC_CTX *ctx, the_acl = p + 1; } -sd = sec_desc_parse(ctx, ipc_cli, pol, numeric, -CONST_DISCARD(char *, the_acl)); +sd = sec_desc_parse(ctx, ipc_cli, pol, numeric, the_acl); if (!sd) { errno = EINVAL; @@ -2114,11 +2113,13 @@ SMBC_getxattr_ctx(SMBCCTX *context, StrCaseCmp(name, system.dos_attr.inode) == 0) { /* Yup. */ +char *filename = (char *) name; ret = cacl_get(context, talloc_tos(), srv, ipc_srv == NULL ? NULL : ipc_srv-cli, ipc_srv-pol, path, - CONST_DISCARD(char *, name), - CONST_DISCARD(char *, value), size); + filename, + CONST_DISCARD(char *, value), + size); if (ret 0 errno == 0) { errno = SMBC_errno(context, srv-cli); } @@ -2237,7 +2238,8 @@ SMBC_removexattr_ctx(SMBCCTX *context, /* Yup. */ ret = cacl_set(talloc_tos(), srv-cli, ipc_srv-cli, ipc_srv-pol, path, - name + 19, SMBC_XATTR_MODE_REMOVE, 0); + CONST_DISCARD(char *, name) + 19, + SMBC_XATTR_MODE_REMOVE, 0); TALLOC_FREE(frame); return ret; } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - 6d300399b52e0921ce205ef2f053b722b21edeeb
The branch, master has been updated via 6d300399b52e0921ce205ef2f053b722b21edeeb (commit) from 9b3c38f4afe2b15159c8659b5916740493f7b60c (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 6d300399b52e0921ce205ef2f053b722b21edeeb Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Jan 17 13:33:25 2009 -0500 Determine case sensitivity based on file system attributes. - Most of the time, we can determine from the file system we're connecting to whether it supports case sensitivity. In those cases, we now set the internal case sensitivity flag automatically. For those cases where the request to retrieve file system attributes fails, we'll use the user-specified option value. Derrell --- Summary of changes: source3/include/libsmbclient.h | 16 - source3/libsmb/libsmb_context.c |2 +- source3/libsmb/libsmb_server.c | 71 ++ source3/libsmb/libsmb_setget.c | 16 - 4 files changed, 92 insertions(+), 13 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index 4a8accb..b2d9483 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -550,11 +550,23 @@ smbc_getOptionSmbEncryptionLevel(SMBCCTX *c); void smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level); -/** Get whether to treat file names as case-sensitive. */ +/** + * Get whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ smbc_bool smbc_getOptionCaseSensitive(SMBCCTX *c); -/** Set whether to treat file names as case-sensitive. */ +/** + * Set whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ void smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b); diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index ca8ceed..c2c33e5 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -69,7 +69,7 @@ smbc_new_context(void) smbc_setOptionFullTimeNames(context, False); smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE); smbc_setOptionSmbEncryptionLevel(context, SMBC_ENCRYPTLEVEL_NONE); -smbc_setOptionCaseSensitive(context, True); +smbc_setOptionCaseSensitive(context, False); smbc_setOptionBrowseMaxLmbCount(context, 3);/* # LMBs to query */ smbc_setOptionUrlEncodeReaddirEntries(context, False); smbc_setOptionOneSharePerServer(context, False); diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c index e2cc071..0ece5bb 100644 --- a/source3/libsmb/libsmb_server.c +++ b/source3/libsmb/libsmb_server.c @@ -245,6 +245,8 @@ SMBC_server(TALLOC_CTX *ctx, int tried_reverse = 0; int port_try_first; int port_try_next; +int is_ipc = (share != NULL strcmp(share, IPC$) == 0); + uint32 fs_attrs = 0; const char *username_used; NTSTATUS status; @@ -310,6 +312,38 @@ SMBC_server(TALLOC_CTX *ctx, srv = NULL; } +/* Determine if this share supports case sensitivity */ +if (is_ipc) { +DEBUG(4, + (IPC$ so ignore case sensitivity\n)); +} else if (!cli_get_fs_attr_info(c, fs_attrs)) { +DEBUG(4, (Could not retrieve + case sensitivity flag: %s.\n, + cli_errstr(c))); + +/* + * We can't determine the case sensitivity of + * the share. We have no choice but to use the + * user-specified case sensitivity setting. + */ +if (smbc_getOptionCaseSensitive(context)) { +cli_set_case_sensitive(c, True); +} else { +cli_set_case_sensitive(c, False
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3371-gded8642
The branch, v3-2-test has been updated via ded86426c222b11b9c2e8d8e4cae5ed0eff19edd (commit) from 91d30b8a3406d01b5fca97a96ad5964703813f0e (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit ded86426c222b11b9c2e8d8e4cae5ed0eff19edd Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Jan 17 13:35:12 2009 -0500 Determine case sensitivity based on file system attributes. - Most of the time, we can determine from the file system we're connecting to whether it supports case sensitivity. In those cases, we now set the internal case sensitivity flag automatically. For those cases where the request to retrieve file system attributes fails, we'll use the user-specified option value. Derrell --- Summary of changes: source/include/libsmbclient.h | 16 - source/libsmb/libsmb_context.c |2 +- source/libsmb/libsmb_server.c | 71 +++ source/libsmb/libsmb_setget.c | 16 - 4 files changed, 92 insertions(+), 13 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index da2e03c..70f63de 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -550,11 +550,23 @@ smbc_getOptionSmbEncryptionLevel(SMBCCTX *c); void smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level); -/** Get whether to treat file names as case-sensitive. */ +/** + * Get whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ smbc_bool smbc_getOptionCaseSensitive(SMBCCTX *c); -/** Set whether to treat file names as case-sensitive. */ +/** + * Set whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ void smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b); diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c index ec42b34..0193e90 100644 --- a/source/libsmb/libsmb_context.c +++ b/source/libsmb/libsmb_context.c @@ -69,7 +69,7 @@ smbc_new_context(void) smbc_setOptionFullTimeNames(context, False); smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE); smbc_setOptionSmbEncryptionLevel(context, SMBC_ENCRYPTLEVEL_NONE); -smbc_setOptionCaseSensitive(context, True); +smbc_setOptionCaseSensitive(context, False); smbc_setOptionBrowseMaxLmbCount(context, 3);/* # LMBs to query */ smbc_setOptionUrlEncodeReaddirEntries(context, False); smbc_setOptionOneSharePerServer(context, False); diff --git a/source/libsmb/libsmb_server.c b/source/libsmb/libsmb_server.c index d374ac1..91a77fe 100644 --- a/source/libsmb/libsmb_server.c +++ b/source/libsmb/libsmb_server.c @@ -245,6 +245,8 @@ SMBC_server(TALLOC_CTX *ctx, int tried_reverse = 0; int port_try_first; int port_try_next; +int is_ipc = (share != NULL strcmp(share, IPC$) == 0); + uint32 fs_attrs = 0; const char *username_used; NTSTATUS status; @@ -310,6 +312,38 @@ SMBC_server(TALLOC_CTX *ctx, srv = NULL; } +/* Determine if this share supports case sensitivity */ +if (is_ipc) { +DEBUG(4, + (IPC$ so ignore case sensitivity\n)); +} else if (!cli_get_fs_attr_info(c, fs_attrs)) { +DEBUG(4, (Could not retrieve + case sensitivity flag: %s.\n, + cli_errstr(c))); + +/* + * We can't determine the case sensitivity of + * the share. We have no choice but to use the + * user-specified case sensitivity setting. + */ +if (smbc_getOptionCaseSensitive(context)) { +cli_set_case_sensitive(c, True); +} else { +cli_set_case_sensitive(c, False
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4834-g005bd7e
The branch, v3-3-test has been updated via 005bd7eee44160e4531e46be85c67650821a8328 (commit) from c07bcd6efd3383fc3a46fce35fd34df85ab221c9 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 005bd7eee44160e4531e46be85c67650821a8328 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Sat Jan 17 13:21:54 2009 -0500 Determine case sensitivity based on file system attributes. - Most of the time, we can determine from the file system we're connecting to whether it supports case sensitivity. In those cases, we now set the internal case sensitivity flag automatically. For those cases where the request to retrieve file system attributes fails, we'll use the user-specified option value. Derrell --- Summary of changes: source/include/libsmbclient.h | 16 - source/libsmb/libsmb_context.c |2 +- source/libsmb/libsmb_server.c | 71 +++ source/libsmb/libsmb_setget.c | 16 - 4 files changed, 92 insertions(+), 13 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 4a8accb..b2d9483 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -550,11 +550,23 @@ smbc_getOptionSmbEncryptionLevel(SMBCCTX *c); void smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level); -/** Get whether to treat file names as case-sensitive. */ +/** + * Get whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ smbc_bool smbc_getOptionCaseSensitive(SMBCCTX *c); -/** Set whether to treat file names as case-sensitive. */ +/** + * Set whether to treat file names as case-sensitive if we can't determine + * when connecting to the remote share whether the file system is case + * sensitive. This defaults to FALSE since it's most likely that if we can't + * retrieve the file system attributes, it's a very old file system that does + * not support case sensitivity. + */ void smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b); diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c index 0efb5fc..c9e9c34 100644 --- a/source/libsmb/libsmb_context.c +++ b/source/libsmb/libsmb_context.c @@ -69,7 +69,7 @@ smbc_new_context(void) smbc_setOptionFullTimeNames(context, False); smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE); smbc_setOptionSmbEncryptionLevel(context, SMBC_ENCRYPTLEVEL_NONE); -smbc_setOptionCaseSensitive(context, True); +smbc_setOptionCaseSensitive(context, False); smbc_setOptionBrowseMaxLmbCount(context, 3);/* # LMBs to query */ smbc_setOptionUrlEncodeReaddirEntries(context, False); smbc_setOptionOneSharePerServer(context, False); diff --git a/source/libsmb/libsmb_server.c b/source/libsmb/libsmb_server.c index 91c04ce..0c411ea 100644 --- a/source/libsmb/libsmb_server.c +++ b/source/libsmb/libsmb_server.c @@ -245,6 +245,8 @@ SMBC_server(TALLOC_CTX *ctx, int tried_reverse = 0; int port_try_first; int port_try_next; +int is_ipc = (share != NULL strcmp(share, IPC$) == 0); + uint32 fs_attrs = 0; const char *username_used; NTSTATUS status; @@ -310,6 +312,38 @@ SMBC_server(TALLOC_CTX *ctx, srv = NULL; } +/* Determine if this share supports case sensitivity */ +if (is_ipc) { +DEBUG(4, + (IPC$ so ignore case sensitivity\n)); +} else if (!cli_get_fs_attr_info(c, fs_attrs)) { +DEBUG(4, (Could not retrieve + case sensitivity flag: %s.\n, + cli_errstr(c))); + +/* + * We can't determine the case sensitivity of + * the share. We have no choice but to use the + * user-specified case sensitivity setting. + */ +if (smbc_getOptionCaseSensitive(context)) { +cli_set_case_sensitive(c, True); +} else { +cli_set_case_sensitive(c, False
[SCM] Samba Shared Repository - branch master updated - 1c77c7f3d5b6cb29fac4606299c237c0e299f836
The branch, master has been updated via 1c77c7f3d5b6cb29fac4606299c237c0e299f836 (commit) from 3fe974c4feed33187294a0cb922c20f7dbfeaf43 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 1c77c7f3d5b6cb29fac4606299c237c0e299f836 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Jan 16 16:41:36 2009 -0500 Treat file names in POSIX-like case-sensitive fashion by default *** THIS COMMIT CAUSES A CHANGE OF DEFAULT BEHAVIOR IN libsmbclient!!! *** - libsmbclient now calls cli_set_case_sensitive() for a new CLI. By default, it requests case-sensitive, but the old behavior of case-insensitive can be requested with smbc_setOptionCaseSensitive(context, False); The change of behavior is considered a bug fix, as it was previously possible to accidentally overwrite a file that had the same case-insensitive name but a different case-sensitive name as a previously-existing file, while creating a new file. Derrell --- Summary of changes: source3/include/libsmb_internal.h |5 + source3/include/libsmbclient.h|9 + source3/libsmb/libsmb_context.c |1 + source3/libsmb/libsmb_server.c|7 +++ source3/libsmb/libsmb_setget.c| 14 ++ 5 files changed, 36 insertions(+), 0 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index b488116..8b410b4 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -176,6 +176,11 @@ struct SMBC_internal_data { */ smbc_smb_encrypt_level smb_encryption_level; +/* + * Should we request case sensitivity of file names? + */ +boolcase_sensitive; + struct smbc_server_cache * server_cache; /* POSIX emulation functions */ diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index a8b27b7..4a8accb 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -550,6 +550,15 @@ smbc_getOptionSmbEncryptionLevel(SMBCCTX *c); void smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level); +/** Get whether to treat file names as case-sensitive. */ +smbc_bool +smbc_getOptionCaseSensitive(SMBCCTX *c); + +/** Set whether to treat file names as case-sensitive. */ +void +smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b); + + /** * Get from how many local master browsers should the list of workgroups be * retrieved. It can take up to 12 minutes or longer after a server becomes a diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index 66329e2..ca8ceed 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -69,6 +69,7 @@ smbc_new_context(void) smbc_setOptionFullTimeNames(context, False); smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE); smbc_setOptionSmbEncryptionLevel(context, SMBC_ENCRYPTLEVEL_NONE); +smbc_setOptionCaseSensitive(context, True); smbc_setOptionBrowseMaxLmbCount(context, 3);/* # LMBs to query */ smbc_setOptionUrlEncodeReaddirEntries(context, False); smbc_setOptionOneSharePerServer(context, False); diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c index f471434..e2cc071 100644 --- a/source3/libsmb/libsmb_server.c +++ b/source3/libsmb/libsmb_server.c @@ -356,6 +356,13 @@ again: return NULL; } + /* POSIX-like - always request case-sensitivity by default. */ +if (smbc_getOptionCaseSensitive(context)) { +cli_set_case_sensitive(c, True); +} else { +cli_set_case_sensitive(c, False); +} + if (smbc_getOptionUseKerberos(context)) { c-use_kerberos = True; } diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c index d0823bd..bca2a80 100644 --- a/source3/libsmb/libsmb_setget.c +++ b/source3/libsmb/libsmb_setget.c @@ -193,6 +193,20 @@ smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level) c-internal-smb_encryption_level = level; } +/** Get whether to treat file names as case-sensitive. */ +smbc_bool +smbc_getOptionCaseSensitive(SMBCCTX *c) +{ +return c-internal-case_sensitive; +} + +/** Set whether to treat file names as case-sensitive. */ +void +smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b) +{ +c-internal-case_sensitive = b; +} + /** * Get from how many local master browsers should the list of workgroups be * retrieved. It can take up to 12 minutes or longer after a server becomes a -- Samba Shared
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4829-g20b765f
The branch, v3-3-test has been updated via 20b765f0a20fe7329559e4bf2a9dac4fe8e13c18 (commit) from 7dbebf3691576bce54ed5012b4c3d48570bdff01 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 20b765f0a20fe7329559e4bf2a9dac4fe8e13c18 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Jan 16 15:55:08 2009 -0500 Treat file names in POSIX-like case-sensitive fashion by default *** THIS COMMIT CAUSES A CHANGE OF DEFAULT BEHAVIOR IN libsmbclient!!! *** - libsmbclient now calls cli_set_case_sensitive() for a new CLI. By default, it requests case-sensitive, but the old behavior of case-insensitive can be requested with smbc_setOptionCaseSensitive(context, False); The change of behavior is considered a bug fix, as it was previously possible to accidentally overwrite a file that had the same case-insensitive name but a different case-sensitive name as a previously-existing file, while creating a new file. Derrell --- Summary of changes: source/include/libsmb_internal.h |5 + source/include/libsmbclient.h|9 + source/libsmb/libsmb_context.c |1 + source/libsmb/libsmb_server.c|9 - source/libsmb/libsmb_setget.c| 14 ++ 5 files changed, 37 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index b488116..8b410b4 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -176,6 +176,11 @@ struct SMBC_internal_data { */ smbc_smb_encrypt_level smb_encryption_level; +/* + * Should we request case sensitivity of file names? + */ +boolcase_sensitive; + struct smbc_server_cache * server_cache; /* POSIX emulation functions */ diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index a8b27b7..4a8accb 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -550,6 +550,15 @@ smbc_getOptionSmbEncryptionLevel(SMBCCTX *c); void smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level); +/** Get whether to treat file names as case-sensitive. */ +smbc_bool +smbc_getOptionCaseSensitive(SMBCCTX *c); + +/** Set whether to treat file names as case-sensitive. */ +void +smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b); + + /** * Get from how many local master browsers should the list of workgroups be * retrieved. It can take up to 12 minutes or longer after a server becomes a diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c index 1984338..0efb5fc 100644 --- a/source/libsmb/libsmb_context.c +++ b/source/libsmb/libsmb_context.c @@ -69,6 +69,7 @@ smbc_new_context(void) smbc_setOptionFullTimeNames(context, False); smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE); smbc_setOptionSmbEncryptionLevel(context, SMBC_ENCRYPTLEVEL_NONE); +smbc_setOptionCaseSensitive(context, True); smbc_setOptionBrowseMaxLmbCount(context, 3);/* # LMBs to query */ smbc_setOptionUrlEncodeReaddirEntries(context, False); smbc_setOptionOneSharePerServer(context, False); diff --git a/source/libsmb/libsmb_server.c b/source/libsmb/libsmb_server.c index 9b4d3f6..91c04ce 100644 --- a/source/libsmb/libsmb_server.c +++ b/source/libsmb/libsmb_server.c @@ -355,7 +355,14 @@ again: errno = ENOMEM; return NULL; } - + + /* POSIX-like - always request case-sensitivity by default. */ +if (smbc_getOptionCaseSensitive(context)) { +cli_set_case_sensitive(c, True); +} else { +cli_set_case_sensitive(c, False); +} + if (smbc_getOptionUseKerberos(context)) { c-use_kerberos = True; } diff --git a/source/libsmb/libsmb_setget.c b/source/libsmb/libsmb_setget.c index d0823bd..bca2a80 100644 --- a/source/libsmb/libsmb_setget.c +++ b/source/libsmb/libsmb_setget.c @@ -193,6 +193,20 @@ smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level) c-internal-smb_encryption_level = level; } +/** Get whether to treat file names as case-sensitive. */ +smbc_bool +smbc_getOptionCaseSensitive(SMBCCTX *c) +{ +return c-internal-case_sensitive; +} + +/** Set whether to treat file names as case-sensitive. */ +void +smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b) +{ +c-internal-case_sensitive = b; +} + /** * Get from how many local master browsers should the list of workgroups be * retrieved. It can take up to 12 minutes or longer after a server becomes
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3369-gac4baaf
The branch, v3-2-test has been updated via ac4baafeb8d74bf1db7f2ce84b2bc3abdef90337 (commit) from d9f66f3e3d9af9c3323029207e62391f382632e9 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit ac4baafeb8d74bf1db7f2ce84b2bc3abdef90337 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Jan 16 16:00:41 2009 -0500 Treat file names in POSIX-like case-sensitive fashion by default *** THIS COMMIT CAUSES A CHANGE OF DEFAULT BEHAVIOR IN libsmbclient!!! *** - libsmbclient now calls cli_set_case_sensitive() for a new CLI. By default, it requests case-sensitive, but the old behavior of case-insensitive can be requested with smbc_setOptionCaseSensitive(context, False); The change of behavior is considered a bug fix, as it was previously possible to accidentally overwrite a file that had the same case-insensitive name but a different case-sensitive name as a previously-existing file, while creating a new file. Derrell --- Summary of changes: source/include/libsmb_internal.h |5 + source/include/libsmbclient.h|9 + source/libsmb/libsmb_context.c |1 + source/libsmb/libsmb_server.c|9 - source/libsmb/libsmb_setget.c| 14 ++ 5 files changed, 37 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index 7cf0330..307d6b2 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -176,6 +176,11 @@ struct SMBC_internal_data { */ smbc_smb_encrypt_level smb_encryption_level; +/* + * Should we request case sensitivity of file names? + */ +boolcase_sensitive; + struct smbc_server_cache * server_cache; /* POSIX emulation functions */ diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 74d0d5c..da2e03c 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -550,6 +550,15 @@ smbc_getOptionSmbEncryptionLevel(SMBCCTX *c); void smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level); +/** Get whether to treat file names as case-sensitive. */ +smbc_bool +smbc_getOptionCaseSensitive(SMBCCTX *c); + +/** Set whether to treat file names as case-sensitive. */ +void +smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b); + + /** * Get from how many local master browsers should the list of workgroups be * retrieved. It can take up to 12 minutes or longer after a server becomes a diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c index 5e075d1..ec42b34 100644 --- a/source/libsmb/libsmb_context.c +++ b/source/libsmb/libsmb_context.c @@ -69,6 +69,7 @@ smbc_new_context(void) smbc_setOptionFullTimeNames(context, False); smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE); smbc_setOptionSmbEncryptionLevel(context, SMBC_ENCRYPTLEVEL_NONE); +smbc_setOptionCaseSensitive(context, True); smbc_setOptionBrowseMaxLmbCount(context, 3);/* # LMBs to query */ smbc_setOptionUrlEncodeReaddirEntries(context, False); smbc_setOptionOneSharePerServer(context, False); diff --git a/source/libsmb/libsmb_server.c b/source/libsmb/libsmb_server.c index 4581d84..d374ac1 100644 --- a/source/libsmb/libsmb_server.c +++ b/source/libsmb/libsmb_server.c @@ -355,7 +355,14 @@ again: errno = ENOMEM; return NULL; } - + + /* POSIX-like - always request case-sensitivity by default. */ +if (smbc_getOptionCaseSensitive(context)) { +cli_set_case_sensitive(c, True); +} else { +cli_set_case_sensitive(c, False); +} + if (smbc_getOptionUseKerberos(context)) { c-use_kerberos = True; } diff --git a/source/libsmb/libsmb_setget.c b/source/libsmb/libsmb_setget.c index d0823bd..bca2a80 100644 --- a/source/libsmb/libsmb_setget.c +++ b/source/libsmb/libsmb_setget.c @@ -193,6 +193,20 @@ smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level) c-internal-smb_encryption_level = level; } +/** Get whether to treat file names as case-sensitive. */ +smbc_bool +smbc_getOptionCaseSensitive(SMBCCTX *c) +{ +return c-internal-case_sensitive; +} + +/** Set whether to treat file names as case-sensitive. */ +void +smbc_setOptionCaseSensitive(SMBCCTX *c, smbc_bool b) +{ +c-internal-case_sensitive = b; +} + /** * Get from how many local master browsers should the list of workgroups be * retrieved. It can take up to 12 minutes or longer after a server becomes
Re: [SCM] Samba Shared Repository - branch master updated - 1c77c7f3d5b6cb29fac4606299c237c0e299f836
On Fri, Jan 16, 2009 at 5:59 PM, simo i...@samba.org wrote: On Fri, 2009-01-16 at 15:42 -0600, Derrell Lipman wrote: + /* POSIX-like - always request case-sensitivity by default. */ +if (smbc_getOptionCaseSensitive(context)) { +cli_set_case_sensitive(c, True); +} else { +cli_set_case_sensitive(c, False); +} + if (smbc_getOptionUseKerberos(context)) { c-use_kerberos = True; } Derrell, *if* I am readying the code right, now every connection defaults to case sensitive ? If so I think this would break in case the server is case-insensitive. Shouldn't this options set to true by default only if the remote server *is* case sensitive ? I can't imagine why there would be a function for specifying the case sensitivity (cli_set_case_sensitive) if it were possible to determine whether the remote server *is* case sensitive. If it is possible then the case-sensitive setting should be automatically configured when the connection is established. What am I missing here? Is there ever a time that you'd want case sensitive when the server is not, or vice versa? Derrell
[SCM] Samba Shared Repository - branch master updated - c6b4f3526a262b22d5a97a3152f378778a497a26
The branch, master has been updated via c6b4f3526a262b22d5a97a3152f378778a497a26 (commit) from 1c77c7f3d5b6cb29fac4606299c237c0e299f836 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit c6b4f3526a262b22d5a97a3152f378778a497a26 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Jan 16 20:26:46 2009 -0500 [Bug 6022] smbc_urlencode and smbc_urldecode were not exported - Since the revamp of libsmbclient, there has still been an external declaration for smbc_urlencode and smbc_urldecode in libsmbclient.h, yet those functions were renamed and made private. The two choices were to remove the function names from libsmbclient.h or to make them public again. The reported requested that they be public. This commit makes it so. Derrell --- Summary of changes: source3/include/libsmb_internal.h | 10 -- source3/libsmb/libsmb_dir.c |2 +- source3/libsmb/libsmb_path.c |8 3 files changed, 5 insertions(+), 15 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index 8b410b4..67add07 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -402,16 +402,6 @@ SMBC_errno(SMBCCTX *context, /* Functions in libsmb_path.c */ int -SMBC_urldecode(char *dest, - char *src, - size_t max_dest_len); - -int -SMBC_urlencode(char *dest, - char *src, - int max_dest_len); - -int SMBC_parse_path(TALLOC_CTX *ctx, SMBCCTX *context, const char *fname, diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index 770014b..e9b7b4f 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -895,7 +895,7 @@ smbc_readdir_internal(SMBCCTX * context, /* url-encode the name. get back remaining buffer space */ max_namebuf_len = -SMBC_urlencode(dest-name, src-name, max_namebuf_len); +smbc_urlencode(dest-name, src-name, max_namebuf_len); /* We now know the name length */ dest-namelen = strlen(dest-name); diff --git a/source3/libsmb/libsmb_path.c b/source3/libsmb/libsmb_path.c index b0970d4..6d69924 100644 --- a/source3/libsmb/libsmb_path.c +++ b/source3/libsmb/libsmb_path.c @@ -41,7 +41,7 @@ hex2int( unsigned int _char ) } /* - * SMBC_urldecode() + * smbc_urldecode() * and urldecode_talloc() (internal fn.) * * Convert strings of %xx to their single character equivalent. Each 'x' must @@ -122,7 +122,7 @@ urldecode_talloc(TALLOC_CTX *ctx, char **pp_dest, const char *src) } int -SMBC_urldecode(char *dest, +smbc_urldecode(char *dest, char *src, size_t max_dest_len) { @@ -138,7 +138,7 @@ SMBC_urldecode(char *dest, } /* - * SMBC_urlencode() + * smbc_urlencode() * * Convert any characters not specifically allowed in a URL into their %xx * equivalent. @@ -146,7 +146,7 @@ SMBC_urldecode(char *dest, * Returns the remaining buffer length. */ int -SMBC_urlencode(char *dest, +smbc_urlencode(char *dest, char *src, int max_dest_len) { -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4830-gbf7eb01
The branch, v3-3-test has been updated via bf7eb0164b0c69d5d0f3019f3aa524846f6a4394 (commit) from 20b765f0a20fe7329559e4bf2a9dac4fe8e13c18 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit bf7eb0164b0c69d5d0f3019f3aa524846f6a4394 Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Jan 16 20:30:11 2009 -0500 [Bug 6022] smbc_urlencode and smbc_urldecode were not exported - Since the revamp of libsmbclient, there has still been an external declaration for smbc_urlencode and smbc_urldecode in libsmbclient.h, yet those functions were renamed and made private. The two choices were to remove the function names from libsmbclient.h or to make them public again. The reported requested that they be public. This commit makes it so. Derrell --- Summary of changes: source/include/libsmb_internal.h | 10 -- source/libsmb/libsmb_dir.c |2 +- source/libsmb/libsmb_path.c |8 3 files changed, 5 insertions(+), 15 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index 8b410b4..67add07 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -402,16 +402,6 @@ SMBC_errno(SMBCCTX *context, /* Functions in libsmb_path.c */ int -SMBC_urldecode(char *dest, - char *src, - size_t max_dest_len); - -int -SMBC_urlencode(char *dest, - char *src, - int max_dest_len); - -int SMBC_parse_path(TALLOC_CTX *ctx, SMBCCTX *context, const char *fname, diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c index 3b4bdfc..761b805 100644 --- a/source/libsmb/libsmb_dir.c +++ b/source/libsmb/libsmb_dir.c @@ -895,7 +895,7 @@ smbc_readdir_internal(SMBCCTX * context, /* url-encode the name. get back remaining buffer space */ max_namebuf_len = -SMBC_urlencode(dest-name, src-name, max_namebuf_len); +smbc_urlencode(dest-name, src-name, max_namebuf_len); /* We now know the name length */ dest-namelen = strlen(dest-name); diff --git a/source/libsmb/libsmb_path.c b/source/libsmb/libsmb_path.c index b0970d4..6d69924 100644 --- a/source/libsmb/libsmb_path.c +++ b/source/libsmb/libsmb_path.c @@ -41,7 +41,7 @@ hex2int( unsigned int _char ) } /* - * SMBC_urldecode() + * smbc_urldecode() * and urldecode_talloc() (internal fn.) * * Convert strings of %xx to their single character equivalent. Each 'x' must @@ -122,7 +122,7 @@ urldecode_talloc(TALLOC_CTX *ctx, char **pp_dest, const char *src) } int -SMBC_urldecode(char *dest, +smbc_urldecode(char *dest, char *src, size_t max_dest_len) { @@ -138,7 +138,7 @@ SMBC_urldecode(char *dest, } /* - * SMBC_urlencode() + * smbc_urlencode() * * Convert any characters not specifically allowed in a URL into their %xx * equivalent. @@ -146,7 +146,7 @@ SMBC_urldecode(char *dest, * Returns the remaining buffer length. */ int -SMBC_urlencode(char *dest, +smbc_urlencode(char *dest, char *src, int max_dest_len) { -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3370-g91d30b8
The branch, v3-2-test has been updated via 91d30b8a3406d01b5fca97a96ad5964703813f0e (commit) from ac4baafeb8d74bf1db7f2ce84b2bc3abdef90337 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 91d30b8a3406d01b5fca97a96ad5964703813f0e Author: Derrell Lipman derrell.lip...@unwireduniverse.com Date: Fri Jan 16 20:29:28 2009 -0500 [Bug 6022] smbc_urlencode and smbc_urldecode were not exported - Since the revamp of libsmbclient, there has still been an external declaration for smbc_urlencode and smbc_urldecode in libsmbclient.h, yet those functions were renamed and made private. The two choices were to remove the function names from libsmbclient.h or to make them public again. The reported requested that they be public. This commit makes it so. Derrell --- Summary of changes: source/include/libsmb_internal.h | 10 -- source/libsmb/libsmb_dir.c |2 +- source/libsmb/libsmb_path.c |8 3 files changed, 5 insertions(+), 15 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index 307d6b2..a00547f 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -402,16 +402,6 @@ SMBC_errno(SMBCCTX *context, /* Functions in libsmb_path.c */ int -SMBC_urldecode(char *dest, - char *src, - size_t max_dest_len); - -int -SMBC_urlencode(char *dest, - char *src, - int max_dest_len); - -int SMBC_parse_path(TALLOC_CTX *ctx, SMBCCTX *context, const char *fname, diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c index 5fe2731..b0762e8 100644 --- a/source/libsmb/libsmb_dir.c +++ b/source/libsmb/libsmb_dir.c @@ -894,7 +894,7 @@ smbc_readdir_internal(SMBCCTX * context, /* url-encode the name. get back remaining buffer space */ max_namebuf_len = -SMBC_urlencode(dest-name, src-name, max_namebuf_len); +smbc_urlencode(dest-name, src-name, max_namebuf_len); /* We now know the name length */ dest-namelen = strlen(dest-name); diff --git a/source/libsmb/libsmb_path.c b/source/libsmb/libsmb_path.c index b0970d4..6d69924 100644 --- a/source/libsmb/libsmb_path.c +++ b/source/libsmb/libsmb_path.c @@ -41,7 +41,7 @@ hex2int( unsigned int _char ) } /* - * SMBC_urldecode() + * smbc_urldecode() * and urldecode_talloc() (internal fn.) * * Convert strings of %xx to their single character equivalent. Each 'x' must @@ -122,7 +122,7 @@ urldecode_talloc(TALLOC_CTX *ctx, char **pp_dest, const char *src) } int -SMBC_urldecode(char *dest, +smbc_urldecode(char *dest, char *src, size_t max_dest_len) { @@ -138,7 +138,7 @@ SMBC_urldecode(char *dest, } /* - * SMBC_urlencode() + * smbc_urlencode() * * Convert any characters not specifically allowed in a URL into their %xx * equivalent. @@ -146,7 +146,7 @@ SMBC_urldecode(char *dest, * Returns the remaining buffer length. */ int -SMBC_urlencode(char *dest, +smbc_urlencode(char *dest, char *src, int max_dest_len) { -- Samba Shared Repository
Re: [SCM] Samba Shared Repository - branch master updated - 1c77c7f3d5b6cb29fac4606299c237c0e299f836
I can't imagine why there would be a function for specifying the case sensitivity (cli_set_case_sensitive) if it were possible to determine whether the remote server *is* case sensitive. If it is possible then the case-sensitive setting should be automatically configured when the connection is established. What am I missing here? Is there ever a time that you'd want case sensitive when the server is not, or vice versa? Case sensitivity is something you can negotiate with the server. for example samba is case insensitive normally, but case sensitive when you negotiate unix extensions. I think case sensitivity should be based on what has been negotiated with the server, and not set arbitrarily. Sounds reasonable to me. That should be during connection establishment, shouldn't it? It doesn't sounds like it should be at the application level. I'd certainly appreciate pointers to where in the code that negotiation takes place, and I'll look into proposing a patch that calls cli_set_case_sensitive() automatically depending on the negotiation. That will impact much more than just libsmbclient, so I'll post the patch to the list to get buy-off. Thanks, Derrell
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4702-g2957c03
The branch, v3-3-test has been updated via 2957c03ab59735159aaf108e87a2e571f984fb5d (commit) from 085f4cdb90b12d60804001fd60659a4aa4a174fd (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 2957c03ab59735159aaf108e87a2e571f984fb5d Author: SATOH Fumiyasu fumi...@osstech.jp Date: Wed Dec 17 00:54:30 2008 +0900 commit b520befe6f51644d20434add9864d7a2fa30aa2e Author: SATOH Fumiyasu fumi...@osstech.co.jp Date: Wed Dec 17 00:42:25 2008 +0900 libsmbclient: Fix SIGBUS on non-x86 CPUs We must align the struct smbc_dirent in the struct SMBC_internal_data because the struct smbc_dirent has numeric values that require alignment. Signed-off-by: Derrell Lipman derrell.lip...@unwireduniverse.com --- Summary of changes: source/include/libsmb_internal.h | 13 +++-- source/libsmb/libsmb_dir.c | 10 -- 2 files changed, 11 insertions(+), 12 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index 3b909d1..b488116 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -113,18 +113,19 @@ struct SMBC_internal_data { /* True when this handle is initialized */ boolinitialized; -/* dirent pointer location - * +/* dirent pointer location */ + struct smbc_dirent dirent; + /* * Leave room for any urlencoded filename and the comment field. * - * We really should use sizeof(struct smbc_dirent) plus (NAME_MAX * 3) - * plus whatever the max length of a comment is, plus a couple of null - * terminators (one after the filename, one after the comment). +* We use (NAME_MAX * 3) plus whatever the max length of a comment is, +* plus a couple of null terminators (one after the filename, +* one after the comment). * * According to linux/limits.h, NAME_MAX is 255. Is it longer * anyplace else? */ - chardirent[1024]; + char_dirent_name[1024]; /* * server connection list diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c index aa313f2..3b4bdfc 100644 --- a/source/libsmb/libsmb_dir.c +++ b/source/libsmb/libsmb_dir.c @@ -976,9 +976,8 @@ SMBC_readdir_ctx(SMBCCTX *context, } -dirp = (struct smbc_dirent *)context-internal-dirent; -maxlen = (sizeof(context-internal-dirent) - - sizeof(struct smbc_dirent)); +dirp = context-internal-dirent; +maxlen = sizeof(context-internal-_dirent_name); smbc_readdir_internal(context, dirp, dirent, maxlen); @@ -1049,9 +1048,8 @@ SMBC_getdents_ctx(SMBCCTX *context, } /* Do urlencoding of next entry, if so selected */ -dirent = (struct smbc_dirent *)context-internal-dirent; -maxlen = (sizeof(context-internal-dirent) - - sizeof(struct smbc_dirent)); +dirent = context-internal-dirent; +maxlen = sizeof(context-internal-_dirent_name); smbc_readdir_internal(context, dirent, dirlist-dirent, maxlen); -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3282-g3f47eb7
The branch, v3-2-test has been updated via 3f47eb787f5b8499e5580407dc84c904db70b725 (commit) from cb036772d09227f870c2fec3ecd8c3f53787dfbc (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 3f47eb787f5b8499e5580407dc84c904db70b725 Author: SATOH Fumiyasu fumi...@osstech.jp Date: Wed Dec 17 00:54:30 2008 +0900 commit b520befe6f51644d20434add9864d7a2fa30aa2e Author: SATOH Fumiyasu fumi...@osstech.co.jp Date: Wed Dec 17 00:42:25 2008 +0900 libsmbclient: Fix SIGBUS on non-x86 CPUs We must align the struct smbc_dirent in the struct SMBC_internal_data because the struct smbc_dirent has numeric values that require alignment. Signed-off-by: Derrell Lipman derrell.lip...@unwireduniverse.com --- Summary of changes: source/include/libsmb_internal.h | 13 +++-- source/libsmb/libsmb_dir.c | 10 -- 2 files changed, 11 insertions(+), 12 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index 6930812..7cf0330 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -113,18 +113,19 @@ struct SMBC_internal_data { /* True when this handle is initialized */ boolinitialized; -/* dirent pointer location - * +/* dirent pointer location */ + struct smbc_dirent dirent; + /* * Leave room for any urlencoded filename and the comment field. * - * We really should use sizeof(struct smbc_dirent) plus (NAME_MAX * 3) - * plus whatever the max length of a comment is, plus a couple of null - * terminators (one after the filename, one after the comment). +* We use (NAME_MAX * 3) plus whatever the max length of a comment is, +* plus a couple of null terminators (one after the filename, +* one after the comment). * * According to linux/limits.h, NAME_MAX is 255. Is it longer * anyplace else? */ - chardirent[1024]; + char_dirent_name[1024]; /* * server connection list diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c index f836989..5fe2731 100644 --- a/source/libsmb/libsmb_dir.c +++ b/source/libsmb/libsmb_dir.c @@ -975,9 +975,8 @@ SMBC_readdir_ctx(SMBCCTX *context, } -dirp = (struct smbc_dirent *)context-internal-dirent; -maxlen = (sizeof(context-internal-dirent) - - sizeof(struct smbc_dirent)); +dirp = context-internal-dirent; +maxlen = sizeof(context-internal-_dirent_name); smbc_readdir_internal(context, dirp, dirent, maxlen); @@ -1048,9 +1047,8 @@ SMBC_getdents_ctx(SMBCCTX *context, } /* Do urlencoding of next entry, if so selected */ -dirent = (struct smbc_dirent *)context-internal-dirent; -maxlen = (sizeof(context-internal-dirent) - - sizeof(struct smbc_dirent)); +dirent = context-internal-dirent; +maxlen = sizeof(context-internal-_dirent_name); smbc_readdir_internal(context, dirent, dirlist-dirent, maxlen); -- Samba Shared Repository
[SCM] Samba Shared Repository - branch master updated - 4c3aea3f62a76fa62ead66d64941156375fc4501
The branch, master has been updated via 4c3aea3f62a76fa62ead66d64941156375fc4501 (commit) from e48a5cd5d4fc2626b09af16a0ac68c638d081437 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit 4c3aea3f62a76fa62ead66d64941156375fc4501 Author: SATOH Fumiyasu fumi...@osstech.jp Date: Wed Dec 17 00:54:30 2008 +0900 commit b520befe6f51644d20434add9864d7a2fa30aa2e Author: SATOH Fumiyasu fumi...@osstech.co.jp Date: Wed Dec 17 00:42:25 2008 +0900 libsmbclient: Fix SIGBUS on non-x86 CPUs We must align the struct smbc_dirent in the struct SMBC_internal_data because the struct smbc_dirent has numeric values that require alignment. Signed-off-by: Derrell Lipman derrell.lip...@unwireduniverse.com --- Summary of changes: source3/include/libsmb_internal.h | 13 +++-- source3/libsmb/libsmb_dir.c | 10 -- 2 files changed, 11 insertions(+), 12 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index 3b909d1..b488116 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -113,18 +113,19 @@ struct SMBC_internal_data { /* True when this handle is initialized */ boolinitialized; -/* dirent pointer location - * +/* dirent pointer location */ + struct smbc_dirent dirent; + /* * Leave room for any urlencoded filename and the comment field. * - * We really should use sizeof(struct smbc_dirent) plus (NAME_MAX * 3) - * plus whatever the max length of a comment is, plus a couple of null - * terminators (one after the filename, one after the comment). +* We use (NAME_MAX * 3) plus whatever the max length of a comment is, +* plus a couple of null terminators (one after the filename, +* one after the comment). * * According to linux/limits.h, NAME_MAX is 255. Is it longer * anyplace else? */ - chardirent[1024]; + char_dirent_name[1024]; /* * server connection list diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index d12e748..770014b 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -976,9 +976,8 @@ SMBC_readdir_ctx(SMBCCTX *context, } -dirp = (struct smbc_dirent *)context-internal-dirent; -maxlen = (sizeof(context-internal-dirent) - - sizeof(struct smbc_dirent)); +dirp = context-internal-dirent; +maxlen = sizeof(context-internal-_dirent_name); smbc_readdir_internal(context, dirp, dirent, maxlen); @@ -1049,9 +1048,8 @@ SMBC_getdents_ctx(SMBCCTX *context, } /* Do urlencoding of next entry, if so selected */ -dirent = (struct smbc_dirent *)context-internal-dirent; -maxlen = (sizeof(context-internal-dirent) - - sizeof(struct smbc_dirent)); +dirent = context-internal-dirent; +maxlen = sizeof(context-internal-_dirent_name); smbc_readdir_internal(context, dirent, dirlist-dirent, maxlen); -- Samba Shared Repository
Re: [SCM] Samba Shared Repository - branch master updated - be3d9990635fa31e4110285842b1ca98ed4ce53c
On Sat, Dec 13, 2008 at 2:04 PM, Volker Lendecke vlen...@samba.org wrote: commit da6be4102ed1e3d4e20f08dd8944f062d13c759a Author: Volker Lendecke v...@samba.org Date: Sat Dec 13 17:04:12 2008 +0100 Remove a static variable Derrell, please check! Thanks, Volker Volker, yes, your modified code is the right way to do it. Much better than what was there previously. Thanks. Derrell
Re: [SCM] Samba Shared Repository - branch master updated - b881d2ee78f685aea7ae8b67b3e0fb3c4f5205ed
On Mon, Oct 27, 2008 at 9:58 AM, Michael Adam [EMAIL PROTECTED] wrote: The branch, master has been updated via b881d2ee78f685aea7ae8b67b3e0fb3c4f5205ed (commit) from 68aa9bd67f9556f608bfb321d593617bd346915f (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit b881d2ee78f685aea7ae8b67b3e0fb3c4f5205ed Author: Michael Adam [EMAIL PROTECTED] Date: Mon Oct 27 14:28:44 2008 +0100 [s3]winbind: fix smbd hanging on Solaris when winbindd closes socket. On some versions of Solaris, we observed a strange effect of close(2) on a socket: After the server (here winbindd) called close, the client fd was not marked as readable for select. And a write call to the fd did not produce an error EPIPE but just returned as if successful. So while winbindd had called remove_client(), the corresponding smbd still thought that it was connected, but failed to retrieve answers for its queries. This patch works around the problem by forcing the client fd to the readable state: Just write one byte into the socket before closing. Michael --- Summary of changes: source3/winbindd/winbindd.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 5d4f21a..ac2a87f 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -727,12 +727,17 @@ static void new_connection(int listen_sock, bool privileged) static void remove_client(struct winbindd_cli_state *state) { + char c = 0; + /* It's a dead client - hold a funeral */ if (state == NULL) { return; } - + + /* tell client, we are closing ... */ + write(state-sock, c, sizeof(c)); + /* Close socket */ close(state-sock); Michael, although this should help in the majority of cases, it looks like it still leaves a race condition where you write the single byte, the peer reads that byte so the socket is no longer in a readable state, you then close the socket, and the original problem occurs. I wonder if there is some ioctl you can issue here that will force the peer into readable state upon close...??? Derrell
Re: [SCM] Samba Shared Repository - branch master updated - b881d2ee78f685aea7ae8b67b3e0fb3c4f5205ed
On Mon, Oct 27, 2008 at 10:58 AM, Michael Adam [EMAIL PROTECTED] wrote: Michael, although this should help in the majority of cases, it looks like it still leaves a race condition where you write the single byte, the peer reads that byte so the socket is no longer in a readable state, you then close the socket, and the original problem occurs. I wonder if there is some ioctl you can issue here that will force the peer into readable state upon close...??? In principle, I agree that this might introduce a race, but in practice the scenario is as follows: 1. Winbind only closes the socket for an inactive connection (this is called from remove_idle_client() or on finished connections). This means that the client (smbd in our case) expects the socket to be readable and winbindd to be waiting for the next command on the pipe. 2. On the client end, in nsswitch/wb_common.c:winbind_write_sock(), there is already the corresponding catch that will close the socket, when it detects (by calling select) that read() would not block on the socket (starting in line 387 in nsswitch/wb_common.c). Does this reduce your concerns? Ok, so you're saying that an inactive connection is being closed, but that would imply that the code in winbind_write_sock() isn't being called (by that inactive client). But there's someplace that wasn't previously getting unblocked that your write of one byte causes to be unblocked. It's *there* that I see the potential race condition. If you're convinced that your fix is complete (i.e. it doesn't allow for the single character to be eaten prior to the close, leaving the client in the same never-becomes-readable condition from before the fix), you don't need to convince me. I don't know this code. I just brought this up as a potential issue. Cheers, Derrell
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4297-g89e22a2
The branch, v3-3-test has been updated via 89e22a2c969ab7a38016d4a145feb061fa6ae108 (commit) from 93eca985258a1ee56627704d448a4c0c40d2ec50 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 89e22a2c969ab7a38016d4a145feb061fa6ae108 Author: Derrell Lipman [EMAIL PROTECTED] Date: Fri Oct 24 11:19:12 2008 -0400 Error return is False, not -1 - There were a few places in SMBC_getatr() that returned -1 instead of a boolean. -1 was intended to mean error, but that's what False is for, and the usages of this function assume that it returns a boolean with False as the error condition. - per Jelmer's request, use false vs. False in new code, even if not making changes globally. Derrell --- Summary of changes: source/libsmb/libsmb_file.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmb_file.c b/source/libsmb/libsmb_file.c index 7b28709..e162aaa 100644 --- a/source/libsmb/libsmb_file.c +++ b/source/libsmb/libsmb_file.c @@ -518,7 +518,7 @@ SMBC_getatr(SMBCCTX * context, errno = EINVAL; TALLOC_FREE(frame); - return -1; + return false; } /* path fixup for . and .. */ @@ -527,14 +527,14 @@ SMBC_getatr(SMBCCTX * context, if (!fixedpath) { errno = ENOMEM; TALLOC_FREE(frame); - return -1; + return false; } } else { fixedpath = talloc_strdup(frame, path); if (!fixedpath) { errno = ENOMEM; TALLOC_FREE(frame); - return -1; + return false; } trim_string(fixedpath, NULL, \\..); trim_string(fixedpath, NULL, \\.); -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3113-g6233913
The branch, v3-2-test has been updated via 623391308f3fb26fdc2515baf41bb57ac1e5fc96 (commit) from dcc40a6adec5d00c29a062164cbc68ff4a7779f8 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 623391308f3fb26fdc2515baf41bb57ac1e5fc96 Author: Derrell Lipman [EMAIL PROTECTED] Date: Fri Oct 24 11:35:10 2008 -0400 Error return is boolean false, not -1 - There were a few places in SMBC_getatr() that returned -1 instead of a boolean. -1 was intended to mean error, but that's what False/false is for, and the usages of this function assume that it returns a boolean false as the error condition. - per Jelmer's request, use false vs. False in new code, even if not making changes globally. Derrell --- Summary of changes: source/libsmb/libsmb_file.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmb_file.c b/source/libsmb/libsmb_file.c index 423450b..27b7e4f 100644 --- a/source/libsmb/libsmb_file.c +++ b/source/libsmb/libsmb_file.c @@ -518,7 +518,7 @@ SMBC_getatr(SMBCCTX * context, errno = EINVAL; TALLOC_FREE(frame); - return -1; + return false; } /* path fixup for . and .. */ @@ -527,14 +527,14 @@ SMBC_getatr(SMBCCTX * context, if (!fixedpath) { errno = ENOMEM; TALLOC_FREE(frame); - return -1; + return false; } } else { fixedpath = talloc_strdup(frame, path); if (!fixedpath) { errno = ENOMEM; TALLOC_FREE(frame); - return -1; + return false; } trim_string(fixedpath, NULL, \\..); trim_string(fixedpath, NULL, \\.); -- Samba Shared Repository
Re: [SCM] Samba Shared Repository - branch master updated - 60164e9002c28911dbfd7115cb9bff05be5aff25
On Wed, Oct 22, 2008 at 10:58 PM, Jelmer Vernooij [EMAIL PROTECTED] wrote: - Log - commit 60164e9002c28911dbfd7115cb9bff05be5aff25 Merge: 391ce30d497503ce998d0c5dbab9ea7d4fe3ed3b 596089ec06b0a2b2ec3e0e5bd6d46c2e767bd954 Author: Jelmer Vernooij [EMAIL PROTECTED] Date: Thu Oct 23 04:58:08 2008 +0200 Merge branch 'master' of ssh://git.samba.org/data/git/samba Sometimes git merges by adding each commit that was done, while other times, like here, it adds just a single entry to the git-log showing that a merge was done, but with no detail. Is it possible to control that and force a merge with all commits being merged to be added independently? Derrell
[SCM] Samba Shared Repository - branch master updated - f0c17496366547f14638763a6b8859c365f18792
The branch, master has been updated via f0c17496366547f14638763a6b8859c365f18792 (commit) from 3c9f3c32d1290b8e6c438a197602afe3e96ae828 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log - commit f0c17496366547f14638763a6b8859c365f18792 Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Oct 2 09:03:32 2008 -0400 Fix bug 5805: don't close stdout - When calling setup_logging multiple times, the code was closing the debug file descriptor before opening or assigning the new one. We don't, however, want to close the debug file descriptor if it is stdout. Derrell --- Summary of changes: source3/lib/debug.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/lib/debug.c b/source3/lib/debug.c index d835ea7..d91b55d 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -578,7 +578,9 @@ void setup_logging(const char *pname, bool interactive) stdout_logging = False; if (dbf) { x_fflush(dbf); - (void) x_fclose(dbf); +if (dbf != x_stdout) { +(void) x_fclose(dbf); +} } dbf = NULL; -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3064-g7142872
The branch, v3-2-test has been updated via 7142872d2c6e0be42307671afa31016f6940007d (commit) from d596f78517f33f5a4c4849be3162d4f3031f045f (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 7142872d2c6e0be42307671afa31016f6940007d Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Oct 2 09:17:49 2008 -0400 Fix bug 5805: don't close stdout - When calling setup_logging multiple times, the code was closing the debug file descriptor before opening or assigning the new one. We don't, however, want to close the debug file descriptor if it is stdout. Derrell --- Summary of changes: source/lib/debug.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source/lib/debug.c b/source/lib/debug.c index d835ea7..d91b55d 100644 --- a/source/lib/debug.c +++ b/source/lib/debug.c @@ -578,7 +578,9 @@ void setup_logging(const char *pname, bool interactive) stdout_logging = False; if (dbf) { x_fflush(dbf); - (void) x_fclose(dbf); +if (dbf != x_stdout) { +(void) x_fclose(dbf); +} } dbf = NULL; -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-3258-gb731447
The branch, v3-3-test has been updated via b731447ec539d454002300fd755dddcad2351d6c (commit) via 36e5df59544de9df140ca40ad0efd77afd8e1468 (commit) via 11d74fc51c637b8129304b5de85bbe02a86a69ce (commit) via 6c33c620072d641fc19ca0224c16af75f6cd7e9e (commit) via e1ade80f468e8ed827f9d4fd035d79546fa0ee0a (commit) from 6b7ddb6d664f5f3b62161cdb3abf12633b263a64 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit b731447ec539d454002300fd755dddcad2351d6c Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jul 16 10:45:09 2008 -0400 The compatibility function also should have a const buffer pointer commit 36e5df59544de9df140ca40ad0efd77afd8e1468 Author: Andreas Schneider [EMAIL PROTECTED] Date: Wed Jul 16 12:05:52 2008 +0200 The buf in the smbclient write function should be const. As we try to provide POSIX function, we should use const like all other POSIX function. Signed-off-by: Andreas Schneider [EMAIL PROTECTED] Signed-off-by: Derrell Lipman [EMAIL PROTECTED] commit 11d74fc51c637b8129304b5de85bbe02a86a69ce Merge: 6c33c620072d641fc19ca0224c16af75f6cd7e9e 6b7ddb6d664f5f3b62161cdb3abf12633b263a64 Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jul 16 09:48:23 2008 -0400 Merge branch 'v3-3-test' of ssh://git.samba.org/data/git/samba into v3-3-test commit 6c33c620072d641fc19ca0224c16af75f6cd7e9e Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jul 16 09:47:06 2008 -0400 Static libsmbclient library needs to include all objects LIBSMBCLIENT_OBJ0 contains only the libsmb/libsmb_*.o files. We need the more inclusive set of object files defined by LIBSMBCLIENT_OBJ1. Derrell commit e1ade80f468e8ed827f9d4fd035d79546fa0ee0a Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jul 16 09:45:02 2008 -0400 Fix typos. libsmbclient doesn't have bool defined; rather it uses smbc_bool Derrell --- Summary of changes: source/Makefile.in |4 ++-- source/include/libsmb_internal.h |2 +- source/include/libsmbclient.h|6 +++--- source/libsmb/libsmb_compat.c|2 +- source/libsmb/libsmb_context.c |2 +- source/libsmb/libsmb_file.c |2 +- 6 files changed, 9 insertions(+), 9 deletions(-) Changeset truncated at 500 lines: diff --git a/source/Makefile.in b/source/Makefile.in index 8b0a5f0..cd70183 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -1924,9 +1924,9 @@ $(LIBSMBCLIENT_SHARED_TARGET): $(LIBSMBCLIENT_SHARED_TARGET_SONAME) @rm -f $@ @ln -s `basename $(LIBSMBCLIENT_SHARED_TARGET_SONAME)` $@ -$(LIBSMBCLIENT_STATIC_TARGET): $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ0) +$(LIBSMBCLIENT_STATIC_TARGET): $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ1) @echo Linking non-shared library $@ - @-$(AR) -rc $@ $(LIBSMBCLIENT_OBJ0) + @-$(AR) -rc $@ $(LIBSMBCLIENT_OBJ1) libsmbclient: $(LIBSMBCLIENT) diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index 6930812..3b909d1 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -346,7 +346,7 @@ SMBC_read_ctx(SMBCCTX *context, ssize_t SMBC_write_ctx(SMBCCTX *context, SMBCFILE *file, - void *buf, + const void *buf, size_t count); int diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 2828e9e..a8b27b7 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -796,7 +796,7 @@ void smbc_setFunctionRead(SMBCCTX *c, smbc_read_fn fn); typedef ssize_t (*smbc_write_fn)(SMBCCTX *c, SMBCFILE *file, - void *buf, + const void *buf, size_t count); smbc_write_fn smbc_getFunctionWrite(SMBCCTX *c); void smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn); @@ -1240,7 +1240,7 @@ ssize_t smbc_read(int fd, void *buf, size_t bufsize); * @see smbc_open(), smbc_read() * */ -ssize_t smbc_write(int fd, void *buf, size_t bufsize); +ssize_t smbc_write(int fd, const void *buf, size_t bufsize); /[EMAIL PROTECTED] file @@ -2584,7 +2584,7 @@ void smbc_set_credentials(char *workgroup, char *user, char *password, - bool use_kerberos, + smbc_bool use_kerberos, char *signing_state); diff --git a/source/libsmb/libsmb_compat.c b/source/libsmb/libsmb_compat.c index 9ef5e51..ad8fd92 100644 --- a/source/libsmb/libsmb_compat.c +++ b/source/libsmb/libsmb_compat.c @@ -207,7 +207,7 @@ smbc_read(int fd, ssize_t smbc_write(int fd, - void *buf, + const void *buf
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-3157-g2dab9ad
The branch, v3-3-test has been updated via 2dab9ad77954dc608f8910bf4d3cb92fcaad5cb6 (commit) via 888f922bd0d1c84a687d404e95ae314a9dd0aee1 (commit) from 3d19112f645fb0f4bb6b644207ed2cee0b6b3ea9 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 2dab9ad77954dc608f8910bf4d3cb92fcaad5cb6 Merge: 888f922bd0d1c84a687d404e95ae314a9dd0aee1 3d19112f645fb0f4bb6b644207ed2cee0b6b3ea9 Author: Derrell Lipman [EMAIL PROTECTED] Date: Tue Jul 8 20:44:57 2008 -0400 Merge branch 'v3-3-test' of ssh://git.samba.org/data/git/samba into v3-3-test commit 888f922bd0d1c84a687d404e95ae314a9dd0aee1 Author: Derrell Lipman [EMAIL PROTECTED] Date: Tue Jul 8 20:44:39 2008 -0400 [BUG 5580] Allow access to DFS shares via libsmbclient Brian Sheehan provided a nice patch intended for the 3.0 code base. This commit applies a similar patch for the 3.3 code base. It adds a new public function to libsmbclient -- smbc_set_credentials() -- that may be called from the authentication callback when DFS referrals are in use. Derrell --- Summary of changes: source/include/libsmbclient.h | 27 +++ source/include/proto.h |1 + source/lib/util.c |5 + source/libsmb/libsmb_context.c | 20 4 files changed, 53 insertions(+), 0 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 74d0d5c..2828e9e 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -2561,6 +2561,33 @@ smbc_version(void); } #endif +/[EMAIL PROTECTED] misc + * Set the users credentials globally so they can be used for DFS + * referrals. Probably best to use this function in the smbc_get_auth_data_fn + * callback. + * + * @param workgroup Workgroup of the user. + * + * @param user Username of user. + * + * @param password Password of user. + * + * @param use_kerberos Whether to use Kerberos + * + * @param signing_state One of these strings (all equivalents on same line): + * off, no, false + * on, yes, true, auto + * force, required, forced + */ + +void +smbc_set_credentials(char *workgroup, + char *user, + char *password, + bool use_kerberos, + char *signing_state); + + /** * @ingroup structure * Structure that contains a client context information diff --git a/source/include/proto.h b/source/include/proto.h index 2a954f4..665a86d 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -1271,6 +1271,7 @@ const char *get_cmdline_auth_info_password(void); void set_cmdline_auth_info_password(const char *password); bool set_cmdline_auth_info_signing_state(const char *arg); int get_cmdline_auth_info_signing_state(void); +void set_cmdline_auth_info_use_kerberos(bool b); bool get_cmdline_auth_info_use_kerberos(void); void set_cmdline_auth_info_use_krb5_ticket(void); void set_cmdline_auth_info_smb_encrypt(void); diff --git a/source/lib/util.c b/source/lib/util.c index 68524a2..8d744a5 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -353,6 +353,11 @@ int get_cmdline_auth_info_signing_state(void) return cmdline_auth_info.signing_state; } +void set_cmdline_auth_info_use_kerberos(bool b) +{ +cmdline_auth_info.use_kerberos = b; +} + bool get_cmdline_auth_info_use_kerberos(void) { return cmdline_auth_info.use_kerberos; diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c index dd78bce..51948d1 100644 --- a/source/libsmb/libsmb_context.c +++ b/source/libsmb/libsmb_context.c @@ -610,3 +610,23 @@ smbc_version(void) } +/* + * Set the credentials so DFS will work when following referrals. + */ +void +smbc_set_credentials(char *workgroup, + char *user, + char *password, + bool use_kerberos, + char *signing_state) +{ + +set_cmdline_auth_info_username(user); +set_cmdline_auth_info_password(password); +set_cmdline_auth_info_use_kerberos(use_kerberos); +if (! set_cmdline_auth_info_signing_state(signing_state)) { +DEBUG(0, (Invalid signing state: %s, signing_state)); +} +set_global_myworkgroup(workgroup); +cli_cm_set_credentials(); +} -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2953-gfa803ce
The branch, v3-3-test has been updated via fa803ce183376c938f92b0f31a7d89d522fd309f (commit) via 84b1ea39a4f27ebcf06a2bafed78396c7353df0e (commit) from b20019ceaaf4a8964792f6ba37f50f91b6847e7f (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit fa803ce183376c938f92b0f31a7d89d522fd309f Author: Andreas Schneider [EMAIL PROTECTED] Date: Mon Jun 23 16:29:40 2008 +0200 Add documentation for kerberos support in libsmbclient. Signed-off-by: Andreas Schneider [EMAIL PROTECTED] Signed-off-by: Derrell Lipman [EMAIL PROTECTED] commit 84b1ea39a4f27ebcf06a2bafed78396c7353df0e Author: Andreas Schneider [EMAIL PROTECTED] Date: Mon Jun 23 11:00:20 2008 +0200 Add krb5 support for the testbrowse example. Signed-off-by: Andreas Schneider [EMAIL PROTECTED] Signed-off-by: Derrell Lipman [EMAIL PROTECTED] --- Summary of changes: examples/libsmbclient/get_auth_data_fn.h | 13 - examples/libsmbclient/testbrowse.c |3 +++ source/include/libsmbclient.h| 10 ++ 3 files changed, 25 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/get_auth_data_fn.h b/examples/libsmbclient/get_auth_data_fn.h index b1d36c8..6b91c97 100644 --- a/examples/libsmbclient/get_auth_data_fn.h +++ b/examples/libsmbclient/get_auth_data_fn.h @@ -1,3 +1,5 @@ +#include stdlib.h + static void get_auth_data_fn(const char * pServer, const char * pShare, @@ -15,6 +17,8 @@ get_auth_data_fn(const char * pServer, charusername[256] = { '\0' }; charpassword[256] = { '\0' }; +static int krb5_set = 1; + if (strcmp(server, pServer) == 0 strcmp(share, pShare) == 0 *workgroup != '\0' @@ -25,7 +29,12 @@ get_auth_data_fn(const char * pServer, strncpy(pPassword, password, maxLenPassword - 1); return; } - + +if (krb5_set getenv(KRB5CCNAME)) { + krb5_set = 0; + return; +} + fprintf(stdout, Workgroup: [%s] , pWorkgroup); fgets(temp, sizeof(temp), stdin); @@ -68,4 +77,6 @@ get_auth_data_fn(const char * pServer, strncpy(workgroup, pWorkgroup, sizeof(workgroup) - 1); strncpy(username, pUsername, sizeof(username) - 1); strncpy(password, pPassword, sizeof(password) - 1); + +krb5_set = 1; } diff --git a/examples/libsmbclient/testbrowse.c b/examples/libsmbclient/testbrowse.c index a7eda36..a6e6395 100644 --- a/examples/libsmbclient/testbrowse.c +++ b/examples/libsmbclient/testbrowse.c @@ -117,6 +117,9 @@ main(int argc, char * argv[]) smbc_setFunctionAuthData(context, get_auth_data_fn); } +smbc_setOptionUseKerberos(context, 1); +smbc_setOptionFallbackAfterKerberos(context, 1); + /* If we've been asked to log to stderr instead of stdout, ... */ if (debug_stderr) { /* ... then set the option to do so */ diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 9600264..74d0d5c 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -259,6 +259,11 @@ typedef struct _SMBCCTX SMBCCTX; * Type for the the authentication function called by the library to * obtain authentication credentals * + * For kerberos support the function should just be called without + * prompting the user for credentials. Which means a simple 'return' + * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h + * and examples/libsmbclient/testbrowse.c. + * * @param srv Server being authenticated to * * @param shr Share being authenticated to @@ -293,6 +298,11 @@ typedef void (*smbc_get_auth_data_fn)(const char *srv, * Type for the the authentication function called by the library to * obtain authentication credentals * + * For kerberos support the function should just be called without + * prompting the user for credentials. Which means a simple 'return' + * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h + * and examples/libsmbclient/testbrowse.c. + * * @param c Pointer to the smb context * * @param srv Server being authenticated to -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2905-g0e84e3b
The branch, v3-3-test has been updated via 0e84e3bb800cec2b63df4692afbf9c40850b108f (commit) from b1e8e5d173cdaa3fb9c1fb1d9aacf8e665bc5d61 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 0e84e3bb800cec2b63df4692afbf9c40850b108f Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jun 18 11:00:46 2008 -0400 Remove prototype of unimplemented smbc_chown() function. --- Summary of changes: source/include/libsmbclient.h | 26 -- 1 files changed, 0 insertions(+), 26 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 2e38944..9600264 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -1580,32 +1580,6 @@ int smbc_fstat(int fd, struct stat *st); int smbc_ftruncate(int fd, off_t size); -/[EMAIL PROTECTED] attribue - * Change the ownership of a file or directory. - * - * @param url The smb url of the file or directory to change - * ownership of. - * - * @param owner I have no idea? - * - * @param group I have not idea? - * - * @return 0 on success, 0 on error with errno set: - * - EPERM The effective UID does not match the owner - * of the file, and is not zero; or the owner or group - * were specified incorrectly. - * - ENOENT The file does not exist. - * - ENOMEM Insufficient was available. - * - ENOENT file or directory does not exist - * - * @todo Are we actually going to be able to implement this function - * - * @todo How do we abstract owner and group uid and gid? - * - */ -int smbc_chown(const char *url, uid_t owner, gid_t group); - - /[EMAIL PROTECTED] attribute * Change the permissions of a file. * -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2638-g5f6b301
The branch, v3-3-test has been updated via 5f6b301f92e9e9d5ee1dab9ef8eca2cc77e12941 (commit) via e4060ad864ec9d4e9092a832c3c664ee31b6125a (commit) from 3b31f8cce3703645a57778bc752bc9b9e853df5d (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log - commit 5f6b301f92e9e9d5ee1dab9ef8eca2cc77e12941 Author: Derrell Lipman [EMAIL PROTECTED] Date: Fri May 30 10:38:35 2008 -0400 Working on bug #5475 - Add code to test whether smbc_stat() munges future smbc_getxattr() results. Derrell commit e4060ad864ec9d4e9092a832c3c664ee31b6125a Author: Derrell Lipman [EMAIL PROTECTED] Date: Fri May 30 10:24:55 2008 -0400 Update libsmbclient examples to match new libraries - talloc and tdb have been moved to separate libraries. Link with those. Derrell --- Summary of changes: examples/libsmbclient/Makefile|2 +- examples/libsmbclient/smbwrapper/Makefile |2 +- examples/libsmbclient/testacl.c | 48 3 files changed, 36 insertions(+), 16 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index a50e80a..7415f4f 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -13,7 +13,7 @@ CFLAGS = -O0 -g $(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS) LDFLAGS = -L/usr/local/samba/lib \ -lldap -lkrb5 -lgssapi_krb5 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so -LIBSMBCLIENT = -lwbclient -lsmbclient -ldl -lresolv +LIBSMBCLIENT = -lwbclient -lsmbclient -ltalloc -ltdb -ldl -lresolv TESTS= testsmbc \ testacl \ diff --git a/examples/libsmbclient/smbwrapper/Makefile b/examples/libsmbclient/smbwrapper/Makefile index 7264353..7f5c17c 100644 --- a/examples/libsmbclient/smbwrapper/Makefile +++ b/examples/libsmbclient/smbwrapper/Makefile @@ -1,4 +1,4 @@ -LIBS = -lwbclient -lsmbclient -ldl +LIBS = -lwbclient -lsmbclient -ltalloc -ltdb -ldl DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CFLAGS = -I$(SAMBA_INCL) $(EXTLIB_INCL) diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c index 00e1c2c..a57dd4a 100644 --- a/examples/libsmbclient/testacl.c +++ b/examples/libsmbclient/testacl.c @@ -24,6 +24,7 @@ int main(int argc, const char *argv[]) int flags; int debug = 0; int numeric = 0; +int stat_and_retry = 0; int full_time_names = 0; enum acl_mode mode = SMB_ACL_LIST; static char *the_acl = NULL; @@ -33,6 +34,7 @@ int main(int argc, const char *argv[]) char path[1024]; char value[1024]; poptContext pc; +struct stat st; struct poptOption long_options[] = { POPT_AUTOHELP @@ -78,6 +80,10 @@ int main(int argc, const char *argv[]) 'g', Get a specific acl attribute, ACL }, { +stat_and_retry, 'R', POPT_ARG_NONE, stat_and_retry, +1, After 'get' do 'stat' and another 'get' +}, +{ NULL } }; @@ -175,26 +181,40 @@ int main(int argc, const char *argv[]) break; case SMB_ACL_GET: -if (the_acl == NULL) +do { -if (numeric) +if (the_acl == NULL) { -the_acl = system.*; +if (numeric) +{ +the_acl = system.*; +} +else +{ +the_acl = system.*+; +} } -else +ret = smbc_getxattr(path, the_acl, value, sizeof(value)); +if (ret 0) { -the_acl = system.*+; +printf(Could not get attributes for [%s] %d: %s\n, + path, errno, strerror(errno)); +return 1; } -} -ret = smbc_getxattr(path, the_acl, value, sizeof(value)); -if (ret 0) -{ -printf(Could not get attributes for [%s] %d: %s\n, - path, errno, strerror(errno)); -return 1; -} -printf(Attributes for [%s] are:\n%s\n, path, value); +printf(Attributes for [%s] are:\n%s\n, path, value); + +if (stat_and_retry) +{ +if (smbc_stat(path, st) 0) +{ +perror(smbc_stat); +return 1; +} +} + +--stat_and_retry; +} while (stat_and_retry = 0); break; case SMB_ACL_ADD: -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-282-g38eab68
The branch, v3-2-test has been updated via 38eab68dfb2d8abe8ad00f5a86fc54c778d0d303 (commit) from 065938ccb7bb0052746267c433637f0e05b95d85 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 38eab68dfb2d8abe8ad00f5a86fc54c778d0d303 Author: Derrell Lipman [EMAIL PROTECTED] Date: Mon Mar 17 11:34:25 2008 -0400 Fix use of AuthDataWithContext capability During my initial plans for, and the subsequent discussion of a more significant change to the API for libsmbclient, I had removed the AuthDataWithContext usage, in favor of a more generalized planned interface. When the API returned to its original state, I neglected to reinsert this code. Use of an authentication function with the context can be tested using examples/libsmbclient/testbrowse -C Derrell --- Summary of changes: source/libsmb/libsmb_context.c |3 ++- source/libsmb/libsmb_server.c | 22 ++ 2 files changed, 20 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c index 3e67943..dd78bce 100644 --- a/source/libsmb/libsmb_context.c +++ b/source/libsmb/libsmb_context.c @@ -421,7 +421,8 @@ smbc_init_context(SMBCCTX *context) return NULL; } -if (!smbc_getFunctionAuthData(context) || +if ((!smbc_getFunctionAuthData(context) + !smbc_getFunctionAuthDataWithContext(context)) || smbc_getDebug(context) 0 || smbc_getDebug(context) 100) { diff --git a/source/libsmb/libsmb_server.c b/source/libsmb/libsmb_server.c index 37612c6..7af5ca3 100644 --- a/source/libsmb/libsmb_server.c +++ b/source/libsmb/libsmb_server.c @@ -101,15 +101,29 @@ SMBC_call_auth_fn(TALLOC_CTX *ctx, fstring workgroup; fstring username; fstring password; +smbc_get_auth_data_with_context_fn auth_with_context_fn; strlcpy(workgroup, *pp_workgroup, sizeof(workgroup)); strlcpy(username, *pp_username, sizeof(username)); strlcpy(password, *pp_password, sizeof(password)); -smbc_getFunctionAuthData(context)(server, share, - workgroup, sizeof(workgroup), - username, sizeof(username), - password, sizeof(password)); +/* See if there's an authentication with context function provided */ +auth_with_context_fn = smbc_getFunctionAuthDataWithContext(context); +if (auth_with_context_fn) +{ +(* auth_with_context_fn)(context, + server, share, + workgroup, sizeof(workgroup), + username, sizeof(username), + password, sizeof(password)); +} +else +{ +smbc_getFunctionAuthData(context)(server, share, + workgroup, sizeof(workgroup), + username, sizeof(username), + password, sizeof(password)); +} TALLOC_FREE(*pp_workgroup); TALLOC_FREE(*pp_username); -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-124-g6f65390
The branch, v3-2-test has been updated via 6f65390cec218a6aac4370ee381f30439617dcec (commit) from 3a0f781352f364ce625a35ffd78257b27d984c47 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 6f65390cec218a6aac4370ee381f30439617dcec Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Mar 6 09:00:37 2008 -0500 Check for NULL pointers before dereferencing them. --- Summary of changes: source/libsmb/libsmb_server.c |8 1 files changed, 4 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmb_server.c b/source/libsmb/libsmb_server.c index 64eb1ea..37612c6 100644 --- a/source/libsmb/libsmb_server.c +++ b/source/libsmb/libsmb_server.c @@ -144,6 +144,10 @@ SMBC_find_server(TALLOC_CTX *ctx, SMBCSRV *srv; int auth_called = 0; +if (!pp_workgroup || !pp_username || !pp_password) { +return NULL; +} + check_server_cache: srv = smbc_getFunctionGetCachedServer(context)(context, @@ -156,10 +160,6 @@ check_server_cache: SMBC_call_auth_fn(ctx, context, server, share, pp_workgroup, pp_username, pp_password); - if (!pp_workgroup || !pp_username || !pp_password) { - return NULL; - } - /* * However, smbc_auth_fn may have picked up info relating to * an existing connection, so try for an existing connection -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-126-gb7f34e7
The branch, v3-2-test has been updated via b7f34e7ef2907b498a0645ce68f2773ed7d60cdc (commit) from e473e6d50c56f52ef5e4853e4ca3b3548af06f51 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit b7f34e7ef2907b498a0645ce68f2773ed7d60cdc Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Mar 6 10:41:42 2008 -0500 Eliminate global variable in_client and a plethora of extern declarations. Derrell --- Summary of changes: source/client/client.c |3 +-- source/client/smbspool.c|3 +-- source/libsmb/libsmb_context.c |4 +--- source/pam_smbpass/pam_smb_acct.c |3 +-- source/pam_smbpass/pam_smb_auth.c |3 +-- source/pam_smbpass/pam_smb_passwd.c |4 +--- source/param/loadparm.c | 25 +++-- source/param/params.c |4 +--- 8 files changed, 30 insertions(+), 19 deletions(-) Changeset truncated at 500 lines: diff --git a/source/client/client.c b/source/client/client.c index 79b7dfe..67060cb 100644 --- a/source/client/client.c +++ b/source/client/client.c @@ -33,7 +33,6 @@ extern int do_smb_browse(void); /* mDNS browsing */ extern bool AllowDebugChange; extern bool override_logfile; extern char tar_type; -extern bool in_client; static int port = 0; static char *service; @@ -4701,7 +4700,7 @@ static int do_message_op(void) pc = poptGetContext(smbclient, argc, (const char **) argv, long_options, 0); poptSetOtherOptionHelp(pc, service password); - in_client = true; /* Make sure that we tell lp_load we are */ +lp_set_in_client(true); /* Make sure that we tell lp_load we are */ while ((opt = poptGetNextOpt(pc)) != -1) { diff --git a/source/client/smbspool.c b/source/client/smbspool.c index e7df22c..e827df4 100644 --- a/source/client/smbspool.c +++ b/source/client/smbspool.c @@ -35,7 +35,6 @@ * Globals... */ -extern boolin_client; /* Boolean for client library */ /* @@ -228,7 +227,7 @@ static bool smb_encrypt; setup_logging(smbspool, True); - in_client = True; /* Make sure that we tell lp_load we are */ + lp_set_in_client(True); /* Make sure that we tell lp_load we are */ load_case_tables(); diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c index 212b42f..3e67943 100644 --- a/source/libsmb/libsmb_context.c +++ b/source/libsmb/libsmb_context.c @@ -27,8 +27,6 @@ #include libsmb_internal.h -extern bool in_client; - /* * Is the logging working / configfile read ? */ @@ -450,7 +448,7 @@ smbc_init_context(SMBCCTX *context) /* Here we would open the smb.conf file if needed ... */ -in_client = True; /* FIXME, make a param */ +lp_set_in_client(True); home = getenv(HOME); if (home) { diff --git a/source/pam_smbpass/pam_smb_acct.c b/source/pam_smbpass/pam_smb_acct.c index b9bcb31..2a8bd26 100644 --- a/source/pam_smbpass/pam_smb_acct.c +++ b/source/pam_smbpass/pam_smb_acct.c @@ -55,12 +55,11 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags, const char *name; struct samu *sampass = NULL; void (*oldsig_handler)(int); - extern bool in_client; /* Samba initialization. */ load_case_tables(); setup_logging( pam_smbpass, False ); - in_client = True; +lp_set_in_client(True); ctrl = set_ctrl( flags, argc, argv ); diff --git a/source/pam_smbpass/pam_smb_auth.c b/source/pam_smbpass/pam_smb_auth.c index 3a841ad..3dceb52 100644 --- a/source/pam_smbpass/pam_smb_auth.c +++ b/source/pam_smbpass/pam_smb_auth.c @@ -72,7 +72,6 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, unsigned int ctrl; int retval, *ret_data = NULL; struct samu *sampass = NULL; - extern bool in_client; const char *name; void (*oldsig_handler)(int) = NULL; bool found; @@ -83,7 +82,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, /* Samba initialization. */ load_case_tables(); setup_logging(pam_smbpass,False); - in_client = True; +lp_set_in_client(True); ctrl = set_ctrl(flags, argc, argv); diff --git a/source/pam_smbpass/pam_smb_passwd.c b/source/pam_smbpass/pam_smb_passwd.c index 326a0b5..b6de43f 100644 --- a/source/pam_smbpass/pam_smb_passwd.c +++ b/source/pam_smbpass/pam_smb_passwd.c @@ -98,8 +98,6 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags, unsigned int ctrl; int retval; -extern bool in_client; - struct samu *sampass = NULL; void (*oldsig_handler)(int); const char *user; @@ -109,7 +107,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2707-g8927b50
The branch, v3-2-test has been updated via 8927b50d6051fcefd87f19dc90c5826378d03e4e (commit) via 76ba37ac46b4a77fe228ca90635fa19140541ccd (commit) via a67f96fbe9683b46c2149f7cb439d13f7f0e6ecd (commit) from 2c42fc21d8bede226e411623aecd69038477373b (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 8927b50d6051fcefd87f19dc90c5826378d03e4e Merge: 76ba37ac46b4a77fe228ca90635fa19140541ccd 2c42fc21d8bede226e411623aecd69038477373b Author: Derrell Lipman [EMAIL PROTECTED] Date: Mon Mar 3 18:27:41 2008 -0500 Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test commit 76ba37ac46b4a77fe228ca90635fa19140541ccd Author: Derrell Lipman [EMAIL PROTECTED] Date: Mon Mar 3 18:25:49 2008 -0500 Missed a few 'deprecated' markers commit a67f96fbe9683b46c2149f7cb439d13f7f0e6ecd Author: Derrell Lipman [EMAIL PROTECTED] Date: Mon Mar 3 18:13:33 2008 -0500 Continued revamping of libsmbclient. - James suggested using gcc's deprecated attribute to mark the context structure fields to generate warnings. This creates a scenario with the best of all worlds. I'm able to move to an organization that more easily allows future enhancements, while avoiding any mandatory changes by applications. Thanks, James! - Updated WHATSNEW.txt so that it accurately reflects the current state of affairs. Derrell --- Summary of changes: WHATSNEW.txt | 17 +- examples/libsmbclient/Makefile |4 +- examples/libsmbclient/testbrowse.c |2 +- examples/libsmbclient/testsmbc.c |2 +- source/Makefile.in |1 + source/include/libsmb_internal.h | 100 + source/include/libsmbclient.h | 249 - source/libsmb/libsmb_cache.c | 16 +- source/libsmb/libsmb_context.c | 1078 source/libsmb/libsmb_dir.c | 30 +- source/libsmb/libsmb_file.c|8 +- source/libsmb/libsmb_path.c|6 +- source/libsmb/libsmb_printjob.c|6 +- source/libsmb/libsmb_server.c | 75 ++-- source/libsmb/libsmb_setget.c | 905 ++ source/libsmb/libsmb_stat.c|4 +- source/libsmb/libsmb_xattr.c |6 +- 17 files changed, 1225 insertions(+), 1284 deletions(-) create mode 100644 source/libsmb/libsmb_setget.c Changeset truncated at 500 lines: diff --git a/WHATSNEW.txt b/WHATSNEW.txt index 4ae46df..30740de 100644 --- a/WHATSNEW.txt +++ b/WHATSNEW.txt @@ -111,16 +111,11 @@ Modified API for libsmbclient Maintaining ABI compatibility for libsmbclient has become increasingly difficult to accomplish, while also keeping the code organization such that it is easily readable. Towards the goal of maintaining ABI compatibility and -also keeping the code easy to maintain and enhance, the API has changed -somewhat. In particular, the fields in the SMBCCTX context structure are no -longer intended to be read/write by the user. The names of the fields have -changed to encourage any recompilations to use the new interface, but for -continued ABI compatibility, the fields are in the same locations in the -context structure as they were previously so any previously-compiled -applications should continue to work with this new version. - -An application that previously accessed the members of the SMBCCTX context -structure will encounter errors if recompiled. This is intentional to +also keeping the code easy to maintain and enhance, the API has been enhanced. +In particular, the fields in the SMBCCTX context structure are no longer +intended to be read/write by the user, and are marked as deprecated. An +application that previously accessed the members of the SMBCCTX context +structure will now encounter warnings if recompiled. This is intentional, to encourage implementation of the small changes required for the new interface. The number of changes is expected to be quite small for the vast majority of applications, and no changes need be made for many applications. The changes @@ -141,7 +136,7 @@ under these comment blocks: Callable functions for directories Callable functions applicable to both files and directories -Example changes that may be required: +Example changes that may be required to eliminate deprecated warnings: /* Set the debug level */ context-debug = 99; diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index e2d8b68..a50e80a 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -1,14 +1,14 @@ # CC = gcc -SAMBA_INCL = ../../source/include +SAMBA_INCL = -I/usr/local/samba/include EXTLIB_INCL = -I/usr/include/gtk-1.2 \ -I/usr/include/glib-1.2 \ -I/usr/lib/glib
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2708-gfd18b01
The branch, v3-2-test has been updated via fd18b01016d1dc4b08983975353e62084fdc323c (commit) from 8927b50d6051fcefd87f19dc90c5826378d03e4e (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit fd18b01016d1dc4b08983975353e62084fdc323c Author: Derrell Lipman [EMAIL PROTECTED] Date: Mon Mar 3 22:56:32 2008 -0500 use constant name less likely to cause conflict --- Summary of changes: source/include/libsmbclient.h | 100 1 files changed, 50 insertions(+), 50 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index e1a4b74..2e38944 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -25,11 +25,11 @@ #ifndef SMBCLIENT_H_INCLUDED #define SMBCLIENT_H_INCLUDED -#undef _DEPRECATED_ +#undef DEPRECATED_SMBC_INTERFACE #if ! defined(__LIBSMBCLIENT_INTERNAL__) defined(__GNUC__) -# define _DEPRECATED_ __attribute__ ((deprecated)) +# define DEPRECATED_SMBC_INTERFACE __attribute__ ((deprecated)) #else -# define _DEPRECATED_ +# define DEPRECATED_SMBC_INTERFACE #endif #ifdef __cplusplus @@ -2600,7 +2600,7 @@ struct _SMBCCTX * DEPRECATED: * Use smbc_getDebug() and smbc_setDebug() */ -int debug _DEPRECATED_; +int debug DEPRECATED_SMBC_INTERFACE; /** * netbios name used for making connections @@ -2608,7 +2608,7 @@ struct _SMBCCTX * DEPRECATED: * Use smbc_getNetbiosName() and smbc_setNetbiosName() */ -char * netbios_name _DEPRECATED_; +char * netbios_name DEPRECATED_SMBC_INTERFACE; /** * workgroup name used for making connections @@ -2616,7 +2616,7 @@ struct _SMBCCTX * DEPRECATED: * Use smbc_getWorkgroup() and smbc_setWorkgroup() */ -char * workgroup _DEPRECATED_; +char * workgroup DEPRECATED_SMBC_INTERFACE; /** * username used for making connections @@ -2624,7 +2624,7 @@ struct _SMBCCTX * DEPRECATED: * Use smbc_getUser() and smbc_setUser() */ -char * user _DEPRECATED_; +char * user DEPRECATED_SMBC_INTERFACE; /** * timeout used for waiting on connections / response data (in @@ -2633,7 +2633,7 @@ struct _SMBCCTX * DEPRECATED: * Use smbc_getTimeout() and smbc_setTimeout() */ -int timeout _DEPRECATED_; +int timeout DEPRECATED_SMBC_INTERFACE; /** * callable functions for files: @@ -2644,40 +2644,40 @@ struct _SMBCCTX * Use smbc_getFunction*() and smbc_setFunction*(), e.g. * smbc_getFunctionOpen(), smbc_setFunctionUnlink(), etc. */ -smbc_open_fnopen _DEPRECATED_; -smbc_creat_fn creat _DEPRECATED_; -smbc_read_fnread _DEPRECATED_; -smbc_write_fn write _DEPRECATED_; -smbc_unlink_fn unlink _DEPRECATED_; -smbc_rename_fn rename _DEPRECATED_; -smbc_lseek_fn lseek _DEPRECATED_; -smbc_stat_fnstat _DEPRECATED_; -smbc_fstat_fn fstat _DEPRECATED_; +smbc_open_fnopen DEPRECATED_SMBC_INTERFACE; +smbc_creat_fn creat DEPRECATED_SMBC_INTERFACE; +smbc_read_fnread DEPRECATED_SMBC_INTERFACE; +smbc_write_fn write DEPRECATED_SMBC_INTERFACE; +smbc_unlink_fn unlink DEPRECATED_SMBC_INTERFACE; +smbc_rename_fn rename DEPRECATED_SMBC_INTERFACE; +smbc_lseek_fn lseek DEPRECATED_SMBC_INTERFACE; +smbc_stat_fnstat DEPRECATED_SMBC_INTERFACE; +smbc_fstat_fn fstat DEPRECATED_SMBC_INTERFACE; #if 0 /* internal */ smbc_ftruncate_fn ftruncate_fn; #endif -smbc_close_fn close_fn _DEPRECATED_; -smbc_opendir_fn opendir _DEPRECATED_; -smbc_closedir_fnclosedir _DEPRECATED_; -smbc_readdir_fn readdir _DEPRECATED_; -smbc_getdents_fngetdents _DEPRECATED_; -smbc_mkdir_fn mkdir _DEPRECATED_; -smbc_rmdir_fn rmdir _DEPRECATED_; -smbc_telldir_fn telldir _DEPRECATED_; -smbc_lseekdir_fnlseekdir _DEPRECATED_; -smbc_fstatdir_fnfstatdir _DEPRECATED_; -smbc_chmod_fn chmod _DEPRECATED_; -smbc_utimes_fn
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2700-g71e86f1
The branch, v3-2-test has been updated via 71e86f13b0ace3841c6712084728c79db74ff803 (commit) via f07407a32e178a47c8f9b3e3703aa5a20f0a4f06 (commit) via 23cb9c49e3724cecaa66655ef64c3111bf14c552 (commit) via 1fd65359f6cd07539cfe43146ac367a48708a678 (commit) via dec70fa3c0424c148016cc667a3c159e16d8a944 (commit) via a8b4b773d4647f28e7b92c5968469721d34eb550 (commit) via 64b7150d92849a1e1e2416b9dcc12fae8d6bea99 (commit) via 56429a3d60b2a48963342f6340b3c01469a892c6 (commit) via d4b4bae8ded824d06ad5ab0e219f71187ee5c771 (commit) from aa9c0f587718f4d647e87b9662acbedba042b9cb (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 71e86f13b0ace3841c6712084728c79db74ff803 Author: Derrell Lipman [EMAIL PROTECTED] Date: Sun Mar 2 16:13:25 2008 -0500 fixed missing white space commit f07407a32e178a47c8f9b3e3703aa5a20f0a4f06 Author: Derrell Lipman [EMAIL PROTECTED] Date: Sat Mar 1 23:08:19 2008 -0500 Update WHATSNEW for libsmbclient changes commit 23cb9c49e3724cecaa66655ef64c3111bf14c552 Author: Derrell Lipman [EMAIL PROTECTED] Date: Sat Mar 1 21:19:52 2008 -0500 Return NULL, not 0, from a function which returns a pointer. commit 1fd65359f6cd07539cfe43146ac367a48708a678 Author: Derrell Lipman [EMAIL PROTECTED] Date: Sat Mar 1 21:19:15 2008 -0500 change variable name from f to fn for function pointers commit dec70fa3c0424c148016cc667a3c159e16d8a944 Author: Derrell Lipman [EMAIL PROTECTED] Date: Sat Mar 1 20:56:54 2008 -0500 Comment was in wrong place commit a8b4b773d4647f28e7b92c5968469721d34eb550 Author: Derrell Lipman [EMAIL PROTECTED] Date: Sat Mar 1 20:55:21 2008 -0500 Mark smbc_option_{get,set} as deprecated commit 64b7150d92849a1e1e2416b9dcc12fae8d6bea99 Author: Derrell Lipman [EMAIL PROTECTED] Date: Sat Mar 1 20:44:21 2008 -0500 Additional revamped libsmbclient documentation - Ensured that all public functions have documentation in libsmbclient.h - Reformatted for proper indentation - Re-added temporarily-disabled alternate authentication function capability Derrell commit 56429a3d60b2a48963342f6340b3c01469a892c6 Author: Derrell Lipman [EMAIL PROTECTED] Date: Fri Feb 29 13:34:35 2008 -0500 Modified revamp of the libsmbclient interface. Given the tacit (if that) approval by some people, and clear disapproval by others for my proposed clean-up and reorganization of libsmbclient, I've come up with a slightly different approach. This commit changes back to the original libsmbclient.h SMBCCTX structure which will maintain ABI compatibility. I retain, here, the setter and getter functions which all new code should use. Older programs already compiled should continue to work fine. Older programs being recompiled will encounter compile-time errors (intentionally!) so that the code can be corrected to use the setter/getter interfaces. Although this doesn't clean up the interface in the way I had wanted, the code reorganization and requirement for new programs to use the setters and getters allows future progress to be made on libsmbclient without further muddying up the interface, while retaining the ABI compatibility that was the big issue causing disapproval. I hope that this compromise is adequate. Derrell commit d4b4bae8ded824d06ad5ab0e219f71187ee5c771 Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Feb 28 11:23:20 2008 -0500 Initial revamp of the libsmbclient interface. The libsmbclient interface has suffered from difficulty of improvement and feature enrichment without causing ABI breakage. Although there were a number of issues, the primary ones were: (a) the user of the library would manually manipulate the context structure members, meaning that nothing in the context structure could change other than adding stuff at the end; (b) there were three methods of setting options: setting bits in a flags field within the context structure, setting explicit options variables within an options structure in the context structure, and by calling the smbc_option_set() function; (c) the authentication callback did not traditionally provide enough information to the callee which required adding an option for a callback with a different signature, and now there are requests for even more information at the callback, requiring yet a third signature and option to set it (if we implement that feature). This commit provides a reorganization of the code which fixes (a) and (b). The context structure is now entirely opaque, and there are setter and getter functions for manipulating it. This makes maintaining ABI consistency much, much easier
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2701-g93580bc
The branch, v3-2-test has been updated via 93580bce833453ba512ee436d6dfdbdcd2c53777 (commit) from 71e86f13b0ace3841c6712084728c79db74ff803 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 93580bce833453ba512ee436d6dfdbdcd2c53777 Author: Derrell Lipman [EMAIL PROTECTED] Date: Sun Mar 2 16:21:48 2008 -0500 Remove use of deprecated function --- Summary of changes: examples/libsmbclient/smbwrapper/smbw.c |6 +++--- examples/libsmbclient/testacl.c |2 +- examples/libsmbclient/testacl2.c|2 +- examples/libsmbclient/testacl3.c|2 +- examples/libsmbclient/testbrowse.c |4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/smbwrapper/smbw.c b/examples/libsmbclient/smbwrapper/smbw.c index d3439e4..e2e44c1 100644 --- a/examples/libsmbclient/smbwrapper/smbw.c +++ b/examples/libsmbclient/smbwrapper/smbw.c @@ -176,9 +176,9 @@ static void do_init(StartupType startupType) smbc_setDebug(smbw_ctx, debug_level); smbc_setFunctionAuthData(smbw_ctx, get_auth_data_fn); -smbc_option_set(smbw_ctx, browse_max_lmb_count, 0); -smbc_option_set(smbw_ctx, urlencode_readdir_entries, 1); -smbc_option_set(smbw_ctx, one_share_per_server, 1); +smbc_setOptionBrowseMaxLmbCount(smbw_ctx, 0); +smbc_setOptionUrlEncodeReaddirEntries(smbw_ctx, 1); +smbc_setOptionOneSharePerServer(smbw_ctx, 1); if (smbc_init_context(smbw_ctx) == NULL) { fprintf(stderr, Could not initialize context.\n); diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c index 51cc90f..00e1c2c 100644 --- a/examples/libsmbclient/testacl.c +++ b/examples/libsmbclient/testacl.c @@ -143,7 +143,7 @@ int main(int argc, const char *argv[]) if (full_time_names) { SMBCCTX *context = smbc_set_context(NULL); -smbc_option_set(context, full_time_names, 1); +smbc_setOptionFullTimeNames(context, 1); } /* Perform requested action */ diff --git a/examples/libsmbclient/testacl2.c b/examples/libsmbclient/testacl2.c index df38fe2..d2a97cf 100644 --- a/examples/libsmbclient/testacl2.c +++ b/examples/libsmbclient/testacl2.c @@ -39,7 +39,7 @@ int main(int argc, const char *argv[]) } SMBCCTX *context = smbc_set_context(NULL); -smbc_option_set(context, full_time_names, 1); +smbc_setOptionFullTimeNames(context, 1); the_acl = strdup(system.nt_sec_desc.*); ret = smbc_getxattr(argv[1], the_acl, value, sizeof(value)); diff --git a/examples/libsmbclient/testacl3.c b/examples/libsmbclient/testacl3.c index 9102405..4ef6e80 100644 --- a/examples/libsmbclient/testacl3.c +++ b/examples/libsmbclient/testacl3.c @@ -28,7 +28,7 @@ int main(int argc, char * argv[]) smbc_init(get_auth_data_fn, debug); context = smbc_set_context(NULL); -smbc_option_set(context, full_time_names, 1); +smbc_setOptionFullTimeNames(context, 1); for (;;) { diff --git a/examples/libsmbclient/testbrowse.c b/examples/libsmbclient/testbrowse.c index 1b0b54f..c4ca666 100644 --- a/examples/libsmbclient/testbrowse.c +++ b/examples/libsmbclient/testbrowse.c @@ -120,7 +120,7 @@ main(int argc, char * argv[]) /* If we've been asked to log to stderr instead of stdout, ... */ if (debug_stderr) { /* ... then set the option to do so */ -smbc_option_set(context, debug_to_stderr, 1); +smbc_setOptionDebugToStderr(context, 1); } /* Initialize the context using the previously specified options */ @@ -196,7 +196,7 @@ get_auth_data_with_context_fn(SMBCCTX * context, { printf(Authenticating with context 0x%lx, context); if (context != NULL) { -char *user_data = smbc_option_get(context, user_data); +char *user_data = smbc_getOptionUserData(context); printf( with user data %s, user_data); } printf(\n); -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2533-g7e6da15
The branch, v3-2-test has been updated via 7e6da154b18f0aabcf2f8050bc5a57677bc9b322 (commit) via df995eddbddec80a0d9d4659bbb9c6ca8a45d02b (commit) via 6f5051b9c1405ab1dc3e697419ceedb3acac46d8 (commit) via a19e5fd5846685d5264e92bedf5cb57d99271f28 (commit) via 7e5752812d6d9e3bcf9a545cbdcf3afe2175dbc4 (commit) from a3da677bf0faed56e6731ee96708a7847a61d118 (commit) http://gitweb.samba.org/?samba.git;a=shortlog;h=v3-2-test - Log - commit 7e6da154b18f0aabcf2f8050bc5a57677bc9b322 Author: Derrell Lipman [EMAIL PROTECTED] Date: Tue Feb 26 21:46:48 2008 -0500 update .gitignore with new test program executable commit df995eddbddec80a0d9d4659bbb9c6ca8a45d02b Author: Derrell Lipman [EMAIL PROTECTED] Date: Tue Feb 26 21:46:08 2008 -0500 add a test program for the new ftruncate functionality commit 6f5051b9c1405ab1dc3e697419ceedb3acac46d8 Author: Derrell Lipman [EMAIL PROTECTED] Date: Tue Feb 26 21:44:51 2008 -0500 add smbc_ftruncate() to emulate POSIX ftruncate() commit a19e5fd5846685d5264e92bedf5cb57d99271f28 Author: Derrell Lipman [EMAIL PROTECTED] Date: Tue Feb 26 21:43:13 2008 -0500 add 64-bit macros from samba4 commit 7e5752812d6d9e3bcf9a545cbdcf3afe2175dbc4 Author: Derrell Lipman [EMAIL PROTECTED] Date: Tue Feb 26 21:42:26 2008 -0500 add a function to truncate a file to a specified size --- Summary of changes: .gitignore |1 + examples/libsmbclient/Makefile |5 ++ examples/libsmbclient/testtruncate.c | 82 ++ source/include/byteorder.h |6 +++ source/include/libsmbclient.h| 31 + source/libsmb/clifile.c | 49 source/libsmb/libsmb_compat.c|6 +++ source/libsmb/libsmbclient.c | 75 +++ 8 files changed, 255 insertions(+), 0 deletions(-) create mode 100644 examples/libsmbclient/testtruncate.c Changeset truncated at 500 lines: diff --git a/.gitignore b/.gitignore index b445ccf..516fd45 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ examples/libsmbclient/teststat2 examples/libsmbclient/teststat3 examples/libsmbclient/testutime examples/libsmbclient/testwrite +examples/libsmbclient/testtruncate diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 6c70659..e2d8b68 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -24,6 +24,7 @@ TESTS=testsmbc \ teststat \ teststat2 \ teststat3 \ + testtruncate \ testchmod \ testutime \ testread \ @@ -73,6 +74,10 @@ teststat3: teststat3.o @echo Linking teststat3 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt +testtruncate: testtruncate.o + @echo Linking testtruncate + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt + testchmod: testchmod.o @echo Linking testchmod $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt diff --git a/examples/libsmbclient/testtruncate.c b/examples/libsmbclient/testtruncate.c new file mode 100644 index 000..8882acd --- /dev/null +++ b/examples/libsmbclient/testtruncate.c @@ -0,0 +1,82 @@ +#include stdio.h +#include unistd.h +#include string.h +#include time.h +#include errno.h +#include libsmbclient.h +#include get_auth_data_fn.h + + +int main(int argc, char * argv[]) +{ +int fd; +int ret; +int debug = 0; +int savedErrno; +charbuffer[128]; +char * pSmbPath = NULL; +char * pLocalPath = NULL; +struct stat st; + +if (argc != 2) +{ +printf(usage: + %s smb://path/to/file\n, + argv[0]); +return 1; +} + +smbc_init(get_auth_data_fn, debug); + +if ((fd = smbc_open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0)) 0) +{ +perror(smbc_open); +return 1; +} + +strcpy(buffer, Hello world.\nThis is a test.\n); + +ret = smbc_write(fd, buffer, strlen(buffer)); +savedErrno = errno; +smbc_close(fd); + +if (ret 0) +{ +errno = savedErrno; +perror(write); +} + +if (smbc_stat(argv[1], st) 0) +{ +perror(smbc_stat); +return 1; +} + +printf(Original size: %lu\n, (unsigned long) st.st_size); + +if ((fd = smbc_open(argv[1], O_WRONLY, 0)) 0) +{ +perror(smbc_open); +return 1; +} + +ret = smbc_ftruncate(fd, 13); +savedErrno = errno; +smbc_close(fd); +if (ret 0) +{ +errno = savedErrno; +perror(smbc_ftruncate); +return 1; +} + +if (smbc_stat(argv[1], st) 0) +{ +perror
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1628-g4c08725
The branch, v3-2-test has been updated via 4c08725a42a8babf0f078fb4b221a96f58deeb50 (commit) via 54abf7d0e595e9cbeea115a40d4f7b995252a150 (commit) from 2df0cdaafdced798f81e30d34371aa1d8e963208 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 4c08725a42a8babf0f078fb4b221a96f58deeb50 Merge: 2df0cdaafdced798f81e30d34371aa1d8e963208 54abf7d0e595e9cbeea115a40d4f7b995252a150 Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jan 23 20:50:24 2008 -0500 Merge branch 'setxattr-dos-mode' into v3-2-test commit 54abf7d0e595e9cbeea115a40d4f7b995252a150 Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jan 23 20:44:54 2008 -0500 Allow clearing all settable DOS mode bits. A mode value of zero is ignored by Windows. If the requested mode is zero, we instead send the appropriate one of 0x80 (NORMAL) or 0x10 (DIRECTORY). Thanks Jeremy! Derrell --- Summary of changes: source/libsmb/libsmbclient.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c index fbcb7f6..2eb580a 100644 --- a/source/libsmb/libsmbclient.c +++ b/source/libsmb/libsmbclient.c @@ -4689,7 +4689,15 @@ dos_attr_parse(SMBCCTX *context, frame = talloc_stackframe(); while (next_token_talloc(frame, p, tok, \t,\r\n)) { if (StrnCaseCmp(tok, MODE:, 5) == 0) { - dad-mode = strtol(tok+5, NULL, 16); +long request = strtol(tok+5, NULL, 16); +if (request == 0) { +dad-mode = (request | + (IS_DOS_DIR(dad-mode) + ? FILE_ATTRIBUTE_DIRECTORY + : FILE_ATTRIBUTE_NORMAL)); +} else { +dad-mode = request; +} continue; } -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1514-g843e169
The branch, v3-2-test has been updated via 843e1694cfe4a999ed14a9c215b8e77723d0fe79 (commit) from b8a57a24c390355c4950ca499c1d96aff80abad7 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 843e1694cfe4a999ed14a9c215b8e77723d0fe79 Author: Derrell Lipman [EMAIL PROTECTED] Date: Fri Jan 18 14:22:49 2008 -0500 Fix typo that disabled setting group id. Thanks, Henrik. --- Summary of changes: source/libsmb/libsmbclient.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Changeset truncated at 500 lines: diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c index 2fd8294..fbcb7f6 100644 --- a/source/libsmb/libsmbclient.c +++ b/source/libsmb/libsmbclient.c @@ -5931,7 +5931,7 @@ smbc_setxattr_ctx(SMBCCTX *context, } else { ret = cacl_set(talloc_tos(), srv-cli, ipc_srv-cli, ipc_srv-pol, path, - namevalue, SMBC_XATTR_MODE_CHOWN, 0); + namevalue, SMBC_XATTR_MODE_CHGRP, 0); } TALLOC_FREE(frame); return ret; -- Samba Shared Repository
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1457-g15ef5e4
The branch, v3-2-test has been updated via 15ef5e4884505bca7990e44200d0235764e9057f (commit) via b4282fbd6d27d868b2d5c04bb72d2d7421822da1 (commit) via 5a4a7aec761c3388b741b9b47fa6358fc71a66ce (commit) from e342ca0d931f9a5c8ec9e472dc9c63f1fe012b3a (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 15ef5e4884505bca7990e44200d0235764e9057f Merge: b4282fbd6d27d868b2d5c04bb72d2d7421822da1 e342ca0d931f9a5c8ec9e472dc9c63f1fe012b3a Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Jan 17 09:29:52 2008 -0500 Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test commit b4282fbd6d27d868b2d5c04bb72d2d7421822da1 Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Jan 17 09:29:13 2008 -0500 Fix stat results to be consistent between smbc_stat and smbc_fstat. We create a kludged inode based on the checksum of the path. We therefore need to use the same (full) path when calculating it in both smbc_stat() and smbc_fstat(). If struct stat has an rdev field, set it to zero. Derrell commit 5a4a7aec761c3388b741b9b47fa6358fc71a66ce Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Jan 17 09:26:36 2008 -0500 Add some additional libsmbclient test programs. testwrite: create or truncate a file and write to it. teststat3: compare the results from smbc_stat() and smbc_fstat() Derrell --- Summary of changes: examples/libsmbclient/Makefile| 12 +++- examples/libsmbclient/teststat3.c | 78 + examples/libsmbclient/{testread.c = testwrite.c} | 20 +++--- source/libsmb/libsmbclient.c |5 +- 4 files changed, 104 insertions(+), 11 deletions(-) create mode 100644 examples/libsmbclient/teststat3.c copy examples/libsmbclient/{testread.c = testwrite.c} (71%) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 26b8057..9657957 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -22,9 +22,11 @@ TESTS= testsmbc \ testbrowse2 \ teststat \ teststat2 \ + teststat3 \ testchmod \ testutime \ - testread + testread \ + testwrite # tree \ @@ -62,6 +64,10 @@ teststat2: teststat2.o @echo Linking teststat2 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt +teststat3: teststat3.o + @echo Linking teststat3 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt + testchmod: testchmod.o @echo Linking testchmod $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt @@ -74,6 +80,10 @@ testread: testread.o @echo Linking testread $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt +testwrite: testwrite.o + @echo Linking testwrite + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt + smbsh: make -C smbwrapper diff --git a/examples/libsmbclient/teststat3.c b/examples/libsmbclient/teststat3.c new file mode 100644 index 000..26348b3 --- /dev/null +++ b/examples/libsmbclient/teststat3.c @@ -0,0 +1,78 @@ +#include libsmbclient.h +#include sys/stat.h +#include string.h +#include stdio.h +#include time.h +#include get_auth_data_fn.h + +/* + * This test is intended to ensure that the timestamps returned by + * libsmbclient using smbc_stat() are the same as those returned by + * smbc_fstat(). + */ + + +int main(int argc, char* argv[]) +{ +int fd; +struct stat st1; +struct stat st2; +charmtime[32]; +charctime[32]; +charatime[32]; +char * pUrl = argv[1]; + +if(argc != 2) +{ +printf(usage: %s file_url\n, argv[0]); +return 1; +} + + +smbc_init(get_auth_data_fn, 0); + +if (smbc_stat(pUrl, st1) 0) +{ +perror(smbc_stat); +return 1; +} + +if ((fd = smbc_open(pUrl, O_RDONLY, 0)) 0) +{ +perror(smbc_open); +return 1; +} + +if (smbc_fstat(fd, st2) 0) +{ +perror(smbc_fstat); +return 1; +} + +smbc_close(fd); + +#define COMPARE(name, field)\ +if (st1.field != st2.field) \ +{ \ +printf(Field name MISMATCH: st1=%lu, st2=%lu\n, \ + (unsigned long) st1.field, \ + (unsigned long
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1491-g7135d2a
The branch, v3-2-test has been updated via 7135d2aea5a68a79e2a77d4a02219436f5e154cc (commit) via 41ad5c7700c5ef3839c0629ee5eb42ec0fe61da6 (commit) via 67c415661f6466c21cd0eaafabe58cba049d2af3 (commit) via f5f46de404dba2e4a03d205a62cd5cf7ea4e075a (commit) from a3b36c3cb0fe5f3e78c200290afa59829934f496 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 7135d2aea5a68a79e2a77d4a02219436f5e154cc Merge: 41ad5c7700c5ef3839c0629ee5eb42ec0fe61da6 a3b36c3cb0fe5f3e78c200290afa59829934f496 Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Jan 17 11:50:41 2008 -0500 Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test commit 41ad5c7700c5ef3839c0629ee5eb42ec0fe61da6 Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Jan 17 11:50:22 2008 -0500 stop bothering me about example programs not checked in commit 67c415661f6466c21cd0eaafabe58cba049d2af3 Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Jan 17 11:49:17 2008 -0500 Fix bug 5185: repeated calls to smbc_getxattr() lose sid-name mapping If we're going to cache connections to IPC$, we'd better also cache the policy handle and not use a stack-based handle that's invalid on subsequent calls. Derrell commit f5f46de404dba2e4a03d205a62cd5cf7ea4e075a Author: Derrell Lipman [EMAIL PROTECTED] Date: Thu Jan 17 11:46:41 2008 -0500 Add a program to test repeated calls to smbc_getxattr(). --- Summary of changes: .gitignore | 16 examples/libsmbclient/Makefile |5 ++ examples/libsmbclient/{testread.c = testacl3.c} | 31 - source/include/libsmb_internal.h |1 + source/libsmb/libsmbclient.c | 83 ++ 5 files changed, 72 insertions(+), 64 deletions(-) copy examples/libsmbclient/{testread.c = testacl3.c} (64%) Changeset truncated at 500 lines: diff --git a/.gitignore b/.gitignore index f11de08..b445ccf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.o *.po *~ +source/TAGS source/client/client_proto.h source/libnet/libnet_proto.h source/include/build_env.h @@ -45,3 +46,18 @@ examples/VFS/module_config.h.in examples/VFS/shadow_copy_test.so examples/VFS/skel_opaque.so examples/VFS/skel_transparent.so +examples/libsmbclient/smbwrapper/smbsh +examples/libsmbclient/smbwrapper/smbwrapper.so +examples/libsmbclient/testacl +examples/libsmbclient/testacl2 +examples/libsmbclient/testacl3 +examples/libsmbclient/testbrowse +examples/libsmbclient/testbrowse2 +examples/libsmbclient/testchmod +examples/libsmbclient/testread +examples/libsmbclient/testsmbc +examples/libsmbclient/teststat +examples/libsmbclient/teststat2 +examples/libsmbclient/teststat3 +examples/libsmbclient/testutime +examples/libsmbclient/testwrite diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 9657957..6c70659 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -18,6 +18,7 @@ LIBSMBCLIENT = -lwbclient -lsmbclient -ldl -lresolv TESTS= testsmbc \ testacl \ testacl2 \ + testacl3 \ testbrowse \ testbrowse2 \ teststat \ @@ -48,6 +49,10 @@ testacl2: testacl2.o @echo Linking testacl2 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt +testacl3: testacl3.o + @echo Linking testacl3 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt + testbrowse: testbrowse.o @echo Linking testbrowse $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $ $(LIBSMBCLIENT) -lpopt diff --git a/examples/libsmbclient/testread.c b/examples/libsmbclient/testacl3.c similarity index 64% copy from examples/libsmbclient/testread.c copy to examples/libsmbclient/testacl3.c index 3f94884..9102405 100644 --- a/examples/libsmbclient/testread.c +++ b/examples/libsmbclient/testacl3.c @@ -16,15 +16,20 @@ int main(int argc, char * argv[]) int debug = 0; int mode = 0666; int savedErrno; -charbuffer[2048]; +charvalue[2048]; charpath[2048]; +char * the_acl; char * p; time_t t0; time_t t1; struct stat st; +SMBCCTX * context; smbc_init(get_auth_data_fn, debug); +context = smbc_set_context(NULL); +smbc_option_set(context, full_time_names, 1); + for (;;) { fprintf(stdout, Path: ); @@ -41,26 +46,16 @@ int main(int argc, char * argv[]) *p = '\0'; } -if ((fd = smbc_open(path, O_RDONLY, 0)) 0) -{ -perror(smbc_open); -continue; -} - -do -{ -ret = smbc_read(fd
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1407-gaebecd7
The branch, v3-2-test has been updated via aebecd7462733b56457540423354ba249fd52808 (commit) via 9d75ea577b407ccab59196760d376831062a3ab5 (commit) via 296a6783fbc03460e87ac4136a0a9e6d2743b2ff (commit) via 01f6a4cca7a91ae41ff393263418216324502f84 (commit) from 4db26c803de52d3efccc940efc55f14131a057f5 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit aebecd7462733b56457540423354ba249fd52808 Merge: 9d75ea577b407ccab59196760d376831062a3ab5 4db26c803de52d3efccc940efc55f14131a057f5 Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jan 16 14:41:43 2008 + Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test commit 9d75ea577b407ccab59196760d376831062a3ab5 Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jan 16 14:41:11 2008 + Modify testread example to loop using same context. There's been a problem seen where open/read/close a number of times causes open failures eventually. This program has been modified to create the context once and then loop requesting file names to open/read/close. This program also demonstrates the current error in cli_read() where it returns an error instead of length 0 upon end of file. Derrell commit 296a6783fbc03460e87ac4136a0a9e6d2743b2ff Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jan 16 14:37:40 2008 + Replace GetTimeOfDay() with gettimeofday() in example program. GetTimeOfDay() seems to no longer be exported. For the smbsh example, just use the native gettimeofday() for now. commit 01f6a4cca7a91ae41ff393263418216324502f84 Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jan 16 14:35:44 2008 + Add a (very!) trivial cache to the example authentication callback. --- Summary of changes: examples/libsmbclient/get_auth_data_fn.h | 22 - examples/libsmbclient/smbwrapper/select.c |5 +- examples/libsmbclient/testread.c | 76 + 3 files changed, 57 insertions(+), 46 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/get_auth_data_fn.h b/examples/libsmbclient/get_auth_data_fn.h index eb49388..b1d36c8 100644 --- a/examples/libsmbclient/get_auth_data_fn.h +++ b/examples/libsmbclient/get_auth_data_fn.h @@ -8,7 +8,23 @@ get_auth_data_fn(const char * pServer, char * pPassword, int maxLenPassword) { -char temp[128]; +chartemp[128]; +charserver[256] = { '\0' }; +charshare[256] = { '\0' }; +charworkgroup[256] = { '\0' }; +charusername[256] = { '\0' }; +charpassword[256] = { '\0' }; + +if (strcmp(server, pServer) == 0 +strcmp(share, pShare) == 0 +*workgroup != '\0' +*username != '\0') +{ +strncpy(pWorkgroup, workgroup, maxLenWorkgroup - 1); +strncpy(pUsername, username, maxLenUsername - 1); +strncpy(pPassword, password, maxLenPassword - 1); +return; +} fprintf(stdout, Workgroup: [%s] , pWorkgroup); fgets(temp, sizeof(temp), stdin); @@ -48,4 +64,8 @@ get_auth_data_fn(const char * pServer, { strncpy(pPassword, temp, maxLenPassword - 1); } + +strncpy(workgroup, pWorkgroup, sizeof(workgroup) - 1); +strncpy(username, pUsername, sizeof(username) - 1); +strncpy(password, pPassword, sizeof(password) - 1); } diff --git a/examples/libsmbclient/smbwrapper/select.c b/examples/libsmbclient/smbwrapper/select.c index 4e87a2e..bb7a25f 100644 --- a/examples/libsmbclient/smbwrapper/select.c +++ b/examples/libsmbclient/smbwrapper/select.c @@ -72,13 +72,12 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf int ret; fd_set *readfds2, readfds_buf, *writefds2, writefds_buf, *errorfds2, errorfds_buf; struct timeval tval2, *ptval, end_time, now_time; -extern void GetTimeOfDay(struct timeval *tval); readfds2 = (readfds ? readfds_buf : NULL); writefds2 = (writefds ? writefds_buf : NULL); errorfds2 = (errorfds ? errorfds_buf : NULL); if (tval) { -GetTimeOfDay(end_time); +gettimeofday(end_time, NULL); end_time.tv_sec += tval-tv_sec; end_time.tv_usec += tval-tv_usec; end_time.tv_sec += end_time.tv_usec / 100; @@ -96,7 +95,7 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf if (errorfds) errorfds_buf = *errorfds; if (tval) { -GetTimeOfDay(now_time); +gettimeofday(now_time, NULL); tval2.tv_sec = end_time.tv_sec
[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1397-g4ff2101
The branch, v3-2-test has been updated via 4ff2101c69a0cfcfdc5f775493cb6e88c57e4bbe (commit) via f963d57096184dd9381fcc5f175150d27460ea7a (commit) via 3a61e663e51fe620225691bc8673bf8800a36f47 (commit) via 913c335d21c503d32b35bf65da7b2bddf0473875 (commit) via 2f432842442859f98ecd263464ce02821ab10fca (commit) from 874425c8f680fb2f737b46a3177b239e69302af5 (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 4ff2101c69a0cfcfdc5f775493cb6e88c57e4bbe Merge: f963d57096184dd9381fcc5f175150d27460ea7a 874425c8f680fb2f737b46a3177b239e69302af5 Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jan 16 02:30:21 2008 + Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test commit f963d57096184dd9381fcc5f175150d27460ea7a Merge: 3a61e663e51fe620225691bc8673bf8800a36f47 5467db388355a4769e48fed7eb80920d1820f727 Author: Derrell Lipman [EMAIL PROTECTED] Date: Wed Jan 16 00:45:06 2008 + Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test commit 3a61e663e51fe620225691bc8673bf8800a36f47 Merge: 913c335d21c503d32b35bf65da7b2bddf0473875 9a4b6fd3e21f54a0ff83f1fd0d0d5331a2cfdd0a Author: Derrell Lipman [EMAIL PROTECTED] Date: Tue Jan 15 13:58:47 2008 + Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test commit 913c335d21c503d32b35bf65da7b2bddf0473875 Author: Derrell Lipman [EMAIL PROTECTED] Date: Sun Jan 13 17:10:06 2008 -0500 Fix smbc_listxattr() and friends (bug #5189) When the capability of using full names for DOS attributes was added, a bug was introduced which caused the wrong number of bytes to be returned. This patch to smbc_listxattr_ctx() fixes the problem. Thanks to Jack Schmidt for this patch. Derrell commit 2f432842442859f98ecd263464ce02821ab10fca Author: Derrell Lipman [EMAIL PROTECTED] Date: Sun Jan 13 12:07:18 2008 -0500 Fix compile and linking errors since last this code was tested --- Summary of changes: examples/libsmbclient/Makefile |2 +- examples/libsmbclient/smbwrapper/Makefile |2 +- examples/libsmbclient/smbwrapper/wrapper.c |1 + examples/libsmbclient/testacl.c| 27 ++- source/include/libsmbclient.h |2 +- source/libsmb/libsmbclient.c | 11 +++ 6 files changed, 37 insertions(+), 8 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 6500707..26b8057 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -13,7 +13,7 @@ CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS) LDFLAGS = -L/usr/local/samba/lib \ -lldap -lkrb5 -lgssapi_krb5 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so -LIBSMBCLIENT = -lsmbclient -ldl -lresolv +LIBSMBCLIENT = -lwbclient -lsmbclient -ldl -lresolv TESTS= testsmbc \ testacl \ diff --git a/examples/libsmbclient/smbwrapper/Makefile b/examples/libsmbclient/smbwrapper/Makefile index c94ef8f..7264353 100644 --- a/examples/libsmbclient/smbwrapper/Makefile +++ b/examples/libsmbclient/smbwrapper/Makefile @@ -1,4 +1,4 @@ -LIBS = -lsmbclient -ldl +LIBS = -lwbclient -lsmbclient -ldl DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CFLAGS = -I$(SAMBA_INCL) $(EXTLIB_INCL) diff --git a/examples/libsmbclient/smbwrapper/wrapper.c b/examples/libsmbclient/smbwrapper/wrapper.c index 30f9037..958e006 100644 --- a/examples/libsmbclient/smbwrapper/wrapper.c +++ b/examples/libsmbclient/smbwrapper/wrapper.c @@ -61,6 +61,7 @@ #include dirent.h #include signal.h #include stdarg.h +#include string.h #ifdef __USE_GNU # define SMBW_USE_GNU #endif diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c index 4d327b3..51cc90f 100644 --- a/examples/libsmbclient/testacl.c +++ b/examples/libsmbclient/testacl.c @@ -7,6 +7,7 @@ enum acl_mode { +SMB_ACL_LIST, SMB_ACL_GET, SMB_ACL_SET, SMB_ACL_DELETE, @@ -24,7 +25,7 @@ int main(int argc, const char *argv[]) int debug = 0; int numeric = 0; int full_time_names = 0; -enum acl_mode mode = SMB_ACL_GET; +enum acl_mode mode = SMB_ACL_LIST; static char *the_acl = NULL; int ret; char *p; @@ -149,6 +150,30 @@ int main(int argc, const char *argv[]) switch(mode) { +case SMB_ACL_LIST: +ret = smbc_listxattr(path, value, sizeof(value)-2); +if (ret 0) +{ +printf(Could not get attribute list for [%s] %d: %s\n, + path, errno, strerror(errno)); +return 1; +} + +/* + * The list of attributes has a series of null-terminated strings. + * The list of strings terminates with an extra
Re: [SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-419-g9d0034f
On Nov 30, 2007 5:20 PM, Jeremy Allison [EMAIL PROTECTED] wrote: The branch, v3-2-test has been updated via 9d0034faed939a4534637696f1631ac2da60e4a3 (commit) from fa8115f32bfd37f75c284ff0f6906dbc2af0f40c (commit) http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log - commit 9d0034faed939a4534637696f1631ac2da60e4a3 Author: Jeremy Allison [EMAIL PROTECTED] Date: Fri Nov 30 14:19:55 2007 -0800 Removed all pstrings from libsmbclient. Derryl please check. Passes valgrind tests I've run in examples/libsmbclient. Jeremy, I'm looking only at the patch right now since I don't have easy access to the source tree. In the patch, I see only two areas that may warrant further verification: @@ -2744,7 +2743,14 @@ smbc_opendir_ctx(SMBCCTX *context, return NULL; } - if (user[0] == (char)0) fstrcpy(user, context-user); + if (!user || user[0] == (char)0) { + user = talloc_strdup(frame, context-user); + if (!user) { + errno = ENOMEM; + TALLOC_FREE(frame); + return NULL; + } + } I don't know how user[0] can become a null character, but if for some reason 'user' is non-null but user[0] is a null character, the if statement will be entered and user will be overwritten. It's on context 'frame' so maybe that's ok, but it'd probably be cleaner if user were deallocated before being allocated if it was non-null. @@ -2847,8 +2853,13 @@ smbc_opendir_ctx(SMBCCTX *context, if ( !cli ) continue; - pstrcpy(workgroup, wg_ptr); -fstrcpy(server, cli-desthost); + workgroup = talloc_strdup(frame, wg_ptr); + server = talloc_strdup(frame, cli-desthost); + if (!workgroup || !server) { + errno = ENOMEM; + TALLOC_FREE(frame); + return NULL; + } This is newly-added clean-up (error handling) code where none was previously needed. Are we sure that's all the cleanup required before returning? Due to other constraints, I won't be back to being able to do any Samba work until mid-December. If further investigation in the source is still required, that's when I'll be able to do it. Cheers, Derrell
Re: svn commit: samba r23108 - in branches: SAMBA_3_0/source/lib/replace SAMBA_3_0_26/source/lib/replace SAMBA_4_0/source/lib/replace
Stefan (metze) Metzmacher [EMAIL PROTECTED] writes: seems that revision 22772 wasn't merged into all branches... http://websvn.samba.org/cgi-bin/viewcvs.cgi?rev=22772view=rev Sorry, I think I merged it to all of the Samba3 branches, but it didn't occur to me that the same code was used in Samba4. maybe we should better move this to samba3 instead of libreplace... as libreplace will not provide replacements for readahead(). That change should be merged into libreplace in Samba4. The problem it was intended to solve -- an existing readahead() function but no header that declares it -- would exist just as much in Samba4 as in Samba3 (even if nothing in Samba4 currently uses readahead). Please go ahead and merge that in with the current work. (There's also a configure test that was added in the same patch.) Derrell
Re: svn commit: samba r23108 - in branches: SAMBA_3_0/source/lib/replace SAMBA_3_0_26/source/lib/replace SAMBA_4_0/source/lib/replace
Stefan (metze) Metzmacher [EMAIL PROTECTED] writes: Stefan (metze) Metzmacher schrieb: [EMAIL PROTECTED] schrieb: Stefan (metze) Metzmacher [EMAIL PROTECTED] writes: seems that revision 22772 wasn't merged into all branches... http://websvn.samba.org/cgi-bin/viewcvs.cgi?rev=22772view=rev Sorry, I think I merged it to all of the Samba3 branches, but it didn't occur to me that the same code was used in Samba4. maybe we should better move this to samba3 instead of libreplace... as libreplace will not provide replacements for readahead(). That change should be merged into libreplace in Samba4. The problem it was intended to solve -- an existing readahead() function but no header that declares it -- would exist just as much in Samba4 as in Samba3 (even if nothing in Samba4 currently uses readahead). Please go ahead and merge that in with the current work. (There's also a configure test that was added in the same patch.) Hi Derell, I know of the initial problem. But as the test for readahead function is in configure.in in samba3 the test for the prototype should also be there, as it really only belongs to samba3. and we do exactly this for a lot of other functions in samba3's configure.in and include/includes.h... Ok, so there's no attempt to keep samba3's and samba4's libreplace the same? Derrell
Backup interface?
I am in search of a method of backing up open files on Windows machines, using Samba or libsmbclient on a Linux machine. I've heard rumors of a Backup Interface in the network protocols, which allows backing up open files when a normal open() would fail), but have not been able to find any information on it. Is there such an interface, and if so, does Samba provide access to it? Thanks, Derrell
Re: Applications that want 8.3 names
Richard Sharpe [EMAIL PROTECTED] writes: Is anyone aware of Windows applications that will only deal with 8.3 names and cannot deal with long file names? Modern apps, no. Lots of Windows 3.1 apps (e.g. Quicken versions from back in the day) couldn't deal with long file names when moved onto later Windows versions which would have otherwise supported it. Derrell
Getting notification upon loss of connection (libsmbclient)
I have not been able to find the block of code that will be called if an open connection receives an indication that the peer has gone away (i.e. shutdown, crashed, cable cut, etc.). More specifically, if I have an open, established connection by having previously done: cli_connect() cli_session_request() cli_session_setup() cli_send_tconX() and now the remote server goes away (let's say it crashed suddenly), how can I find this out? The above functions are used by smbwrapper to establish a connection to a server. If smbwrapper is being used by a long-lived application (e.g. emacs), and the connection goes away, currently, access to the remote system stops and is never regained even after the server becomes available again, because (I think) the current code has no way to determine that the connection went away and continues to (try to) use the now-failed connection. Your help will be much appreciated! Cheers, Derrell
Re: client: browse doesn't work with only win98 in workgroup
Christopher R. Hertel [EMAIL PROTECTED] writes: The problem is that W/9x boxes do not recognize the generic *SMBSERVER name in the NBT Session Setup Request. Also, W/9x boxes will send back an error if the called name is not correct in the NBT Session Setup Request. You should get a NEGATIVE SESSION RESPONSE (0x83) message with an error code of: 0x82: Called Name Not Present Since W/9x systems do not support the generic *SMBSERVER name, this error message is correct. Basically, it's the NBT equivalent of That port isn't listening for a connection. The solution is to find the Server Service name on the remote machine. This is typically done by sending a Node Status query and looking for a name with a suffix byte value of 0x20. Great! The information you provided here and interspersed in my message seems to be exactly what I needed. I should be able to implement this correctly now. I know that this is pedantic, but it's important to understand that there is a difference between the set of hosts in a workgroup and the servers offering SMB services in the workgroup. A host may be a client and it may not be offering SMB services, in which case it will not show up when you try listing the servers in the workgroup. I know enough right now to ask intelligible questions, although not yet with correct terminology. I appreciate you setting me straight. Your explanation of not only the correct terminology, but why the terminology I was using actually had a different meaning, was enlightening. Thanks for your help! Derrell
Re: client: browse doesn't work with only win98 in workgroup
[EMAIL PROTECTED] writes: Christopher R. Hertel [EMAIL PROTECTED] writes: I am interested in looking into this, but I won't have time until the weekend. ... In the mean time, I have modified smbw_dir.c to include a new function smbw_browse_workgroup_alternate() with the following patch. The code is basically stolen from nmblookup.c. More testing (and the Duh! factor upon reviewing the code) reveals that the code I added does not find all hosts in a workgroup; it finds some of the hosts. Actually, it finds _one_ host each time it's run, not necessarily the same host each time. I'll have to work on this some more if the cli_session_request() method can't be made to work properly with win98 and win95 machines as master browsers. Derrell
Re: client: browse doesn't work with only win98 in workgroup
Christopher R. Hertel [EMAIL PROTECTED] writes: Derrell, Can you give me a better idea of what you are trying to do? Above, you say you are trying to find all hosts that are members of a given workgroup. The question is: why? What is it that you are actually trying to accomplish? I'm working on providing a tree-style view of the network in a fashion similar to what Windows Explorer does. The top level of an SMB/CIFS network is something like Microsoft Windows Network. The next level down is the list of workgroups/domains within the network; then the hosts within each workgroup; then the shares within each share, etc. I don't know what version of Windows will be the master browser, and I don't want to force it by using Samba as the master browser. Therefore I have to be able to enumerate the hosts within a workgroup regardless of what versions of Windows happen to be on the network. Keep in mind that there is a *very* big difference between the set of hosts that are members of a workgroup and the set of servers offering services within that workgroup. Two distinct systems are used to gather those two lists. The latter works fine. If I already know the host name, I can see the shares on that host. The problem is enumerating the hosts within a workgroup. In the case of smbwrapper and smbsh, one is supposed to be able to do: ls /smb to see the list of workgroups/domains, and ls /smb/WORKGROUP to see the list of hosts within the workgroup WORKGROUP, and ls /smb/WORKGROUP/HOST to see a list of shares on the computer called HOST. All of these work with the method implemented in smbwrapper, except for enumerating the list of hosts within a workgroup where the master browser for the workgroup is a Windows 98 or Windows 95 machine. If there is a Windows 2000 server acting as the master browser for the workgroup, then obtaining the list of hosts within the workgroup works fine. However, the cli_session_request() call fails (gets a result of 0x83 from the peer) when the master browser is a win98 machine, so the list of hosts within the workgroup is therefore unavailable. Does this help clarify the problem? If not, please query me again and I'll try to explain differently. Thanks for your help! Derrell
client: browse doesn't work with only win98 in workgroup
It appears that name_resolve_bcast() does not find hosts in a workgroup if there are only win98 or win95 machines in the workgroup. The request sent to 192.168.1.255 receives no response. If there is a win2000 machine in the workgroup (and thus it is the master browser), a proper response is received to the request sent to 192.168.1.255. Here's a trace with only a win98 machine in the workgroup, showing the lack of response. I would greatly appreciate hearing how to browse for servers in a workgroup with only win98 or win95 machines in the workgroup! In this trace, the workgroup in question is LIPMAN. Although I'm doing this with smbsh, client debugging is enabled and the calls to name_resolve_bcast() are shown... -- smbsh$ smbsh -n -d 9 smbw_path(.) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/. smbw_path(.) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/. smbw_path(./smbsh) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/./smbsh cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/smbsh smbw_path(./smbsh) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/./smbsh cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/smbsh fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful Initial cwd is /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin [2003/02/26 09:31:39, 8] lib/util.c:fcntl_lock(1304) fcntl_lock 8191 14 0 1 1 [2003/02/26 09:31:39, 8] lib/util.c:fcntl_lock(1342) fcntl_lock: Lock call successful [2003/02/26 09:31:39, 8] lib/util.c:fcntl_lock(1304) fcntl_lock 8191 13 0 1 2 [2003/02/26 09:31:39, 8] lib/util.c:fcntl_lock(1342) fcntl_lock: Lock call successful [2003/02/26 09:31:39, 8] lib/util.c:fcntl_lock(1304) fcntl_lock 8191 14 0 1 1 [2003/02/26 09:31:39, 8] lib/util.c:fcntl_lock(1342) fcntl_lock: Lock call successful [2003/02/26 09:31:39, 8] lib/util.c:fcntl_lock(1304) fcntl_lock 8191 13 0 1 2 [2003/02/26 09:31:39, 8] lib/util.c:fcntl_lock(1342) fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful Initial cwd is /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin smbw_path(.) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/. smbw_path(.) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/. smbw_path(.) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/. smbw_path(./smbsh) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/./smbsh cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/smbsh smbw_path(./smbsh) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/./smbsh cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/smbsh smbsh$ ls /smb/LIPMAN smbw_path(.) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/. smbw_path(.) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/. smbw_path(./ls) cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/./ls cleaning /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin/ls fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful Initial cwd is /fiona/home/derrell/samba-2.2.7.sandbox-djl/source/bin smbw_path(/smb/LIPMAN) cleaning /smb/LIPMAN stat(/smb/LIPMAN) cleaning /smb/LIPMAN fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2 fcntl_lock: Lock call successful fcntl_lock 8191 14 0 1 1 fcntl_lock: Lock call successful fcntl_lock 8191 13 0 1 2
smbwrapper use of port 139 vs 445... Ok to force to 139?
My last known problem with smbwrapper on Linux is that sometimes hosts in a workgroup, or shares on a host, are not returned by the cli_Net*Enum() functions. On another list (debian.something), there is currently a discussion of the fact that using port 445 can cause this problem, and in fact, when I force the port to 139, the problem goes away. I'm not terribly familiar with the protocol differences between what's sent on port 139 and what's sent on port 445. *Specifically for the purposes of smbwrapper...* 1. Is there a reason not to force the port number to 139? 2. Is there any service provided on port 445, not provided on port 139, that's required for smbwrapper to return the correct data? 3. Are there any servers that don't provide port 139 service at all? 4. If #3 is yes, what about trying 139 and falling back to 445 rather than the current implementation which is the other way around? Thanks, Derrell
Re: smbwrapper use of port 139 vs 445... Ok to force to 139?
Steve Langasek [EMAIL PROTECTED] writes: For the purposes of getting a browse list, connecting to port 139 is a must. There are ways to get the equivalent of a browse list via AD, but I don't think it's LDAP-only, so port 445 doesn't even do any good in this regard. For the actual enumeration of and connecting to shares, port 445 is likely to give some performance increase due to the lower protocol overhead. You can also configure newer Windows machines (XP at least) to *not* support NetBIOS at all, in which case they'll only be listening on port 445. OTOH, there are also plenty of older machines (NT4 and below) that are 139-only. If an XP or other new machine is configured to not support port 139, and it becomes a master browser then how would one get the browse list? Theoretically, it might be optimal to use port 139 to collect browse lists, and then use 445-else-139 for everything else. Barring that, I think 139-else-445 would be the best option. This may be possible to do. The function where cli_initialize() and cli_connect() are called, is passed a server name and a share name. The share name seems to be IPC$ for every call I've seen into here, but is likely a real share name when opening a regular file. I have occasionally seen a server name of IPC$ as well. I suppose I could trace and determine which case is caused by which type of enumeration. Do you know offhand in which case(s) of server and share names I'm looking for a browse list? What if I do 139-else-445 if share is IPC$, and do 445-else-139 otherwise? Thanks, Derrell
Re: smbwrapper/smbsh
David Collier-Brown -- Customer Engineering [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: It appears I've nearly got it solved (unless another big problem turns up after I fix this one). Aside from my initialization routine not be called early enough, thus providing some null function pointers, Hmmn, In a different discussion group I once wrote: --- The plugin uses a set of NULL pointers and a check in each interceptor to do initialization, as Linux lacks #pragma init(name-of-init-function). This is inefficient (and inelegant). ... .section .init call vgPlain_startup This is used with the gnu linker option -z initfirst, and ensures that the .init section is run first. Thanks. I actually already found a different way to do that. I pass the -init option to the linker via the gcc command line: -Wl,-init=smbw_initialize By default, the linker causes the function _init() to be called when it loads a new shared library, but crt0i.o is being linked in the shared library which contains its own _init() function. I declare my smbw_initialize() function like this to accommodate whatever crt0i's _init() function is doing: extern void _init(void);/* a pre-existing _init() function */ static void initialize(void); /* our own initialization function */ void smbw_initialize(void) { _init(); initialize(); } In another message to be posted shortly, I'll describe some substantial changes I'm making, and ask some advice. Derrell
smbwrapper/smbsh on Linux/glibc
I have found that due to the way the macro definitions are used in the glibc header files, it is not possible to know the size of structures that was used in an independently-compiled application. libsmbclient, similarly, futzes with internal macros to force the glibc definitions into mapping 32-bit functions into 64-bit functions. As an example, I found cases where sizeof(struct stat) was different in the calling application (ps in my test case) than it was in smbwrapper and libsmbclient. At least with the glibc environment, I found the paradigm used for smbwrapper to be insufficient to handle the variety of applications that may be wrapped. I have therefore mostly completed a rewrite of the outer layer of the wrapper functions using a new paradigm. In my new paradigm, we do not attempt to fake the C library by using internal functions or directly calling system calls. Instead, we use dlsym() to find the real function pointers in the C library. If the call is pertaining to a native file descriptor, the functions in the C library are called directly. If the call is for an SMB file descriptor, then the smbw_ functions are called. The wrapper functions are able to fully define the function interface by including the native system header files rather than masking the real functions (e.g. with void* and arrays of doubles in place of stat structures). Additionally, to avoid the problems with varying sizes of structures due to our lack of knowledge of how the child application was compiled, I am creating internal structures for interaction between the wrapper function and the smbw_ functions. The interface between these layers will be with the known internal structure, and I will then do a field-by-field assignment between them. (Yes, this is a bit slower, but it's primarily for the stat() family of functions which are not typically high-frequency calls, and the alternate memcpy method just can't work in this environment.) The other issue I'm facing is with some of the 64-bit calls -- and my lack of knowledge about SMB/CIFS protocols. Are 64-bit offsets into files possible in the SMB/CIFS environment? Are there file systems (e.g. NTFS?) that support files larger than sizes that will fit in 32 bits? The current implementation of pread() for example, passes an off_t which may be 32 bits or may in fact be remapped as an off64_t based on the defines passed to the compiler. So my questions are: 1. Are there LFS requirements for SMB/CIFS or can I just drop the high-order portion of 64-bit file offsets? 2. Does anyone anticipate any particular problems with the implementation I have described? (It's currently working for native file access, with all applications that I've tried -- including those that previously did not work, such as the Debian binary of bash, and ps. My testing has not been exhaustive, though, so if there are particular areas that I should test or watch out for, I'd like to know.) Thanks! Derrell
smbwrapper/smbsh
Steve Langasek [EMAIL PROTECTED] writes: I'll scare up some time to try out your patch, and see if I can figure out what's special about the calls that are failing. It appears I've nearly got it solved (unless another big problem turns up after I fix this one). Aside from my initialization routine not be called early enough, thus providing some null function pointers, the big problem is that sizeof(struct stat) differs in smbwrapper and the calling application. smbwrapper is zeroing the structure. With the passed parameter being shorter than the amount of zeroed memory, the stack is being blown away, so the return() tries to return to address 0x0. Kaboom. I hope to get this worked out this week or early next week, so don't waste your time on it right away. Expect to hear something from me soon. Derrell
Re: smbwrapper/smbsh is now working for Linux 2.4
[EMAIL PROTECTED] writes: On Tue, Dec 10, 2002 at 01:27:07PM -0500, [EMAIL PROTECTED] wrote: I have smbwrapper and smbsh working on Debian/woody with the Linux 2.4 kernel and the default C library: libc-2.2.5.so. Yes, I'm interested - please post patches. Pressure of other things has made this a low priority but I'm really happy to apply patches that work for people ! Ok. The patch is attached. This became a high priority for me when smbmount used with automount turned out to be way too slow. This seems substantially faster in terms of connection establishment. The problems I have encountered with smbsh so far pertain to something that Debian is doing in their build process. smbsh works well with bash if bash is built from source with nothing other than ./configure;make. Using Debian's build process or their bash binary, however, bash crashes after reading the .bash_history file. (Debian modifies the default build process and I haven't spent the time to determine which change they make causes this.) Similarly, the program hostname crashes using the default binary. (I haven't tried rebuilding that one to see if a simple recompile fixes it.) In both cases, they're getting segmentation violations, and I believe there's a function pointer not getting resolved properly with the various wrappers provided by smbwrapper.so. I'm sure there are other apps which will crash as well, but I did a bunch of stuff today in bash in smbsh and it was generally working well. If anyone fixes the above problems, please let me know about it. I'm not normally subscribed to samba-technical. Jeremy, someone who knows automake/configure building may want to look at this patch to determine which portions should be in #ifdefs for autoconfiguring for other than Linux. Cheers, Derrell -- diff -u /var/tmp/samba-2.2.3a/source/smbwrapper/realcalls.c samba-2.2.3a/source/smbwrapper/realcalls.c --- /var/tmp/samba-2.2.3a/source/smbwrapper/realcalls.c Wed Oct 7 06:58:12 1998 +++ samba-2.2.3a/source/smbwrapper/realcalls.c Tue Dec 10 13:02:03 2002 @@ -22,6 +22,81 @@ #include includes.h #include realcalls.h +#include dlfcn.h + +/* + * Pointers to functions in the standard C library + */ +static struct +{ +void * (* readdir64)(void * dir); +void * (* llseek)(int fd, + unsigned long offset_high, + unsigned long offset_low, + loff_t * result, + unsigned int whence); +int (* lstat64)(int ver, +char *name, +void *st64); +int (* fstat64)(int ver, +int fd, +void *st64); +int (* stat64)(int ver, + char *name, + void *st64); +ssize_t (* pwrite)(int fd, + void *buf, + size_t size, + off_t ofs); +ssize_t (* pread)(int fd, + void *buf, + size_t size, + off_t ofs); +void * (* opendir)(const char *name); +int (* closedir)(void *dir); +off_t (* telldir)(void *dir); +int (* seekdir)(void *dir, +off_t offset); +} libc; + +int real_init(void) +{ +static void *lib = NULL; +char *error; + +if ((lib = dlopen(/lib/libc.so.6, RTLD_NOW | RTLD_GLOBAL)) == NULL) +return -1; + +#define GETSYM(symname, symstring) \ +libc.symname = dlsym(lib, symstring); \ +if ((error = dlerror()) != NULL)\ +break; + +/* + * Get pointers to each of the symbols we'll need, from the C library + */ +do { +GETSYM(readdir64, readdir64); +GETSYM(llseek, llseek); +GETSYM(lstat64, __lxstat64); +GETSYM(fstat64, __fxstat64); +GETSYM(stat64, __xstat64); +GETSYM(pwrite, pwrite); +GETSYM(pread, pread); +GETSYM(opendir, opendir); +GETSYM(closedir, closedir); +GETSYM(telldir, telldir); +GETSYM(seekdir, seekdir); +} while (0); + +dlclose(lib); + +if (error != NULL) +return -1; + +return 0; +} + #ifdef REPLACE_UTIME int real_utime(const char *name, struct