diff options
author | Gerald Carter <jerry@samba.org> | 2005-03-10 23:41:19 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:55:58 -0500 |
commit | 9d65e0778425b1e49e789178999ce98e59395569 (patch) | |
tree | 730fb1edede29d3bd73a0eff3fd1250c7d120116 /source3/include | |
parent | a9a218f5e64aac1f7fb0608520010ed75d437a4c (diff) | |
download | samba-9d65e0778425b1e49e789178999ce98e59395569.tar.gz samba-9d65e0778425b1e49e789178999ce98e59395569.tar.bz2 samba-9d65e0778425b1e49e789178999ce98e59395569.zip |
r5735: rest of derrel's patch for BUG 2308; had to move the options structure from the _SMBCCTX to the internals structure to maintain binary compatibility (derrel, we should talk more about this)
(This used to be commit a5ea01bf15758bb2be26ba16784dc0975be783bf)
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/libsmb_internal.h | 76 | ||||
-rw-r--r-- | source3/include/libsmbclient.h | 88 |
2 files changed, 160 insertions, 4 deletions
diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index 9111f36eaf..803f9e1f10 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -13,6 +13,7 @@ struct _SMBCSRV { struct cli_state cli; dev_t dev; BOOL no_pathinfo2; + BOOL no_nt_session; int server_fd; SMBCSRV *next, *prev; @@ -50,9 +51,18 @@ struct smbc_internal_data { */ int _initialized; - /** INTERNAL: dirent pointer location - */ - char _dirent[512]; + /** INTERNAL: dirent pointer location + * + * 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). + * + * According to <linux/limits.h>, NAME_MAX is 255. Is it longer + * anyplace else? + */ + char _dirent[1024]; /** INTERNAL: server connection list */ @@ -61,6 +71,66 @@ struct smbc_internal_data { /** INTERNAL: open file/dir list */ SMBCFILE * _files; + /** user options selections that apply to this session + */ + struct _smbc_options { + + /* + * 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 local master browser, for + * it to have the entire browse list (the list of + * workgroups/domains) from an entire network. Since a client + * never knows which local master browser will be found first, + * the one which is found first and used to retrieve a browse + * list may have an incomplete or empty browse list. By + * requesting the browse list from multiple local master + * browsers, a more complete list can be generated. For small + * networks (few workgroups), it is recommended that this + * value be set to 0, causing the browse lists from all found + * local master browsers to be retrieved and merged. For + * networks with many workgroups, a suitable value for this + * variable is probably somewhere around 3. (Default: 3). + */ + int browse_max_lmb_count; + + /* + * There is a difference in the desired return strings from + * smbc_readdir() depending upon whether the filenames are to + * be displayed to the user, or whether they are to be + * appended to the path name passed to smbc_opendir() to call + * a further smbc_ function (e.g. open the file with + * smbc_open()). In the former case, the filename should be + * in "human readable" form. In the latter case, the smbc_ + * functions expect a URL which must be url-encoded. Those + * functions decode the URL. If, for example, smbc_readdir() + * returned a file name of "abc%20def.txt", passing a path + * with this file name attached to smbc_open() would cause + * smbc_open to attempt to open the file "abc def.txt" since + * the %20 is decoded into a space. + * + * Set this option to True if the names returned by + * smbc_readdir() should be url-encoded such that they can be + * passed back to another smbc_ call. Set it to False if the + * names returned by smbc_readdir() are to be presented to the + * user. + * + * For backwards compatibility, this option defaults to False. + */ + int urlencode_readdir_entries; + + /* + * Some Windows versions appear to have a limit to the number + * of concurrent SESSIONs and/or TREE CONNECTions. In + * one-shot programs (i.e. the program runs and then quickly + * ends, thereby shutting down all connections), it is + * probably reasonable to establish a new connection for each + * share. In long-running applications, the limitation can be + * avoided by using only a single connection to each server, + * and issuing a new TREE CONNECT when the share is accessed. + */ + int one_share_per_server; + } options; }; diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index efb04285a7..abcf660c9d 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -68,6 +68,8 @@ #include <fcntl.h> #include <utime.h> +#define SMBC_CTX_VERSION 1 + #define SMBC_BASE_FD 10000 /* smallest file descriptor returned */ #define SMBC_WORKGROUP 1 @@ -125,6 +127,19 @@ struct smbc_dirent #define SMBC_XATTR_FLAG_REPLACE 0x2 /* fail if attr does not exist */ +/* + * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the + * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or + * "system.*") is specified. + */ +#define SMBC_DOS_MODE_READONLY 0x01 +#define SMBC_DOS_MODE_HIDDEN 0x02 +#define SMBC_DOS_MODE_SYSTEM 0x04 +#define SMBC_DOS_MODE_VOLUME_ID 0x08 +#define SMBC_DOS_MODE_DIRECTORY 0x10 +#define SMBC_DOS_MODE_ARCHIVE 0x20 + + #ifndef ENOATTR # define ENOATTR ENOENT /* No such attribute */ #endif @@ -457,13 +472,13 @@ struct _SMBCCTX { struct smbc_internal_data * internal; int flags; - }; /* Flags for SMBCCTX->flags */ #define SMB_CTX_FLAG_USE_KERBEROS (1 << 0) #define SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS (1 << 1) #define SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON (1 << 2) /* don't try to do automatic anon login */ +#define SMBCCTX_FLAG_CTXVER (1 << 3 ) /* internal flag used to define _SMBCCTX version */ /**@ingroup misc * Create a new SBMCCTX (a context). @@ -2185,4 +2200,75 @@ int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv); } #endif +/**@ingroup directory + * Convert strings of %xx to their single character equivalent. + * + * @param dest A pointer to a buffer in which the resulting decoded + * string should be placed. This may be a pointer to the + * same buffer as src_segment. + * + * @param src A pointer to the buffer containing the URL to be decoded. + * Any %xx sequences herein are converted to their single + * character equivalent. Each 'x' must be a valid hexadecimal + * digit, or that % sequence is left undecoded. + * + * @param max_dest_len + * The size of the buffer pointed to by dest_segment. + * + * @return The number of % sequences which could not be converted + * due to lack of two following hexadecimal digits. + */ +#ifdef __cplusplus +extern "C" { +#endif +int +smbc_urldecode(char *dest, char * src, size_t max_dest_len); +#ifdef __cplusplus +} +#endif + + +/* + * Convert any characters not specifically allowed in a URL into their %xx + * equivalent. + * + * @param dest A pointer to a buffer in which the resulting encoded + * string should be placed. Unlike smbc_urldecode(), this + * must be a buffer unique from src. + * + * @param src A pointer to the buffer containing the string to be encoded. + * Any character not specifically allowed in a URL is converted + * into its hexadecimal value and encoded as %xx. + * + * @param max_dest_len + * The size of the buffer pointed to by dest_segment. + * + * @returns The remaining buffer length. + */ +#ifdef __cplusplus +extern "C" { +#endif +int +smbc_urlencode(char * dest, char * src, int max_dest_len); +#ifdef __cplusplus +} +#endif + + +/**@ingroup directory + * Return the version of the linked Samba code, and thus the version of the + * libsmbclient code. + * + * @return The version string. + */ +#ifdef __cplusplus +extern "C" { +#endif +const char * +smbc_version(void); +#ifdef __cplusplus +} +#endif + + #endif /* SMBCLIENT_H_INCLUDED */ |