The Samba-Bugzilla – Attachment 13593 Details for
Bug 5926
POSIX extensions cannot be enabled under libsmbclient
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Revised patch, with
better.patch (text/plain), 8.25 KB, created by
Tom Parker
on 2017-09-13 14:19:45 UTC
(
hide
)
Description:
Revised patch, with
Filename:
MIME Type:
Creator:
Tom Parker
Created:
2017-09-13 14:19:45 UTC
Size:
8.25 KB
patch
obsolete
>diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h >index 0e0045e..aa84f6d 100644 >--- a/source3/include/libsmb_internal.h >+++ b/source3/include/libsmb_internal.h >@@ -158,6 +158,14 @@ struct SMBC_internal_data { > bool full_time_names; > > /* >+ * Enable POSIX extensions before opening files/directories >+ * Will silently ignore if the server does not support the POSIX >+ * extensions >+ */ >+ >+ bool posix_extensions; >+ >+ /* > * The share mode of a file being opened. To match POSIX semantics > * (and maintain backward compatibility), DENY_NONE is the default. > */ >diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h >index cf67b1d..5486dea 100644 >--- a/source3/include/libsmbclient.h >+++ b/source3/include/libsmbclient.h >@@ -765,7 +765,13 @@ smbc_getOptionUseNTHash(SMBCCTX *c); > void > smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b); > >+/** Get whether to enable POSIX extensions if available */ >+smbc_bool >+smbc_getOptionPosixExtensions(SMBCCTX *c); > >+/** Set whether to enable POSIX extensions if available */ >+void >+smbc_setOptionPosixExtensions(SMBCCTX *c, smbc_bool b); > > /************************************* > * Getters and setters for FUNCTIONS * >diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c >index 5cc220a..d64768a 100644 >--- a/source3/libsmb/clidfs.c >+++ b/source3/libsmb/clidfs.c >@@ -360,6 +360,7 @@ static NTSTATUS cli_cm_connect(TALLOC_CTX *ctx, > status = cli_unix_extensions_version(cli, &major, &minor, > &caplow, &caphigh); > if (NT_STATUS_IS_OK(status)) { >+ d_printf("Setting posix capabilities\n"); > cli_set_unix_extensions_capabilities(cli, > major, minor, > caplow, caphigh); >diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c >index ed6ca2b..65eea82 100644 >--- a/source3/libsmb/libsmb_context.c >+++ b/source3/libsmb/libsmb_context.c >@@ -177,6 +177,7 @@ smbc_new_context(void) > smbc_setOptionBrowseMaxLmbCount(context, 3); /* # LMBs to query */ > smbc_setOptionUrlEncodeReaddirEntries(context, False); > smbc_setOptionOneSharePerServer(context, False); >+ smbc_setOptionPosixExtensions(context, False); > if (getenv("LIBSMBCLIENT_NO_CCACHE") != NULL) { > smbc_setOptionUseCCache(context, false); > } >diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c >index 72441c4..f85972e 100644 >--- a/source3/libsmb/libsmb_dir.c >+++ b/source3/libsmb/libsmb_dir.c >@@ -815,7 +815,7 @@ SMBC_opendir_ctx(SMBCCTX *context, > > /* Now, list the files ... */ > >- path_len = strlen(path); >+ path_len = strlen(path); > path = talloc_asprintf_append(path, "\\*"); > if (!path) { > if (dir) { >@@ -829,6 +829,7 @@ SMBC_opendir_ctx(SMBCCTX *context, > status = cli_resolve_path( > frame, "", context->internal->auth_info, > srv->cli, path, &targetcli, &targetpath); >+ d_printf("targetpath %s\n", targetpath); > if (!NT_STATUS_IS_OK(status)) { > d_printf("Could not resolve %s\n", path); > if (dir) { >@@ -1233,7 +1234,7 @@ SMBC_mkdir_ctx(SMBCCTX *context, > > } > >- /*d_printf(">>>mkdir: resolving %s\n", path);*/ >+ d_printf(">>>mkdir: resolving %s\n", path); > status = cli_resolve_path(frame, "", context->internal->auth_info, > srv->cli, path, &targetcli, &targetpath); > if (!NT_STATUS_IS_OK(status)) { >diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c >index 6b43676..f65b4c1 100644 >--- a/source3/libsmb/libsmb_file.c >+++ b/source3/libsmb/libsmb_file.c >@@ -491,7 +491,7 @@ SMBC_getatr(SMBCCTX * context, > trim_string(fixedpath, NULL, "\\.."); > trim_string(fixedpath, NULL, "\\."); > } >- DEBUG(4,("SMBC_getatr: sending qpathinfo\n")); >+ DEBUG(4,("SMBC_getatr: sending qpathinfo for %s (%s)\n", fixedpath, path)); > > status = cli_resolve_path(frame, "", context->internal->auth_info, > srv->cli, fixedpath, >diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c >index b0e5926..480ebff 100644 >--- a/source3/libsmb/libsmb_server.c >+++ b/source3/libsmb/libsmb_server.c >@@ -245,6 +245,103 @@ check_server_cache: > return NULL; > } > >+static smbc_bool >+SMBC_enable_posix(SMBCCTX *smbctx, TALLOC_CTX *ctx, struct cli_state *cli) >+{ >+ uint16_t major, minor; >+ uint32_t caplow, caphigh; >+ NTSTATUS status; >+ >+ if (!SERVER_HAS_UNIX_CIFS(cli)) { >+ d_printf("Server doesn't support UNIX CIFS extensions\n"); >+ return 1; >+ } >+ >+ status = cli_unix_extensions_version(cli, &major, &minor, &caplow, &caphigh); >+ if (!NT_STATUS_IS_OK(status)) { >+ d_printf("Can't get UNIX CIFS extensions version from server. Status: %X\n", status); >+ return 1; >+ } >+ >+ if(DEBUGLVL(2)) { >+ char *caps; >+ d_printf("Server supports CIFS extensions %u.%u\n", (unsigned int)major, (unsigned int)minor); >+ >+ caps = talloc_strdup(ctx, ""); >+ if (!caps) { >+ return 1; >+ } >+ if (caplow & CIFS_UNIX_FCNTL_LOCKS_CAP) { >+ caps = talloc_asprintf_append(caps, "locks "); >+ if (!caps) { >+ return 1; >+ } >+ } >+ if (caplow & CIFS_UNIX_POSIX_ACLS_CAP) { >+ caps = talloc_asprintf_append(caps, "acls "); >+ if (!caps) { >+ return 1; >+ } >+ } >+ if (caplow & CIFS_UNIX_XATTTR_CAP) { >+ caps = talloc_asprintf_append(caps, "eas "); >+ if (!caps) { >+ return 1; >+ } >+ } >+ if (caplow & CIFS_UNIX_POSIX_PATHNAMES_CAP) { >+ caps = talloc_asprintf_append(caps, "pathnames "); >+ if (!caps) { >+ return 1; >+ } >+ } >+ if (caplow & CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP) { >+ caps = talloc_asprintf_append(caps, "posix_path_operations "); >+ if (!caps) { >+ return 1; >+ } >+ } >+ if (caplow & CIFS_UNIX_LARGE_READ_CAP) { >+ caps = talloc_asprintf_append(caps, "large_read "); >+ if (!caps) { >+ return 1; >+ } >+ } >+ if (caplow & CIFS_UNIX_LARGE_WRITE_CAP) { >+ caps = talloc_asprintf_append(caps, "large_write "); >+ if (!caps) { >+ return 1; >+ } >+ } >+ if (caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP) { >+ caps = talloc_asprintf_append(caps, "posix_encrypt "); >+ if (!caps) { >+ return 1; >+ } >+ } >+ if (caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP) { >+ caps = talloc_asprintf_append(caps, "mandatory_posix_encrypt "); >+ if (!caps) { >+ return 1; >+ } >+ } >+ >+ if (*caps && caps[strlen(caps)-1] == ' ') { >+ caps[strlen(caps)-1] = '\0'; >+ } >+ >+ d_printf("Server supports CIFS capabilities %s\n", caps); >+ } >+ >+ status = cli_set_unix_extensions_capabilities(cli, major, minor, caplow, caphigh); >+ if (!NT_STATUS_IS_OK(status)) { >+ d_printf("Can't set UNIX CIFS extensions capabilities. %s.\n", cli_errstr(cli)); >+ return 1; >+ } >+ >+ return 0; >+} >+ > /* > * Connect to a server, possibly on an existing connection > * >@@ -717,6 +814,9 @@ SMBC_server(TALLOC_CTX *ctx, > DEBUG(2, ("Server connect ok: //%s/%s: %p\n", > server, share, srv)); > >+ if (context->internal->posix_extensions) >+ SMBC_enable_posix(context, ctx, srv->cli); >+ > DLIST_ADD(context->internal->servers, srv); > return srv; > } >diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c >index 80ac673..cfe549d 100644 >--- a/source3/libsmb/libsmb_setget.c >+++ b/source3/libsmb/libsmb_setget.c >@@ -503,6 +503,20 @@ smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b) > } > } > >+/** Get whether to enable POSIX extensions if available */ >+smbc_bool >+smbc_getOptionPosixExtensions(SMBCCTX *c) >+{ >+ return c->internal->posix_extensions; >+} >+ >+/** Set whether to enable POSIX extensions if available */ >+void >+smbc_setOptionPosixExtensions(SMBCCTX *c, smbc_bool b) >+{ >+ c->internal->posix_extensions = b; >+} >+ > /** Get the function for obtaining authentication data */ > smbc_get_auth_data_fn > smbc_getFunctionAuthData(SMBCCTX *c) >diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c >index 4191ad6..fe2ad86 100644 >--- a/source3/libsmb/libsmb_stat.c >+++ b/source3/libsmb/libsmb_stat.c >@@ -151,8 +151,13 @@ SMBC_stat_ctx(SMBCCTX *context, > NULL)) { > errno = EINVAL; > TALLOC_FREE(frame); >- return -1; >- } >+ d_printf("path parse failure for '%s'!\n", fname); >+ return -1; >+ } >+ >+ DEBUG(4, ("parsed path: fname='%s' server='%s' share='%s' " >+ "path='%s'\n", >+ fname, server, share, path)); > > if (!user || user[0] == (char)0) { > user = talloc_strdup(frame, smbc_getUser(context));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 5926
:
3768
|
3773
|
13563
|
13582
|
13592
| 13593