diff options
Diffstat (limited to 'source/include')
-rw-r--r-- | source/include/doserr.h | 2 | ||||
-rw-r--r-- | source/include/includes.h | 13 | ||||
-rw-r--r-- | source/include/libsmb_internal.h | 2 | ||||
-rw-r--r-- | source/include/libsmbclient.h | 295 | ||||
-rw-r--r-- | source/include/msdfs.h | 7 | ||||
-rw-r--r-- | source/include/nt_status.h | 1 | ||||
-rw-r--r-- | source/include/ntdomain.h | 3 | ||||
-rw-r--r-- | source/include/nterr.h | 3 | ||||
-rw-r--r-- | source/include/passdb.h | 89 | ||||
-rw-r--r-- | source/include/rpc_buffer.h | 35 | ||||
-rw-r--r-- | source/include/rpc_client.h | 21 | ||||
-rw-r--r-- | source/include/rpc_eventlog.h | 193 | ||||
-rw-r--r-- | source/include/rpc_lsa.h | 56 | ||||
-rw-r--r-- | source/include/rpc_misc.h | 337 | ||||
-rw-r--r-- | source/include/rpc_netlogon.h | 14 | ||||
-rw-r--r-- | source/include/rpc_reg.h | 589 | ||||
-rw-r--r-- | source/include/rpc_secdes.h | 47 | ||||
-rw-r--r-- | source/include/rpc_shutdown.h | 65 | ||||
-rwxr-xr-x | source/include/rpc_spoolss.h | 221 | ||||
-rw-r--r-- | source/include/rpc_srvsvc.h | 22 | ||||
-rw-r--r-- | source/include/rpc_svcctl.h | 246 | ||||
-rw-r--r-- | source/include/smb.h | 64 | ||||
-rw-r--r-- | source/include/smb_macros.h | 50 | ||||
-rw-r--r-- | source/include/smbldap.h | 1 | ||||
-rw-r--r-- | source/include/trans2.h | 12 |
25 files changed, 1317 insertions, 1071 deletions
diff --git a/source/include/doserr.h b/source/include/doserr.h index c6d6b1fac90..60a3c335ec4 100644 --- a/source/include/doserr.h +++ b/source/include/doserr.h @@ -185,6 +185,8 @@ #define WERR_INVALID_OWNER W_ERROR(1307) #define WERR_IO_PENDING W_ERROR(997) #define WERR_CAN_NOT_COMPLETE W_ERROR(1003) +#define WERR_NO_SUCH_SERVICE W_ERROR(1060) +#define WERR_INVALID_SERVICE_CONTROL W_ERROR(1052) #define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338) #define WERR_SERVER_UNAVAILABLE W_ERROR(1722) #define WERR_INVALID_FORM_NAME W_ERROR(1902) diff --git a/source/include/includes.h b/source/include/includes.h index 982eee18862..a6db058708d 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -476,6 +476,14 @@ #include <sys/xattr.h> #endif +#ifdef HAVE_SYS_EXTATTR_H +#include <sys/extattr.h> +#endif + +#ifdef HAVE_SYS_UIO_H +#include <sys/uio.h> +#endif + #if HAVE_LOCALE_H #include <locale.h> #endif @@ -856,7 +864,9 @@ extern int errno; #include "client.h" +#ifdef WITH_SMBWRAPPER #include "smbw.h" +#endif #include "session.h" @@ -1372,4 +1382,7 @@ LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to); #undef HAVE_MMAP #endif +#define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr))) +#define CONST_ADD(type, ptr) ((type) ((const void *) (ptr))) + #endif /* _INCLUDES_H */ diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index a1db5c27926..2eca879cbe2 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -35,7 +35,7 @@ struct smbc_dir_list { struct _SMBCFILE { int cli_fd; char *fname; - off_t offset; + SMB_OFF_T offset; struct _SMBCSRV *srv; BOOL file; struct smbc_dir_list *dir_list, *dir_end, *dir_next; diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h index 636083b41d4..ea013c113a0 100644 --- a/source/include/libsmbclient.h +++ b/source/include/libsmbclient.h @@ -26,6 +26,10 @@ #ifndef SMBCLIENT_H_INCLUDED #define SMBCLIENT_H_INCLUDED +#ifdef __cplusplus +extern "C" { +#endif + /*-------------------------------------------------------------------*/ /* The following are special comments to instruct DOXYGEN (automated * documentation tool: @@ -550,13 +554,7 @@ struct _SMBCCTX { * * @note Do not forget to smbc_init_context() the returned SMBCCTX pointer ! */ -#ifdef __cplusplus -extern "C" { -#endif SMBCCTX * smbc_new_context(void); -#ifdef __cplusplus -} -#endif /**@ingroup misc * Delete a SBMCCTX (a context) acquired from smbc_new_context(). @@ -579,13 +577,8 @@ SMBCCTX * smbc_new_context(void); * just before exit()'ing. When shutdown_ctx is 0, this function can be * use in periodical cleanup functions for example. */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_free_context(SMBCCTX * context, int shutdown_ctx); -#ifdef __cplusplus -} -#endif + /**@ingroup misc * Initialize a SBMCCTX (a context). @@ -605,13 +598,8 @@ int smbc_free_context(SMBCCTX * context, int shutdown_ctx); * but it might leak memory on smbc_context_init() failure. Avoid this. * You'll have to call smbc_free_context() yourself on failure. */ -#ifdef __cplusplus -extern "C" { -#endif + SMBCCTX * smbc_init_context(SMBCCTX * context); -#ifdef __cplusplus -} -#endif /**@ingroup misc * Initialize the samba client library. @@ -631,13 +619,7 @@ SMBCCTX * smbc_init_context(SMBCCTX * context); * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_init(smbc_get_auth_data_fn fn, int debug); -#ifdef __cplusplus -} -#endif /**@ingroup misc * Set or retrieve the compatibility library's context pointer @@ -661,13 +643,7 @@ int smbc_init(smbc_get_auth_data_fn fn, int debug); * authentication functions have been freed, if necessary. */ -#ifdef __cplusplus -extern "C" { -#endif SMBCCTX * smbc_set_context(SMBCCTX * new_context); -#ifdef __cplusplus -} -#endif /**@ingroup file * Open a file on an SMB server. @@ -720,13 +696,8 @@ SMBCCTX * smbc_set_context(SMBCCTX * new_context); * try again with an empty username and password. This * often gets mapped to the guest account on some machines. */ -#ifdef __cplusplus -extern "C" { -#endif + int smbc_open(const char *furl, int flags, mode_t mode); -#ifdef __cplusplus -} -#endif /**@ingroup file * Create a file on an SMB server. @@ -759,13 +730,8 @@ int smbc_open(const char *furl, int flags, mode_t mode); * @see smbc_open() * */ -#ifdef __cplusplus -extern "C" { -#endif + int smbc_creat(const char *furl, mode_t mode); -#ifdef __cplusplus -} -#endif /**@ingroup file * Read from a file using an opened file handle. @@ -787,13 +753,8 @@ int smbc_creat(const char *furl, mode_t mode); * @see smbc_open(), smbc_write() * */ -#ifdef __cplusplus -extern "C" { -#endif ssize_t smbc_read(int fd, void *buf, size_t bufsize); -#ifdef __cplusplus -} -#endif + /**@ingroup file * Write to a file using an opened file handle. @@ -815,13 +776,8 @@ ssize_t smbc_read(int fd, void *buf, size_t bufsize); * @see smbc_open(), smbc_read() * */ -#ifdef __cplusplus -extern "C" { -#endif ssize_t smbc_write(int fd, void *buf, size_t bufsize); -#ifdef __cplusplus -} -#endif + /**@ingroup file * Seek to a specific location in a file. @@ -851,13 +807,8 @@ ssize_t smbc_write(int fd, void *buf, size_t bufsize); * * @todo Are errno values complete and correct? */ -#ifdef __cplusplus -extern "C" { -#endif off_t smbc_lseek(int fd, off_t offset, int whence); -#ifdef __cplusplus -} -#endif + /**@ingroup file * Close an open file handle. @@ -870,13 +821,8 @@ off_t smbc_lseek(int fd, off_t offset, int whence); * * @see smbc_open(), smbc_creat() */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_close(int fd); -#ifdef __cplusplus -} -#endif + /**@ingroup directory * Unlink (delete) a file or directory. @@ -899,13 +845,8 @@ int smbc_close(int fd); * * @todo Are errno values complete and correct? */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_unlink(const char *furl); -#ifdef __cplusplus -} -#endif + /**@ingroup directory * Rename or move a file or directory. @@ -947,13 +888,8 @@ int smbc_unlink(const char *furl); * share? I say no... NOTE. I agree for the moment. * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_rename(const char *ourl, const char *nurl); -#ifdef __cplusplus -} -#endif + /**@ingroup directory * Open a directory used to obtain directory entries. @@ -975,13 +911,8 @@ int smbc_rename(const char *ourl, const char *nurl); * @see smbc_getdents(), smbc_readdir(), smbc_closedir() * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_opendir(const char *durl); -#ifdef __cplusplus -} -#endif + /**@ingroup directory * Close a directory handle opened by smbc_opendir(). @@ -993,13 +924,8 @@ int smbc_opendir(const char *durl); * * @see smbc_opendir() */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_closedir(int dh); -#ifdef __cplusplus -} -#endif + /**@ingroup directory * Get multiple directory entries. @@ -1027,13 +953,8 @@ int smbc_closedir(int dh); * * @todo Add example code so people know how to parse buffers. */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count); -#ifdef __cplusplus -} -#endif + /**@ingroup directory * Get a single directory entry. @@ -1047,13 +968,8 @@ int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count); * * @see smbc_dirent, smbc_getdents(), smbc_open() */ -#ifdef __cplusplus -extern "C" { -#endif struct smbc_dirent* smbc_readdir(unsigned int dh); -#ifdef __cplusplus -} -#endif + /**@ingroup directory * Get the current directory offset. @@ -1075,13 +991,8 @@ struct smbc_dirent* smbc_readdir(unsigned int dh); * @see smbc_readdir() * */ -#ifdef __cplusplus -extern "C" { -#endif off_t smbc_telldir(int dh); -#ifdef __cplusplus -} -#endif + /**@ingroup directory * lseek on directories. @@ -1105,13 +1016,7 @@ off_t smbc_telldir(int dh); * * @todo In what does the reture and errno values mean? */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_lseekdir(int fd, off_t offset); -#ifdef __cplusplus -} -#endif /**@ingroup directory * Create a directory. @@ -1134,13 +1039,8 @@ int smbc_lseekdir(int fd, off_t offset); * @see smbc_rmdir() * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_mkdir(const char *durl, mode_t mode); -#ifdef __cplusplus -} -#endif + /**@ingroup directory * Remove a directory. @@ -1160,13 +1060,8 @@ int smbc_mkdir(const char *durl, mode_t mode); * * @todo Are errno values complete and correct? */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_rmdir(const char *durl); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Get information about a file or directory. @@ -1187,13 +1082,8 @@ int smbc_rmdir(const char *durl); * @see Unix stat() * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_stat(const char *url, struct stat *st); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Get file information via an file descriptor. @@ -1213,13 +1103,8 @@ int smbc_stat(const char *url, struct stat *st); * @see smbc_stat(), Unix stat() * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_fstat(int fd, struct stat *st); -#ifdef __cplusplus -} -#endif + /**@ingroup attribue * Change the ownership of a file or directory. @@ -1244,13 +1129,8 @@ int smbc_fstat(int fd, struct stat *st); * @todo How do we abstract owner and group uid and gid? * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_chown(const char *url, uid_t owner, gid_t group); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Change the permissions of a file. @@ -1272,13 +1152,7 @@ int smbc_chown(const char *url, uid_t owner, gid_t group); * * @todo Are errno values complete and correct? */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_chmod(const char *url, mode_t mode); -#ifdef __cplusplus -} -#endif /**@ingroup attribute * Change the last modification time on a file @@ -1295,13 +1169,7 @@ int smbc_chmod(const char *url, mode_t mode); * - EPERM Permission was denied. * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_utimes(const char *url, struct timeval *tbuf); -#ifdef __cplusplus -} -#endif #ifdef HAVE_UTIME_H /**@ingroup attribute @@ -1320,13 +1188,7 @@ int smbc_utimes(const char *url, struct timeval *tbuf); * - EPERM Permission was denied. * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_utime(const char *fname, struct utimbuf *utbuf); -#ifdef __cplusplus -} -#endif #endif /**@ingroup attribute @@ -1428,17 +1290,12 @@ int smbc_utime(const char *fname, struct utimbuf *utbuf); * sYsTeM.nt_sEc_desc.owNER * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_setxattr(const char *url, const char *name, const void *value, size_t size, int flags); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Set extended attributes for a file. This is used for modifying a file's @@ -1543,17 +1400,12 @@ int smbc_setxattr(const char *url, * sYsTeM.nt_sEc_desc.owNER * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_lsetxattr(const char *url, const char *name, const void *value, size_t size, int flags); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Set extended attributes for a file. This is used for modifying a file's @@ -1655,17 +1507,12 @@ int smbc_lsetxattr(const char *url, * sYsTeM.nt_sEc_desc.owNER * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_fsetxattr(int fd, const char *name, const void *value, size_t size, int flags); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Get extended attributes for a file. @@ -1723,16 +1570,11 @@ int smbc_fsetxattr(int fd, * extended attributes * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_getxattr(const char *url, const char *name, const void *value, size_t size); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Get extended attributes for a file. The POSIX function which this maps to @@ -1793,16 +1635,11 @@ int smbc_getxattr(const char *url, * extended attributes * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_lgetxattr(const char *url, const char *name, const void *value, size_t size); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Get extended attributes for a file. @@ -1861,16 +1698,11 @@ int smbc_lgetxattr(const char *url, * extended attributes * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_fgetxattr(int fd, const char *name, const void *value, size_t size); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Remove extended attributes for a file. This is used for modifying a file's @@ -1915,14 +1747,9 @@ int smbc_fgetxattr(int fd, * extended attributes * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_removexattr(const char *url, const char *name); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Remove extended attributes for a file. This is used for modifying a file's @@ -1970,14 +1797,9 @@ int smbc_removexattr(const char *url, * extended attributes * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_lremovexattr(const char *url, const char *name); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * Remove extended attributes for a file. This is used for modifying a file's @@ -2023,14 +1845,9 @@ int smbc_lremovexattr(const char *url, * extended attributes * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_fremovexattr(int fd, const char *name); -#ifdef __cplusplus -} -#endif + /**@ingroup attribute * List the supported extended attribute names associated with a file @@ -2062,15 +1879,9 @@ int smbc_fremovexattr(int fd, * extended attributes at all. Whether this is a feature or * a bug is yet to be decided. */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_listxattr(const char *url, char *list, size_t size); -#ifdef __cplusplus -} -#endif /**@ingroup attribute * List the supported extended attribute names associated with a file The @@ -2106,15 +1917,9 @@ int smbc_listxattr(const char *url, * extended attributes at all. Whether this is a feature or * a bug is yet to be decided. */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_llistxattr(const char *url, char *list, size_t size); -#ifdef __cplusplus -} -#endif /**@ingroup attribute * List the supported extended attribute names associated with a file @@ -2147,15 +1952,9 @@ int smbc_llistxattr(const char *url, * extended attributes at all. Whether this is a feature or * a bug is yet to be decided. */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_flistxattr(int fd, char *list, size_t size); -#ifdef __cplusplus -} -#endif /**@ingroup print * Print a file given the name in fname. It would be a URL ... @@ -2172,13 +1971,7 @@ int smbc_flistxattr(int fd, * and errors returned by smbc_open * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_print_file(const char *fname, const char *printq); -#ifdef __cplusplus -} -#endif /**@ingroup print * Open a print file that can be written to by other calls. This simply @@ -2193,13 +1986,7 @@ int smbc_print_file(const char *fname, const char *printq); * - all errors returned by smbc_open * */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_open_print_job(const char *fname); -#ifdef __cplusplus -} -#endif /**@ingroup print * List the print jobs on a print share, for the moment, pass a callback @@ -2212,13 +1999,7 @@ int smbc_open_print_job(const char *fname); * - EINVAL fname was NULL or smbc_init not called * - EACCES ??? */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_list_print_jobs(const char *purl, smbc_list_print_job_fn fn); -#ifdef __cplusplus -} -#endif /**@ingroup print * Delete a print job @@ -2232,13 +2013,7 @@ int smbc_list_print_jobs(const char *purl, smbc_list_print_job_fn fn); * * @todo what errno values are possible here? */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_unlink_print_job(const char *purl, int id); -#ifdef __cplusplus -} -#endif /**@ingroup callback * Remove a server from the cached server list it's unused. @@ -2250,10 +2025,8 @@ int smbc_unlink_print_job(const char *purl, int id); * @return On success, 0 is returned. 1 is returned if the server could not * be removed. Also useable outside libsmbclient. */ -#ifdef __cplusplus -extern "C" { -#endif int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv); + #ifdef __cplusplus } #endif diff --git a/source/include/msdfs.h b/source/include/msdfs.h index afbbe738fe1..8d6b23bcbfb 100644 --- a/source/include/msdfs.h +++ b/source/include/msdfs.h @@ -68,18 +68,17 @@ struct dfs_path #define RESOLVE_DFSPATH(name, conn, inbuf, outbuf) \ { if ((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) && \ lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) && \ - dfs_redirect(name,conn,False)) \ + dfs_redirect(name, conn, False)) \ return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, \ ERRSRV, ERRbadpath);; } -#define RESOLVE_FINDFIRST_DFSPATH(name, conn, inbuf, outbuf) \ +#define RESOLVE_DFSPATH_WCARD(name, conn, inbuf, outbuf) \ { if ((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) && \ lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) && \ - dfs_redirect(name,conn,True)) \ + dfs_redirect(name,conn, True)) \ return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, \ ERRSRV, ERRbadpath);; } - #define init_dfsroot(conn, inbuf, outbuf) \ { if (lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) { \ DEBUG(2,("Serving %s as a Dfs root\n", \ diff --git a/source/include/nt_status.h b/source/include/nt_status.h index 9747f73eb18..ab768258df1 100644 --- a/source/include/nt_status.h +++ b/source/include/nt_status.h @@ -56,6 +56,7 @@ typedef uint32 WERROR; #define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0) #define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000) +#define NT_STATUS_IS_INVALID(x) (NT_STATUS_V(x) == 0xFFFFFFFF) #define NT_STATUS_EQUAL(x,y) (NT_STATUS_V(x) == NT_STATUS_V(y)) #define W_ERROR_IS_OK(x) (W_ERROR_V(x) == 0) #define W_ERROR_EQUAL(x,y) (W_ERROR_V(x) == W_ERROR_V(y)) diff --git a/source/include/ntdomain.h b/source/include/ntdomain.h index 45d64cf6331..87fac492db3 100644 --- a/source/include/ntdomain.h +++ b/source/include/ntdomain.h @@ -391,13 +391,16 @@ typedef struct { #include "authdata.h" /* different dce/rpc pipes */ +#include "rpc_buffer.h" #include "rpc_lsa.h" #include "rpc_netlogon.h" #include "rpc_reg.h" #include "rpc_samr.h" #include "rpc_srvsvc.h" #include "rpc_wkssvc.h" +#include "rpc_svcctl.h" #include "rpc_spoolss.h" +#include "rpc_eventlog.h" #include "rpc_dfs.h" #include "rpc_ds.h" #include "rpc_echo.h" diff --git a/source/include/nterr.h b/source/include/nterr.h index 6cf5a756d29..417719625e7 100644 --- a/source/include/nterr.h +++ b/source/include/nterr.h @@ -37,6 +37,9 @@ #define STATUS_NOTIFY_ENUM_DIR NT_STATUS(0x010c) #define ERROR_INVALID_DATATYPE NT_STATUS(0x070c) +/* Special "invalid" NT status code. */ +#define NT_STATUS_INVALID NT_STATUS(0xFFFFFFFF) + /* Win32 Error codes extracted using a loop in smbclient then printing a netmon sniff to a file. */ diff --git a/source/include/passdb.h b/source/include/passdb.h index 5a70bb45a8c..0c816271b02 100644 --- a/source/include/passdb.h +++ b/source/include/passdb.h @@ -232,6 +232,30 @@ struct acct_info uint32 rid; /* domain-relative RID */ }; +struct samr_displayentry { + uint32 rid; + uint16 acct_flags; + const char *account_name; + const char *fullname; + const char *description; +}; + +enum pdb_search_type { + PDB_USER_SEARCH, + PDB_GROUP_SEARCH, + PDB_ALIAS_SEARCH +}; + +struct pdb_search { + TALLOC_CTX *mem_ctx; + enum pdb_search_type type; + struct samr_displayentry *cache; + uint32 num_entries; + ssize_t cache_size; + BOOL search_ended; + void *private; +}; + /***************************************************************** Functions to be implemented by the new (v2) passdb API ****************************************************************/ @@ -310,12 +334,6 @@ typedef struct pdb_context NTSTATUS (*pdb_delete_alias)(struct pdb_context *context, const DOM_SID *sid); - NTSTATUS (*pdb_enum_aliases)(struct pdb_context *context, - const DOM_SID *domain_sid, - uint32 start_idx, uint32 num_entries, - uint32 *num_aliases, - struct acct_info **aliases); - NTSTATUS (*pdb_get_aliasinfo)(struct pdb_context *context, const DOM_SID *sid, struct acct_info *info); @@ -337,10 +355,34 @@ typedef struct pdb_context DOM_SID **members, int *num_members); NTSTATUS (*pdb_enum_alias_memberships)(struct pdb_context *context, + TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, const DOM_SID *members, int num_members, - DOM_SID **aliases, - int *num_aliases); + uint32 **alias_rids, + int *num_alias_rids); + + NTSTATUS (*pdb_lookup_rids)(struct pdb_context *context, + TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + int num_rids, + uint32 *rids, + const char ***names, + uint32 **attrs); + + BOOL (*pdb_search_users)(struct pdb_context *context, + struct pdb_search *search, + uint16 acct_flags); + BOOL (*pdb_search_groups)(struct pdb_context *context, + struct pdb_search *search); + BOOL (*pdb_search_aliases)(struct pdb_context *context, + struct pdb_search *search, + const DOM_SID *sid); + BOOL (*pdb_search_next_entry)(struct pdb_context *context, + struct pdb_search *search, + struct samr_displayentry *entry); + void (*pdb_search_end)(struct pdb_context *context, + struct pdb_search *search); void (*free_fn)(struct pdb_context **); @@ -416,11 +458,6 @@ typedef struct pdb_methods NTSTATUS (*delete_alias)(struct pdb_methods *methods, const DOM_SID *sid); - NTSTATUS (*enum_aliases)(struct pdb_methods *methods, - const DOM_SID *domain_sid, - uint32 start_idx, uint32 max_entries, - uint32 *num_aliases, struct acct_info **info); - NTSTATUS (*get_aliasinfo)(struct pdb_methods *methods, const DOM_SID *sid, struct acct_info *info); @@ -437,9 +474,33 @@ typedef struct pdb_methods const DOM_SID *alias, DOM_SID **members, int *num_members); NTSTATUS (*enum_alias_memberships)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, const DOM_SID *members, int num_members, - DOM_SID **aliases, int *num); + uint32 **alias_rids, + int *num_alias_rids); + NTSTATUS (*lookup_rids)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + int num_rids, + uint32 *rids, + const char ***names, + uint32 **attrs); + + BOOL (*search_users)(struct pdb_methods *methods, + struct pdb_search *search, + uint16 acct_flags); + BOOL (*search_groups)(struct pdb_methods *methods, + struct pdb_search *search); + BOOL (*search_aliases)(struct pdb_methods *methods, + struct pdb_search *search, + const DOM_SID *sid); + BOOL (*search_next_entry)(struct pdb_methods *methods, + struct pdb_search *search, + struct samr_displayentry *entry); + void (*search_end)(struct pdb_methods *methods, + struct pdb_search *search); void *private_data; /* Private data of some kind */ diff --git a/source/include/rpc_buffer.h b/source/include/rpc_buffer.h new file mode 100644 index 00000000000..da2be8a4df6 --- /dev/null +++ b/source/include/rpc_buffer.h @@ -0,0 +1,35 @@ +/* + Unix SMB/Netbios implementation. + + Copyright (C) Andrew Tridgell 1992-2000, + Copyright (C) Luke Kenneth Casson Leighton 1996-2000, + Copyright (C) Jean Francois Micouleau 1998-2000. + Copyright (C) Gerald Carter 2001-2005. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _RPC_BUFFER_H /* _RPC_SPOOLSS_H */ +#define _RPC_BUFFER_H + +typedef struct { + uint32 size; + prs_struct prs; + uint32 struct_start; + uint32 string_at_end; +} RPC_BUFFER; + + +#endif /* _RPC_BUFFER_H */ diff --git a/source/include/rpc_client.h b/source/include/rpc_client.h index bce9ec7f273..4ac2f43ee00 100644 --- a/source/include/rpc_client.h +++ b/source/include/rpc_client.h @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. SMB parameters and setup - Copyright (C) Elrond 2000 + Copyright (C) Gerald (Jerry) Carter 2005. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +21,21 @@ #ifndef _RPC_CLIENT_H #define _RPC_CLIENT_H -#if 0 /* JERRY */ -#include "rpc_client_proto.h" -#endif +/* macro to expand cookie-cutter code in cli_xxx() */ + +#define CLI_DO_RPC( pcli, ctx, pipe_num, opnum, q_in, r_out, q_ps, r_ps, q_io_fn, r_io_fn, default_error) \ +{ r_out.status = default_error;\ + prs_init( &q_ps, MAX_PDU_FRAG_LEN, ctx, MARSHALL ); \ + prs_init( &r_ps, 0, ctx, UNMARSHALL );\ + if ( q_io_fn("", &q_in, &q_ps, 0) ) {\ + if ( rpc_api_pipe_req(pcli, pipe_num, opnum, &q_ps, &r_ps) ) {\ + if (!r_io_fn("", &r_out, &r_ps, 0)) {\ + r_out.status = default_error;\ + }\ + }\ + }\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ +} #endif /* _RPC_CLIENT_H */ diff --git a/source/include/rpc_eventlog.h b/source/include/rpc_eventlog.h new file mode 100644 index 00000000000..b692a762257 --- /dev/null +++ b/source/include/rpc_eventlog.h @@ -0,0 +1,193 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Marcin Krzysztof Porwit 2005. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _RPC_EVENTLOG_H /* _RPC_EVENTLOG_H */ +#define _RPC_EVENTLOG_H + +/* opcodes */ + +#define EVENTLOG_CLEAREVENTLOG 0x00 +#define EVENTLOG_CLOSEEVENTLOG 0x02 +#define EVENTLOG_GETNUMRECORDS 0x04 +#define EVENTLOG_GETOLDESTENTRY 0x05 +#define EVENTLOG_OPENEVENTLOG 0x07 +#define EVENTLOG_READEVENTLOG 0x0a + +/* Eventlog read flags */ + +#define EVENTLOG_SEQUENTIAL_READ 0x0001 +#define EVENTLOG_SEEK_READ 0x0002 +#define EVENTLOG_FORWARDS_READ 0x0004 +#define EVENTLOG_BACKWARDS_READ 0x0008 + +/* Event types */ + +#define EVENTLOG_SUCCESS 0x0000 +#define EVENTLOG_ERROR_TYPE 0x0001 +#define EVENTLOG_WARNING_TYPE 0x0002 +#define EVENTLOG_INFORMATION_TYPE 0x0004 +#define EVENTLOG_AUDIT_SUCCESS 0x0008 +#define EVENTLOG_AUDIT_FAILURE 0x0010 + + +typedef struct eventlog_q_open_eventlog +{ + uint32 unknown1; + uint16 unknown2; + uint16 unknown3; + uint16 sourcename_length; + uint16 sourcename_size; + uint32 sourcename_ptr; + UNISTR2 sourcename; + uint32 servername_ptr; + UNISTR2 servername; +} +EVENTLOG_Q_OPEN_EVENTLOG; + +typedef struct eventlog_r_open_eventlog +{ + POLICY_HND handle; + WERROR status; +} +EVENTLOG_R_OPEN_EVENTLOG; + +typedef struct eventlog_q_close_eventlog +{ + POLICY_HND handle; +} +EVENTLOG_Q_CLOSE_EVENTLOG; + +typedef struct eventlog_r_close_eventlog +{ + POLICY_HND handle; + WERROR status; +} +EVENTLOG_R_CLOSE_EVENTLOG; + +typedef struct eventlog_q_get_num_records +{ + POLICY_HND handle; +} +EVENTLOG_Q_GET_NUM_RECORDS; + +typedef struct eventlog_r_get_num_records +{ + uint32 num_records; + WERROR status; +} +EVENTLOG_R_GET_NUM_RECORDS; + +typedef struct eventlog_q_get_oldest_entry +{ + POLICY_HND handle; +} +EVENTLOG_Q_GET_OLDEST_ENTRY; + +typedef struct eventlog_r_get_oldest_entry +{ + uint32 oldest_entry; + WERROR status; +} +EVENTLOG_R_GET_OLDEST_ENTRY; + +typedef struct eventlog_q_read_eventlog +{ + POLICY_HND handle; + uint32 flags; + uint32 offset; + uint32 max_read_size; +} +EVENTLOG_Q_READ_EVENTLOG; + +typedef struct eventlog_record +{ + uint32 length; + uint32 reserved1; + uint32 record_number; + uint32 time_generated; + uint32 time_written; + uint32 event_id; + uint16 event_type; + uint16 num_strings; + uint16 event_category; + uint16 reserved2; + uint32 closing_record_number; + uint32 string_offset; + uint32 user_sid_length; + uint32 user_sid_offset; + uint32 data_length; + uint32 data_offset; +} Eventlog_record; + +typedef struct eventlog_data_record +{ + uint32 source_name_len; + wpstring source_name; + uint32 computer_name_len; + wpstring computer_name; + uint32 sid_padding; + wpstring sid; + uint32 strings_len; + wpstring strings; + uint32 user_data_len; + pstring user_data; + uint32 data_padding; +} Eventlog_data_record; + +typedef struct eventlog_entry +{ + Eventlog_record record; + Eventlog_data_record data_record; + uint8 *data; + uint8 *end_of_data_padding; + struct eventlog_entry *next; +} Eventlog_entry; + +typedef struct eventlog_r_read_eventlog +{ + uint32 num_bytes_in_resp; + uint32 bytes_in_next_record; + uint32 num_records; + Eventlog_entry *entry; + uint8 *end_of_entries_padding; + uint32 sent_size; + uint32 real_size; + WERROR status; +} +EVENTLOG_R_READ_EVENTLOG; + +typedef struct eventlog_q_clear_eventlog +{ + POLICY_HND handle; + uint32 unknown1; + uint16 backup_file_length; + uint16 backup_file_size; + uint32 backup_file_ptr; + UNISTR2 backup_file; +} +EVENTLOG_Q_CLEAR_EVENTLOG; + +typedef struct eventlog_r_clear_eventlog +{ + WERROR status; +} +EVENTLOG_R_CLEAR_EVENTLOG; + +#endif /* _RPC_EVENTLOG_H */ diff --git a/source/include/rpc_lsa.h b/source/include/rpc_lsa.h index a0d78280c20..8eaf68a234d 100644 --- a/source/include/rpc_lsa.h +++ b/source/include/rpc_lsa.h @@ -1,9 +1,10 @@ /* Unix SMB/CIFS implementation. SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Paul Ashton 1997 + Copyright (C) Gerald (Jerry) Carter 2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,7 +69,7 @@ #define LSA_LOOKUPPRIVNAME 0x20 #define LSA_PRIV_GET_DISPNAME 0x21 #define LSA_DELETEOBJECT 0x22 -#define LSA_ENUMACCTWITHRIGHT 0x23 +#define LSA_ENUMACCTWITHRIGHT 0x23 /* TODO: implement this one -- jerry */ #define LSA_ENUMACCTRIGHTS 0x24 #define LSA_ADDACCTRIGHTS 0x25 #define LSA_REMOVEACCTRIGHTS 0x26 @@ -305,32 +306,33 @@ typedef struct lsa_r_query_info2 NTSTATUS status; } LSA_R_QUERY_INFO2; -/* LSA_Q_ENUM_TRUST_DOM - LSA enumerate trusted domains */ -typedef struct lsa_enum_trust_dom_info -{ - POLICY_HND pol; /* policy handle */ - uint32 enum_context; /* enumeration context handle */ - uint32 preferred_len; /* preferred maximum length */ +/*******************************************************/ +typedef struct { + POLICY_HND pol; + uint32 enum_context; + uint32 preferred_len; /* preferred maximum length */ } LSA_Q_ENUM_TRUST_DOM; -/* LSA_R_ENUM_TRUST_DOM - response to LSA enumerate trusted domains */ -typedef struct lsa_r_enum_trust_dom_info -{ - uint32 enum_context; /* enumeration context handle */ - uint32 num_domains; /* number of domains */ - uint32 ptr_enum_domains; /* buffer pointer to num domains */ - - /* this lot is only added if ptr_enum_domains is non-NULL */ - uint32 num_domains2; /* number of domains */ - UNIHDR2 *hdr_domain_name; - UNISTR2 *uni_domain_name; - DOM_SID2 *domain_sid; +typedef struct { + UNISTR4 name; + DOM_SID2 *sid; +} DOMAIN_INFO; - NTSTATUS status; /* return code */ +typedef struct { + uint32 count; + DOMAIN_INFO *domains; +} DOMAIN_LIST; +typedef struct { + uint32 enum_context; + uint32 count; + DOMAIN_LIST *domlist; + NTSTATUS status; } LSA_R_ENUM_TRUST_DOM; +/*******************************************************/ + /* LSA_Q_CLOSE */ typedef struct lsa_q_close_info { @@ -423,7 +425,7 @@ typedef struct lsa_q_lookup_sids POLICY_HND pol; /* policy handle */ LSA_SID_ENUM sids; LSA_TRANS_NAME_ENUM names; - LOOKUP_LEVEL level; + uint16 level; uint32 mapped_count; } LSA_Q_LOOKUP_SIDS; @@ -532,7 +534,7 @@ typedef struct typedef struct { uint32 count; - UNISTR2_ARRAY rights; + UNISTR4_ARRAY *rights; NTSTATUS status; } LSA_R_ENUM_ACCT_RIGHTS; @@ -542,8 +544,8 @@ typedef struct { POLICY_HND pol; /* policy handle */ DOM_SID2 sid; - UNISTR2_ARRAY rights; uint32 count; + UNISTR4_ARRAY *rights; } LSA_Q_ADD_ACCT_RIGHTS; /* LSA_R_ADD_ACCT_RIGHTS - LSA add account rights */ @@ -559,8 +561,8 @@ typedef struct POLICY_HND pol; /* policy handle */ DOM_SID2 sid; uint32 removeall; - UNISTR2_ARRAY rights; uint32 count; + UNISTR4_ARRAY *rights; } LSA_Q_REMOVE_ACCT_RIGHTS; /* LSA_R_REMOVE_ACCT_RIGHTS - LSA remove account rights */ diff --git a/source/include/rpc_misc.h b/source/include/rpc_misc.h index 6abc85a4cac..dcc0ecc554a 100644 --- a/source/include/rpc_misc.h +++ b/source/include/rpc_misc.h @@ -1,9 +1,10 @@ /* Unix SMB/CIFS implementation. - SMB parameters and setup - Copyright (C) Andrew Tridgell 1992-1997 - Copyright (C) Luke Kenneth Casson Leighton 1996-1997 - Copyright (C) Paul Ashton 1997 + + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Paul Ashton 1997 + Copyright (C) Gerald (Jerry) Carter 2005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,8 +28,15 @@ #define _RPC_MISC_H #define SMB_RPC_INTERFACE_VERSION 1 +#define PRS_POINTER_CAST BOOL (*)(const char*, prs_struct*, int, void*) + +enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_TERMINATE = 2, UNI_BROKEN_NON_NULL = 3 }; + + -/* well-known RIDs - Relative IDs */ +/********************************************************************** + * well-known RIDs - Relative IDs + **********************************************************************/ /* RIDs - Well-known users ... */ #define DOMAIN_USER_RID_ADMIN (0x000001F4L) @@ -65,186 +73,208 @@ #define BUILTIN_ALIAS_RID_RAS_SERVERS (0x00000229L) #define BUILTIN_ALIAS_RID_PRE_2K_ACCESS (0x0000022aL) -/* + +/********************************************************************** * Masks for mappings between unix uid and gid types and * NT RIDS. - */ - + **********************************************************************/ #define BASE_RID (0x000003E8L) /* Take the bottom bit. */ -#define RID_TYPE_MASK 1 -#define RID_MULTIPLIER 2 +#define RID_TYPE_MASK 1 +#define RID_MULTIPLIER 2 /* The two common types. */ -#define USER_RID_TYPE 0 -#define GROUP_RID_TYPE 1 +#define USER_RID_TYPE 0 +#define GROUP_RID_TYPE 1 -/* ENUM_HND */ -typedef struct enum_hnd_info -{ + + +/********************************************************************** + * RPC policy handle used pretty much everywhere + **********************************************************************/ + +typedef struct { uint32 ptr_hnd; /* pointer to enumeration handle */ uint32 handle; /* enumeration handle */ } ENUM_HND; -/* LOOKUP_LEVEL - switch value */ -typedef struct lookup_level_info -{ - uint16 value; -} LOOKUP_LEVEL; -/* DOM_SID2 - security id */ -typedef struct sid_info_2 -{ - uint32 num_auths; /* length, bytes, including length of len :-) */ - DOM_SID sid; -} DOM_SID2; -/* STRHDR - string header */ -typedef struct header_info -{ - uint16 str_str_len; - uint16 str_max_len; - uint32 buffer; /* non-zero */ -} STRHDR; +/********************************************************************** + * RPC policy handle used pretty much everywhere + **********************************************************************/ -/* UNIHDR - unicode string header */ -typedef struct unihdr_info -{ - uint16 uni_str_len; - uint16 uni_max_len; - uint32 buffer; /* usually has a value of 4 */ -} UNIHDR; +typedef struct { + uint32 data1; + uint32 data2; + uint16 data3; + uint16 data4; + uint8 data5[8]; +#ifdef __INSURE__ -/* UNIHDR2 - unicode string header and undocumented buffer */ -typedef struct unihdr2_info -{ - UNIHDR unihdr; - uint32 buffer; /* 32 bit buffer pointer */ -} UNIHDR2; + /* To prevent the leakage of policy handles mallocate a bit of + memory when a policy handle is created and free it when the + handle is closed. This should cause Insure to flag an error + when policy handles are overwritten or fall out of scope without + being freed. */ -/* UNISTR - unicode string size and buffer */ -typedef struct unistr_info -{ - /* unicode characters. ***MUST*** be little-endian. ***MUST*** be null-terminated */ - uint16 *buffer; -} UNISTR; + char *marker; +#endif +} POLICY_HND; -/* BUFHDR - buffer header */ -typedef struct bufhdr_info -{ + +/********************************************************************** + * Buffer Headers -- use by SEC_DESC_BUF in winreg and netlogon code + **********************************************************************/ + +typedef struct { uint32 buf_max_len; uint32 buf_len; } BUFHDR; -/* BUFFER2 - unicode string, size (in uint8 ascii chars) and buffer */ -/* pathetic. some stupid team of \PIPE\winreg writers got the concept */ -/* of a unicode string different from the other \PIPE\ writers */ -typedef struct buffer2_info -{ +typedef struct { + uint32 info_level; + uint32 length; /* uint8 chars */ + uint32 buffer; +} BUFHDR2; + +typedef struct { + uint32 size; + uint32 buffer; +} BUFHDR4; + + +/********************************************************************** + * Buffers + **********************************************************************/ + +/* buffer used by \winreg\ calls to fill in arbitrary REG_XXX values. + It *may* look like a UNISTR2 but it is *not*. This is not a goof + by the winreg developers. It is a generic buffer */ + +typedef struct { uint32 buf_max_len; uint32 offset; uint32 buf_len; - /* unicode characters. ***MUST*** be little-endian. **NOT** necessarily null-terminated */ uint16 *buffer; -} BUFFER2; +} REGVAL_BUFFER; -/* BUFFER3 */ -typedef struct buffer3_info -{ - uint32 buf_max_len; - uint8 *buffer; /* Data */ +/* generic rpc version of the DATA_BLOB. Just a length and uint8 array */ + +typedef struct { uint32 buf_len; -} BUFFER3; + uint8 *buffer; +} RPC_DATA_BLOB; -/* BUFFER5 */ -typedef struct buffer5_info -{ +/********************************************************************** + * Buffers use by spoolss (i might be able to replace it with + * an RPC_DATA_BLOB) + **********************************************************************/ + +typedef struct { uint32 buf_len; uint16 *buffer; /* data */ } BUFFER5; -/* UNISTR2 - unicode string size (in uint16 unicode chars) and buffer */ -typedef struct unistr2_info -{ + +/********************************************************************** + * Unicode and basic string headers + **********************************************************************/ + +typedef struct { + uint16 str_str_len; + uint16 str_max_len; + uint32 buffer; /* non-zero */ +} STRHDR; + +typedef struct { + uint16 uni_str_len; + uint16 uni_max_len; + uint32 buffer; +} UNIHDR; + +/********************************************************************** + * UNICODE string variations + **********************************************************************/ + + +typedef struct { /* UNISTR - unicode string size and buffer */ + uint16 *buffer; /* unicode characters. ***MUST*** be + little-endian. ***MUST*** be null-terminated */ +} UNISTR; + +typedef struct { /* UNISTR2 - unicode string size (in + uint16 unicode chars) and buffer */ uint32 uni_max_len; uint32 offset; uint32 uni_str_len; - /* unicode characters. ***MUST*** be little-endian. - **must** be null-terminated and the uni_str_len should include - the NULL character */ - uint16 *buffer; + uint16 *buffer; /* unicode characters. ***MUST*** be little-endian. + **must** be null-terminated and the uni_str_len + should include the NULL character */ } UNISTR2; -/* STRING2 - string size (in uint8 chars) and buffer */ -typedef struct string2_info -{ +typedef struct { /* UNISTR3 - XXXX not sure about this structure */ + uint32 uni_str_len; + UNISTR str; + +} UNISTR3; + +typedef struct { /* Buffer wrapped around a UNISTR2 */ + uint16 length; /* number of bytes not counting NULL terminatation */ + uint16 size; /* number of bytes including NULL terminatation */ + UNISTR2 *string; +} UNISTR4; + +typedef struct { + uint32 count; + UNISTR4 *strings; +} UNISTR4_ARRAY; + + +/********************************************************************** + * String variations + **********************************************************************/ + +typedef struct { /* STRING2 - string size (in uint8 chars) and buffer */ uint32 str_max_len; uint32 offset; uint32 str_str_len; - uint8 *buffer; /* uint8 characters. **NOT** necessarily null-terminated */ + uint8 *buffer; /* uint8 characters. **NOT** necessarily null-terminated */ } STRING2; -/* UNISTR3 - XXXX not sure about this structure */ -typedef struct unistr3_info -{ - uint32 uni_str_len; - UNISTR str; -} UNISTR3; -/* an element in a unicode string array */ -typedef struct -{ - uint16 length; - uint16 size; - uint32 ref_id; - UNISTR2 string; -} UNISTR2_ARRAY_EL; - -/* an array of unicode strings */ -typedef struct -{ - uint32 ref_id; - uint32 count; - UNISTR2_ARRAY_EL *strings; -} UNISTR2_ARRAY; +/********************************************************************** + * Domain SID structures + **********************************************************************/ -/* an element in a sid array */ -typedef struct -{ - uint32 ref_id; - DOM_SID2 sid; -} SID_ARRAY_EL; +typedef struct { + uint32 num_auths; /* length, bytes, including length of len :-) */ + DOM_SID sid; +} DOM_SID2; -/* an array of sids */ -typedef struct -{ - uint32 ref_id; - uint32 count; - SID_ARRAY_EL *sids; -} SID_ARRAY; + +/********************************************************************** + * Domain SID structures + **********************************************************************/ /* DOM_RID2 - domain RID structure for ntlsa pipe */ -typedef struct domrid2_info -{ +typedef struct { uint8 type; /* value is SID_NAME_USE enum */ uint32 rid; uint32 rid_idx; /* referenced domain index */ - } DOM_RID2; -/* DOM_RID3 - domain RID structure for samr pipe */ -typedef struct domrid3_info -{ + +typedef struct { /* DOM_RID3 - domain RID structure for samr pipe */ uint32 rid; /* domain-relative (to a SID) id */ uint32 type1; /* value is 0x1 */ uint32 ptr_type; /* undocumented pointer */ uint32 type2; /* value is 0x1 */ uint32 unk; /* value is 0x2 */ - } DOM_RID3; /* DOM_RID4 - rid + user attributes */ @@ -255,6 +285,16 @@ typedef struct domrid4_info uint32 rid; /* user RID */ } DOM_RID4; +/* DOM_GID - group id + user attributes */ +typedef struct { + uint32 g_rid; /* a group RID */ + uint32 attr; +} DOM_GID; + +/********************************************************************** + * ???? + **********************************************************************/ + /* DOM_CLNT_SRV - client / server names */ typedef struct clnt_srv_info { @@ -316,32 +356,8 @@ typedef struct owf_info } OWF_INFO; -/* DOM_GID - group id + user attributes */ -typedef struct gid_info -{ - uint32 g_rid; /* a group RID */ - uint32 attr; -} DOM_GID; -/* POLICY_HND */ -typedef struct lsa_policy_info -{ - uint32 data1; - uint32 data2; - uint16 data3; - uint16 data4; - uint8 data5[8]; -#ifdef __INSURE__ - - /* To prevent the leakage of policy handles mallocate a bit of - memory when a policy handle is created and free it when the - handle is closed. This should cause Insure to flag an error - when policy handles are overwritten or fall out of scope without - being freed. */ - char *marker; -#endif -} POLICY_HND; /* * A client connection's state, pipe name, @@ -380,33 +396,8 @@ typedef struct uint64_s uint32 high; } UINT64_S; -/* BUFHDR2 - another buffer header, with info level */ -typedef struct bufhdr2_info -{ - uint32 info_level; - uint32 length; /* uint8 chars */ - uint32 buffer; -} -BUFHDR2; -/* BUFHDR4 - another buffer header */ -typedef struct bufhdr4_info -{ - uint32 size; - uint32 buffer; -} -BUFHDR4; -/* BUFFER4 - simple length and buffer */ -typedef struct buffer4_info -{ - uint32 buf_len; - uint8 *buffer; - -} -BUFFER4; - -enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_TERMINATE = 2, UNI_BROKEN_NON_NULL = 3 }; #endif /* _RPC_MISC_H */ diff --git a/source/include/rpc_netlogon.h b/source/include/rpc_netlogon.h index 3ba1ce6465b..6812358575a 100644 --- a/source/include/rpc_netlogon.h +++ b/source/include/rpc_netlogon.h @@ -643,7 +643,7 @@ typedef struct sam_domain_info_info UNISTR2 uni_dom_name; UNISTR2 buf_oem_info; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; LOCKOUT_STRING account_lockout; @@ -670,7 +670,7 @@ typedef struct sam_group_info_info UNISTR2 uni_grp_name; UNISTR2 uni_grp_desc; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; } SAM_GROUP_INFO; @@ -748,11 +748,11 @@ typedef struct sam_account_info_info uint32 unknown1; /* 0x4EC */ uint32 unknown2; /* 0 */ - BUFFER4 buf_logon_hrs; + RPC_DATA_BLOB buf_logon_hrs; UNISTR2 uni_comment; UNISTR2 uni_parameters; SAM_PWD pass; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; UNISTR2 uni_profile; } SAM_ACCOUNT_INFO; @@ -783,7 +783,7 @@ typedef struct sam_alias_info_info uint8 reserved[40]; UNISTR2 uni_als_name; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; UNISTR2 uni_als_desc; } SAM_ALIAS_INFO; @@ -829,7 +829,7 @@ typedef struct UNISTR2 domain_name; DOM_SID2 domain_sid; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; } SAM_DELTA_POLICY; /* SAM_DELTA_TRUST_DOMS */ @@ -881,7 +881,7 @@ typedef struct UNIHDR *hdr_privslist; UNISTR2 *uni_privslist; - BUFFER4 buf_sec_desc; + RPC_DATA_BLOB buf_sec_desc; } SAM_DELTA_PRIVS; /* SAM_DELTA_SECRET */ diff --git a/source/include/rpc_reg.h b/source/include/rpc_reg.h index bfb5f1e0763..f70fb5f03cf 100644 --- a/source/include/rpc_reg.h +++ b/source/include/rpc_reg.h @@ -4,7 +4,8 @@ Copyright (C) Andrew Tridgell 1992-1997. Copyright (C) Luke Kenneth Casson Leighton 1996-1997. Copyright (C) Paul Ashton 1997. - Copyright (C) Gerald Carter 2002. + Copyright (C) Jeremy Cooper 2004. + Copyright (C) Gerald Carter 2002-2005. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,50 +25,44 @@ #ifndef _RPC_REG_H /* _RPC_REG_H */ #define _RPC_REG_H +/* RPC opnum */ -/* winreg pipe defines - NOT IMPLEMENTED !! -#define _REG_UNK_01 0x01 -#define _REG_UNK_03 0x03 -#define REG_CREATE_KEY 0x06 -#define REG_DELETE_KEY 0x07 -#define REG_DELETE_VALUE 0x08 -#define REG_FLUSH_KEY 0x0b -#define REG_GET_KEY_SEC 0x0c -#define _REG_UNK_0D 0x0d -#define _REG_UNK_0E 0x0e -#define _REG_UNK_12 0x12 -#define _REG_UNK_13 0x13 -#define REG_SET_KEY_SEC 0x15 -#define REG_CREATE_VALUE 0x16 -#define _REG_UNK_17 0x17 -*/ - -/* Implemented */ #define REG_OPEN_HKCR 0x00 #define REG_OPEN_HKLM 0x02 +#define REG_OPEN_HKPD 0x03 #define REG_OPEN_HKU 0x04 #define REG_CLOSE 0x05 +#define REG_CREATE_KEY 0x06 +#define REG_DELETE_KEY 0x07 +#define REG_DELETE_VALUE 0x08 #define REG_ENUM_KEY 0x09 #define REG_ENUM_VALUE 0x0a +#define REG_FLUSH_KEY 0x0b +#define REG_GET_KEY_SEC 0x0c #define REG_OPEN_ENTRY 0x0f #define REG_QUERY_KEY 0x10 #define REG_INFO 0x11 +#define REG_RESTORE_KEY 0x13 +#define REG_SAVE_KEY 0x14 +#define REG_SET_KEY_SEC 0x15 +#define REG_SET_VALUE 0x16 #define REG_SHUTDOWN 0x18 #define REG_ABORT_SHUTDOWN 0x19 -#define REG_SAVE_KEY 0x14 /* no idea what the real name is */ -#define REG_UNKNOWN_1A 0x1a +#define REG_GETVERSION 0x1a +#define REG_SHUTDOWN_EX 0x1e #define HKEY_CLASSES_ROOT 0x80000000 #define HKEY_CURRENT_USER 0x80000001 #define HKEY_LOCAL_MACHINE 0x80000002 #define HKEY_USERS 0x80000003 +#define HKEY_PERFORMANCE_DATA 0x80000004 #define KEY_HKLM "HKLM" #define KEY_HKU "HKU" #define KEY_HKCR "HKCR" #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" +#define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog" #define KEY_TREE_ROOT "" /* Registry data types */ @@ -85,6 +80,10 @@ #define REG_FULL_RESOURCE_DESCRIPTOR 9 #define REG_RESOURCE_REQUIREMENTS_LIST 10 +/* + * INTERNAL REGISTRY STRUCTURES + */ + /* structure to contain registry values */ typedef struct { @@ -94,7 +93,7 @@ typedef struct { uint8 *data_p; } REGISTRY_VALUE; -/* container for regostry values */ +/* container for registry values */ typedef struct { TALLOC_CTX *ctx; @@ -143,379 +142,253 @@ typedef struct _RegistryKey { } REGISTRY_KEY; +/* + * RPC REGISTRY STRUCTURES + */ -/* REG_Q_OPEN_HKCR */ -typedef struct q_reg_open_hkcr_info -{ - uint32 ptr; - uint16 unknown_0; /* 0x5428 - 16 bit unknown */ - uint16 unknown_1; /* random. changes */ - uint32 level; /* 0x0000 0002 - 32 bit unknown */ - -} REG_Q_OPEN_HKCR ; - -/* REG_R_OPEN_HKCR */ -typedef struct r_reg_open_hkcr_info -{ - POLICY_HND pol; /* policy handle */ - WERROR status; /* return status */ - -} REG_R_OPEN_HKCR; - - -/* REG_Q_OPEN_HKLM */ -typedef struct q_reg_open_hklm_info -{ - uint32 ptr; - uint16 unknown_0; /* 0xE084 - 16 bit unknown */ - uint16 unknown_1; /* random. changes */ - uint32 access_mask; +/***********************************************/ -} -REG_Q_OPEN_HKLM; - -/* REG_R_OPEN_HKLM */ -typedef struct r_reg_open_hklm_info -{ - POLICY_HND pol; /* policy handle */ - WERROR status; /* return status */ - -} -REG_R_OPEN_HKLM; - - -/* REG_Q_OPEN_HKU */ -typedef struct q_reg_open_hku_info -{ - uint32 ptr; - uint16 unknown_0; - uint16 unknown_1; - uint32 access_mask; - -} REG_Q_OPEN_HKU; - -/* REG_R_OPEN_HKU */ -typedef struct r_reg_open_hku_info -{ - POLICY_HND pol; /* policy handle */ - WERROR status; /* return status */ +typedef struct { + uint16 *server; + uint32 access; +} REG_Q_OPEN_HIVE; -} REG_R_OPEN_HKU; +typedef struct { + POLICY_HND pol; + WERROR status; +} REG_R_OPEN_HIVE; -/* REG_Q_FLUSH_KEY */ -typedef struct q_reg_open_flush_key_info -{ - POLICY_HND pol; /* policy handle */ +/***********************************************/ +typedef struct { + POLICY_HND pol; } REG_Q_FLUSH_KEY; -/* REG_R_FLUSH_KEY */ -typedef struct r_reg_open_flush_key_info -{ - WERROR status; /* return status */ - +typedef struct { + WERROR status; } REG_R_FLUSH_KEY; -/* REG_Q_SET_KEY_SEC */ -typedef struct q_reg_set_key_sec_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 sec_info; /* xxxx_SECURITY_INFORMATION */ +/***********************************************/ - uint32 ptr; /* pointer */ - BUFHDR hdr_sec; /* header for security data */ - SEC_DESC_BUF *data; /* security data */ - +typedef struct { + POLICY_HND pol; + uint32 sec_info; + uint32 ptr; + BUFHDR hdr_sec; + SEC_DESC_BUF *data; } REG_Q_SET_KEY_SEC; -/* REG_R_SET_KEY_SEC */ -typedef struct r_reg_set_key_sec_info -{ +typedef struct { WERROR status; - } REG_R_SET_KEY_SEC; -/* REG_Q_GET_KEY_SEC */ -typedef struct q_reg_get_key_sec_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 sec_info; /* xxxx_SECURITY_INFORMATION */ +/***********************************************/ - uint32 ptr; /* pointer */ - BUFHDR hdr_sec; /* header for security data */ - SEC_DESC_BUF *data; /* security data */ - +typedef struct { + POLICY_HND pol; + uint32 sec_info; + uint32 ptr; + BUFHDR hdr_sec; + SEC_DESC_BUF *data; } REG_Q_GET_KEY_SEC; -/* REG_R_GET_KEY_SEC */ -typedef struct r_reg_get_key_sec_info -{ - uint32 sec_info; /* xxxx_SECURITY_INFORMATION */ - - uint32 ptr; /* pointer */ - BUFHDR hdr_sec; /* header for security data */ - SEC_DESC_BUF *data; /* security data */ - +typedef struct { + uint32 sec_info; + uint32 ptr; + BUFHDR hdr_sec; + SEC_DESC_BUF *data; WERROR status; - } REG_R_GET_KEY_SEC; -/* REG_Q_CREATE_VALUE */ -typedef struct q_reg_create_value_info -{ - POLICY_HND pol; /* policy handle */ - - UNIHDR hdr_name; /* name of value */ - UNISTR2 uni_name; - - uint32 type; /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */ - - BUFFER3 *buf_value; /* value, in byte buffer */ - -} REG_Q_CREATE_VALUE; +/***********************************************/ -/* REG_R_CREATE_VALUE */ -typedef struct r_reg_create_value_info -{ - WERROR status; /* return status */ - -} REG_R_CREATE_VALUE; - -/* REG_Q_ENUM_VALUE */ -typedef struct q_reg_query_value_info -{ - POLICY_HND pol; /* policy handle */ - - uint32 val_index; /* index */ - - UNIHDR hdr_name; /* name of value */ - UNISTR2 uni_name; - - uint32 ptr_type; /* pointer */ - uint32 type; /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */ - - uint32 ptr_value; /* pointer */ - BUFFER2 buf_value; /* value, in byte buffer */ - - uint32 ptr1; /* pointer */ - uint32 len_value1; /* */ - - uint32 ptr2; /* pointer */ - uint32 len_value2; /* */ +typedef struct { + POLICY_HND pol; + UNISTR4 name; + uint32 type; + RPC_DATA_BLOB value; + uint32 size; +} REG_Q_SET_VALUE; + +typedef struct { + WERROR status; +} REG_R_SET_VALUE; +/***********************************************/ +typedef struct { + POLICY_HND pol; + uint32 val_index; + UNISTR4 name; + uint32 *type; + REGVAL_BUFFER *value; /* value, in byte buffer */ + uint32 *len_value1; + uint32 *len_value2; } REG_Q_ENUM_VALUE; -/* REG_R_ENUM_VALUE */ -typedef struct r_reg_enum_value_info -{ - UNIHDR hdr_name; /* name of value */ - UNISTR2 uni_name; - - uint32 ptr_type; /* pointer */ - uint32 type; /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */ - - uint32 ptr_value; /* pointer */ - BUFFER2 buf_value; /* value, in byte buffer */ - - uint32 ptr1; /* pointer */ - uint32 len_value1; /* */ - - uint32 ptr2; /* pointer */ - uint32 len_value2; /* */ - - WERROR status; /* return status */ - +typedef struct { + UNISTR4 name; + uint32 *type; + REGVAL_BUFFER *value; + uint32 *len_value1; + uint32 *len_value2; + WERROR status; } REG_R_ENUM_VALUE; -/* REG_Q_CREATE_KEY */ -typedef struct q_reg_create_key_info -{ - POLICY_HND pnt_pol; /* parent key policy handle */ +/***********************************************/ - UNIHDR hdr_name; - UNISTR2 uni_name; - - UNIHDR hdr_class; - UNISTR2 uni_class; - - uint32 reserved; /* 0x0000 0000 */ - SEC_ACCESS sam_access; /* access rights flags, see rpc_secdes.h */ - - uint32 ptr1; - uint32 sec_info; /* xxxx_SECURITY_INFORMATION */ - - uint32 ptr2; /* pointer */ - BUFHDR hdr_sec; /* header for security data */ - uint32 ptr3; /* pointer */ +typedef struct { + POLICY_HND pnt_pol; + UNISTR4 name; + UNISTR4 class; + uint32 reserved; + uint32 access; + uint32 *sec_info; + uint32 ptr2; + BUFHDR hdr_sec; + uint32 ptr3; SEC_DESC_BUF *data; - uint32 unknown_2; /* 0x0000 0000 */ - } REG_Q_CREATE_KEY; -/* REG_R_CREATE_KEY */ -typedef struct r_reg_create_key_info -{ - POLICY_HND key_pol; /* policy handle */ - uint32 unknown; /* 0x0000 0000 */ - - WERROR status; /* return status */ - +typedef struct { + POLICY_HND key_pol; + uint32 unknown; + WERROR status; } REG_R_CREATE_KEY; -/* REG_Q_DELETE_KEY */ -typedef struct q_reg_delete_key_info -{ - POLICY_HND pnt_pol; /* parent key policy handle */ +/***********************************************/ - UNIHDR hdr_name; - UNISTR2 uni_name; +typedef struct { + POLICY_HND pnt_pol; + UNISTR4 name; } REG_Q_DELETE_KEY; -/* REG_R_DELETE_KEY */ -typedef struct r_reg_delete_key_info -{ - POLICY_HND key_pol; /* policy handle */ - - WERROR status; /* return status */ - +typedef struct { + POLICY_HND key_pol; + WERROR status; } REG_R_DELETE_KEY; -/* REG_Q_DELETE_VALUE */ -typedef struct q_reg_delete_val_info -{ - POLICY_HND pnt_pol; /* parent key policy handle */ - - UNIHDR hdr_name; - UNISTR2 uni_name; +/***********************************************/ +typedef struct { + POLICY_HND pnt_pol; + UNISTR4 name; } REG_Q_DELETE_VALUE; -/* REG_R_DELETE_VALUE */ -typedef struct r_reg_delete_val_info -{ - POLICY_HND key_pol; /* policy handle */ - - WERROR status; /* return status */ - +typedef struct { + POLICY_HND key_pol; + WERROR status; } REG_R_DELETE_VALUE; -/* REG_Q_QUERY_KEY */ -typedef struct q_reg_query_info -{ - POLICY_HND pol; /* policy handle */ - UNIHDR hdr_class; - UNISTR2 uni_class; +/***********************************************/ +typedef struct { + POLICY_HND pol; + UNISTR4 class; } REG_Q_QUERY_KEY; -/* REG_R_QUERY_KEY */ -typedef struct r_reg_query_key_info -{ - UNIHDR hdr_class; - UNISTR2 uni_class; - +typedef struct { + UNISTR4 class; uint32 num_subkeys; uint32 max_subkeylen; - uint32 reserved; /* 0x0000 0000 - according to MSDN (max_subkeysize?) */ + uint32 reserved; /* 0x0000 0000 - according to MSDN (max_subkeysize?) */ uint32 num_values; uint32 max_valnamelen; uint32 max_valbufsize; - uint32 sec_desc; /* 0x0000 0078 */ - NTTIME mod_time; /* modified time */ - - WERROR status; /* return status */ - + uint32 sec_desc; /* 0x0000 0078 */ + NTTIME mod_time; /* modified time */ + WERROR status; } REG_R_QUERY_KEY; -/* REG_Q_UNKNOWN_1A */ -typedef struct q_reg_unk_1a_info -{ - POLICY_HND pol; /* policy handle */ +/***********************************************/ -} REG_Q_UNKNOWN_1A; +typedef struct { + POLICY_HND pol; /* policy handle */ +} REG_Q_GETVERSION; -/* REG_R_UNKNOWN_1A */ -typedef struct r_reg_unk_1a_info -{ +typedef struct { uint32 unknown; /* 0x0500 0000 */ WERROR status; /* return status */ +} REG_R_GETVERSION; -} REG_R_UNKNOWN_1A; +/***********************************************/ -/* REG_Q_UNKNOWN_1A */ -typedef struct q_reg_unknown_14 -{ - POLICY_HND pol; /* policy handle */ - - UNIHDR hdr_file; /* unicode product type header */ - UNISTR2 uni_file; /* local filename to save key as from regedt32.exe */ - /* e.g. "c:\temp\test.dat" */ - - uint32 unknown; /* 0x0000 0000 */ +typedef struct { + POLICY_HND pol; + UNISTR4 filename; + uint32 flags; +} REG_Q_RESTORE_KEY; -} REG_Q_SAVE_KEY; +typedef struct { + WERROR status; /* return status */ +} REG_R_RESTORE_KEY; -/* REG_R_UNKNOWN_1A */ -typedef struct r_reg_unknown_14 -{ - WERROR status; /* return status */ +/***********************************************/ -} REG_R_SAVE_KEY; +/* I have no idea if this is correct since I + have not seen the full structure on the wire + as of yet */ + +typedef struct { + uint32 max_len; + uint32 len; + SEC_DESC *secdesc; +} REG_SEC_DESC_BUF; +typedef struct { + uint32 size; /* size in bytes of security descriptor */ + REG_SEC_DESC_BUF secdesc; + uint8 inherit; /* see MSDN for a description */ +} SECURITY_ATTRIBUTE; -/* REG_Q_CLOSE */ -typedef struct reg_q_close_info -{ - POLICY_HND pol; /* policy handle */ +typedef struct { + POLICY_HND pol; + UNISTR4 filename; + SECURITY_ATTRIBUTE *sec_attr; +} REG_Q_SAVE_KEY; -} REG_Q_CLOSE; +typedef struct { + WERROR status; /* return status */ +} REG_R_SAVE_KEY; -/* REG_R_CLOSE */ -typedef struct reg_r_close_info -{ - POLICY_HND pol; /* policy handle. should be all zeros. */ - WERROR status; /* return code */ +/***********************************************/ +typedef struct { + POLICY_HND pol; /* policy handle */ +} REG_Q_CLOSE; + +typedef struct { + POLICY_HND pol; + WERROR status; } REG_R_CLOSE; -/* REG_Q_ENUM_KEY */ -typedef struct q_reg_enum_value_info -{ - POLICY_HND pol; /* policy handle */ +/***********************************************/ +typedef struct { + POLICY_HND pol; uint32 key_index; - uint16 key_name_len; /* 0x0000 */ uint16 unknown_1; /* 0x0414 */ - uint32 ptr1; /* pointer */ uint32 unknown_2; /* 0x0000 020A */ uint8 pad1[8]; /* padding - zeros */ - uint32 ptr2; /* pointer */ uint8 pad2[8]; /* padding - zeros */ - uint32 ptr3; /* pointer */ NTTIME time; /* current time? */ - } REG_Q_ENUM_KEY; -/* REG_R_ENUM_KEY */ -typedef struct r_reg_enum_key_info -{ +typedef struct { uint16 key_name_len; /* number of bytes in key name */ uint16 unknown_1; /* 0x0414 - matches with query unknown_1 */ @@ -532,17 +405,14 @@ typedef struct r_reg_enum_key_info NTTIME time; /* current time? */ WERROR status; /* return status */ - } REG_R_ENUM_KEY; -/* REG_Q_INFO */ -typedef struct q_reg_info_info -{ - POLICY_HND pol; /* policy handle */ +/***********************************************/ - UNIHDR hdr_type; /* unicode product type header */ - UNISTR2 uni_type; /* unicode product type - "ProductType" */ +typedef struct { + POLICY_HND pol; /* policy handle */ + UNISTR4 name; uint32 ptr_reserved; /* pointer */ @@ -560,83 +430,66 @@ typedef struct q_reg_info_info } REG_Q_INFO; -/* REG_R_INFO */ -typedef struct r_reg_info_info -{ - uint32 ptr_type; /* key type pointer */ - uint32 type; /* key datatype */ - - uint32 ptr_uni_val; /* key value pointer */ - BUFFER2 uni_val; /* key value */ - - uint32 ptr_max_len; - uint32 buf_max_len; - - uint32 ptr_len; - uint32 buf_len; - +typedef struct { + uint32 *type; + REGVAL_BUFFER *value; /* key value */ + uint32 *buf_max_len; + uint32 *buf_len; WERROR status; /* return status */ - } REG_R_INFO; -/* REG_Q_OPEN_ENTRY */ -typedef struct q_reg_open_entry_info -{ - POLICY_HND pol; /* policy handle */ - - UNIHDR hdr_name; /* unicode registry string header */ - UNISTR2 uni_name; /* unicode registry string name */ +/***********************************************/ +typedef struct { + POLICY_HND pol; + UNISTR4 name; uint32 unknown_0; /* 32 bit unknown - 0x0000 0000 */ - uint32 access_desired; - + uint32 access; } REG_Q_OPEN_ENTRY; - - -/* REG_R_OPEN_ENTRY */ -typedef struct r_reg_open_entry_info -{ - POLICY_HND pol; /* policy handle */ - WERROR status; /* return status */ - +typedef struct { + POLICY_HND pol; + WERROR status; } REG_R_OPEN_ENTRY; -/* REG_Q_SHUTDOWN */ -typedef struct q_reg_shutdown_info -{ - uint32 ptr_0; - uint32 ptr_1; - uint32 ptr_2; - UNIHDR hdr_msg; /* shutdown message */ - UNISTR2 uni_msg; /* seconds */ - uint32 timeout; /* seconds */ +/***********************************************/ + +typedef struct { + uint16 *server; + UNISTR4 *message; + uint32 timeout; /* in seconds */ uint8 force; /* boolean: force shutdown */ - uint8 reboot; /* boolean: reboot on shutdown */ - + uint8 reboot; /* boolean: reboot on shutdown */ } REG_Q_SHUTDOWN; -/* REG_R_SHUTDOWN */ -typedef struct r_reg_shutdown_info -{ +typedef struct { WERROR status; /* return status */ - } REG_R_SHUTDOWN; -/* REG_Q_ABORT_SHUTDOWN */ -typedef struct q_reg_abort_shutdown_info -{ - uint32 ptr_server; - uint16 server; +/***********************************************/ + +typedef struct { + uint16 *server; + UNISTR4 *message; + uint32 timeout; /* in seconds */ + uint8 force; /* boolean: force shutdown */ + uint8 reboot; /* boolean: reboot on shutdown */ + uint32 reason; /* reason - must be defined code */ +} REG_Q_SHUTDOWN_EX; -} REG_Q_ABORT_SHUTDOWN; +typedef struct { + WERROR status; +} REG_R_SHUTDOWN_EX; + +/***********************************************/ -/* REG_R_ABORT_SHUTDOWN */ -typedef struct r_reg_abort_shutdown_info -{ - WERROR status; /* return status */ +typedef struct { + uint16 *server; +} REG_Q_ABORT_SHUTDOWN; +typedef struct { + WERROR status; } REG_R_ABORT_SHUTDOWN; diff --git a/source/include/rpc_secdes.h b/source/include/rpc_secdes.h index 3e4c47dce9a..ea987f9e4e0 100644 --- a/source/include/rpc_secdes.h +++ b/source/include/rpc_secdes.h @@ -472,4 +472,51 @@ typedef struct standard_mapping { (STANDARD_RIGHTS_EXECUTE_ACCESS | \ SA_RIGHT_ALIAS_LOOKUP_INFO ) /* 0x00020008 */ +/* + * Acces bits for the svcctl objects + */ + +/* Service Control Manager Bits */ + +#define SC_RIGHT_MGR_CONNECT 0x0001 +#define SC_RIGHT_MGR_CREATE_SERVICE 0x0002 +#define SC_RIGHT_MGR_ENUMERATE_SERVICE 0x0004 +#define SC_RIGHT_MGR_LOCK 0x0008 +#define SC_RIGHT_MGR_QUERY_LOCK_STATUS 0x0010 +#define SC_RIGHT_MGR_MODIFY_BOOT_CONFIG 0x0020 + +#define SC_MANAGER_ALL_ACCESS \ + ( STANDARD_RIGHTS_REQUIRED_ACCESS | \ + SC_RIGHT_MGR_CONNECT | \ + SC_RIGHT_MGR_CREATE_SERVICE | \ + SC_RIGHT_MGR_ENUMERATE_SERVICE | \ + SC_RIGHT_MGR_LOCK | \ + SC_RIGHT_MGR_QUERY_LOCK_STATUS | \ + SC_RIGHT_MGR_MODIFY_BOOT_CONFIG ) + +/* Service Object Bits */ + +#define SC_RIGHT_SVC_QUERY_CONFIG 0x0001 +#define SC_RIGHT_SVC_CHANGE_CONFIG 0x0002 +#define SC_RIGHT_SVC_QUERY_STATUS 0x0004 +#define SC_RIGHT_SVC_ENUMERATE_DEPENDENTS 0x0008 +#define SC_RIGHT_SVC_START 0x0010 +#define SC_RIGHT_SVC_STOP 0x0020 +#define SC_RIGHT_SVC_PAUSE_CONTINUE 0x0040 +#define SC_RIGHT_SVC_INTERROGATE 0x0080 +#define SC_RIGHT_SVC_USER_DEFINED_CONTROL 0x0100 + +#define SERVICE_ALL_ACCESS \ + ( STANDARD_RIGHTS_REQUIRED_ACCESS | \ + SC_RIGHT_SVC_QUERY_CONFIG | \ + SC_RIGHT_SVC_CHANGE_CONFIG | \ + SC_RIGHT_SVC_QUERY_STATUS | \ + SC_RIGHT_SVC_ENUMERATE_DEPENDENTS | \ + SC_RIGHT_SVC_START | \ + SC_RIGHT_SVC_STOP | \ + SC_RIGHT_SVC_PAUSE_CONTINUE | \ + SC_RIGHT_SVC_INTERROGATE | \ + SC_RIGHT_SVC_USER_DEFINED_CONTROL ) + + #endif /* _RPC_SECDES_H */ diff --git a/source/include/rpc_shutdown.h b/source/include/rpc_shutdown.h index b8e50b835f5..a9d86aec26c 100644 --- a/source/include/rpc_shutdown.h +++ b/source/include/rpc_shutdown.h @@ -1,7 +1,8 @@ /* Unix SMB/CIFS implementation. - SMB parameters and setup + Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003. + Copyright (C) Gerald (Jerry) Carter 2005. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,49 +23,53 @@ #define _RPC_SHUTDOWN_H -/* Implemented */ +/* opnums */ + #define SHUTDOWN_INIT 0x00 #define SHUTDOWN_ABORT 0x01 -/* NOT IMPLEMENTED #define SHUTDOWN_INIT_EX 0x02 -*/ -/* SHUTDOWN_Q_INIT */ -typedef struct q_shutodwn_init_info -{ - uint32 ptr_server; - uint16 server; - uint32 ptr_msg; - UNIHDR hdr_msg; /* shutdown message */ - UNISTR2 uni_msg; /* seconds */ - uint32 timeout; /* seconds */ + +/***********************************************/ + +typedef struct { + uint16 *server; + UNISTR4 *message; + uint32 timeout; /* in seconds */ uint8 force; /* boolean: force shutdown */ - uint8 reboot; /* boolean: reboot on shutdown */ - + uint8 reboot; /* boolean: reboot on shutdown */ } SHUTDOWN_Q_INIT; -/* SHUTDOWN_R_INIT */ -typedef struct r_shutdown_init_info -{ - NTSTATUS status; /* return status */ - +typedef struct { + WERROR status; /* return status */ } SHUTDOWN_R_INIT; -/* SHUTDOWN_Q_ABORT */ -typedef struct q_shutdown_abort_info -{ - uint32 ptr_server; - uint16 server; +/***********************************************/ + +typedef struct { + uint16 *server; + UNISTR4 *message; + uint32 timeout; /* in seconds */ + uint8 force; /* boolean: force shutdown */ + uint8 reboot; /* boolean: reboot on shutdown */ + uint32 reason; /* reason - must be defined code */ +} SHUTDOWN_Q_INIT_EX; -} SHUTDOWN_Q_ABORT; +typedef struct { + WERROR status; +} SHUTDOWN_R_INIT_EX; -/* SHUTDOWN_R_ABORT */ -typedef struct r_shutdown_abort_info -{ - NTSTATUS status; /* return status */ +/***********************************************/ +typedef struct { + uint16 *server; +} SHUTDOWN_Q_ABORT; + +typedef struct { + WERROR status; } SHUTDOWN_R_ABORT; + #endif /* _RPC_SHUTDOWN_H */ diff --git a/source/include/rpc_spoolss.h b/source/include/rpc_spoolss.h index 7c5942759f4..64533635083 100755 --- a/source/include/rpc_spoolss.h +++ b/source/include/rpc_spoolss.h @@ -1,11 +1,10 @@ /* Unix SMB/Netbios implementation. - Version 1.9. - SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-2000, Copyright (C) Luke Kenneth Casson Leighton 1996-2000, Copyright (C) Jean Francois Micouleau 1998-2000. - Copyright (C) Gerald Carter 2001-2002. + Copyright (C) Gerald Carter 2001-2005. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -427,27 +426,22 @@ PRINTER_MESSAGE_INFO; /* this struct is undocumented */ /* thanks to the ddk ... */ -typedef struct spool_user_1 -{ +typedef struct { uint32 size; /* length of user_name & client_name + 2? */ - uint32 client_name_ptr; - uint32 user_name_ptr; + UNISTR2 *client_name; + UNISTR2 *user_name; uint32 build; uint32 major; uint32 minor; uint32 processor; - UNISTR2 client_name; - UNISTR2 user_name; -} -SPOOL_USER_1; +} SPOOL_USER_1; -typedef struct spool_user_ctr_info -{ +typedef struct { uint32 level; - uint32 ptr; - SPOOL_USER_1 user1; -} -SPOOL_USER_CTR; + union { + SPOOL_USER_1 *user1; + } user; +} SPOOL_USER_CTR; /* * various bits in the DEVICEMODE.fields member @@ -544,41 +538,33 @@ typedef struct _printer_default } PRINTER_DEFAULT; -/* SPOOL_Q_OPEN_PRINTER request to open a printer */ -typedef struct spool_q_open_printer -{ - uint32 printername_ptr; - UNISTR2 printername; +/********************************************/ + +typedef struct { + UNISTR2 *printername; PRINTER_DEFAULT printer_default; -} -SPOOL_Q_OPEN_PRINTER; +} SPOOL_Q_OPEN_PRINTER; -/* SPOOL_R_OPEN_PRINTER reply to an open printer */ -typedef struct spool_r_open_printer -{ +typedef struct { POLICY_HND handle; /* handle used along all transactions (20*uint8) */ WERROR status; -} -SPOOL_R_OPEN_PRINTER; +} SPOOL_R_OPEN_PRINTER; -/* SPOOL_Q_OPEN_PRINTER_EX request to open a printer */ -typedef struct spool_q_open_printer_ex -{ - uint32 printername_ptr; - UNISTR2 printername; +/********************************************/ + +typedef struct { + UNISTR2 *printername; PRINTER_DEFAULT printer_default; uint32 user_switch; SPOOL_USER_CTR user_ctr; -} -SPOOL_Q_OPEN_PRINTER_EX; +} SPOOL_Q_OPEN_PRINTER_EX; -/* SPOOL_R_OPEN_PRINTER_EX reply to an open printer */ -typedef struct spool_r_open_printer_ex -{ +typedef struct { POLICY_HND handle; /* handle used along all transactions (20*uint8) */ WERROR status; -} -SPOOL_R_OPEN_PRINTER_EX; +} SPOOL_R_OPEN_PRINTER_EX; + +/********************************************/ typedef struct spool_notify_option_type { @@ -614,15 +600,6 @@ typedef struct s_header_type } HEADER_TYPE; -typedef struct new_buffer -{ - uint32 ptr; - uint32 size; - prs_struct prs; - uint32 struct_start; - uint32 string_at_end; -} -NEW_BUFFER; typedef struct spool_q_getprinterdata { @@ -1014,7 +991,7 @@ typedef struct spool_q_enumprinters uint32 servername_ptr; UNISTR2 servername; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_ENUMPRINTERS; @@ -1033,7 +1010,7 @@ PRINTER_INFO_CTR; typedef struct spool_r_enumprinters { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; /* bytes needed */ uint32 returned; /* number of printers */ WERROR status; @@ -1045,7 +1022,7 @@ typedef struct spool_q_getprinter { POLICY_HND handle; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_GETPRINTER; @@ -1063,7 +1040,7 @@ typedef struct printer_info_info typedef struct spool_r_getprinter { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; WERROR status; } SPOOL_R_GETPRINTER; @@ -1137,7 +1114,7 @@ typedef struct spool_q_getprinterdriver2 uint32 architecture_ptr; UNISTR2 architecture; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; uint32 clientmajorversion; uint32 clientminorversion; @@ -1146,7 +1123,7 @@ SPOOL_Q_GETPRINTERDRIVER2; typedef struct spool_r_getprinterdriver2 { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; uint32 servermajorversion; uint32 serverminorversion; @@ -1167,14 +1144,14 @@ typedef struct spool_q_addjob { POLICY_HND handle; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_ADDJOB; typedef struct spool_r_addjob { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; WERROR status; } @@ -1251,7 +1228,7 @@ typedef struct spool_q_enumjobs uint32 firstjob; uint32 numofjobs; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_ENUMJOBS; @@ -1269,7 +1246,7 @@ typedef struct job_info_ctr_info typedef struct spool_r_enumjobs { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; uint32 returned; WERROR status; @@ -1316,7 +1293,7 @@ typedef struct spool_q_enumports uint32 name_ptr; UNISTR2 name; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_ENUMPORTS; @@ -1335,7 +1312,7 @@ PORT_INFO_CTR; typedef struct spool_r_enumports { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; /* bytes needed */ uint32 returned; /* number of printers */ WERROR status; @@ -1385,14 +1362,14 @@ typedef struct spool_q_enumprinterdrivers uint32 environment_ptr; UNISTR2 environment; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_ENUMPRINTERDRIVERS; typedef struct spool_r_enumprinterdrivers { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; uint32 returned; WERROR status; @@ -1420,14 +1397,14 @@ typedef struct spool_q_enumforms { POLICY_HND handle; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_ENUMFORMS; typedef struct spool_r_enumforms { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; uint32 numofforms; WERROR status; @@ -1439,14 +1416,14 @@ typedef struct spool_q_getform POLICY_HND handle; UNISTR2 formname; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_GETFORM; typedef struct spool_r_getform { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; WERROR status; } @@ -1601,28 +1578,6 @@ typedef struct spool_printer_driver_info_level SPOOL_PRINTER_DRIVER_INFO_LEVEL; -/* this struct is undocumented */ -/* thanks to the ddk ... */ -typedef struct spool_user_level_1 -{ - uint32 size; - uint32 client_name_ptr; - uint32 user_name_ptr; - uint32 build; - uint32 major; - uint32 minor; - uint32 processor; - UNISTR2 client_name; - UNISTR2 user_name; -} -SPOOL_USER_LEVEL_1; - -typedef struct spool_user_level -{ - SPOOL_USER_LEVEL_1 *user_level_1; -} -SPOOL_USER_LEVEL; - typedef struct spool_q_setprinter { POLICY_HND handle; @@ -1642,70 +1597,46 @@ typedef struct spool_r_setprinter } SPOOL_R_SETPRINTER; -typedef struct spool_q_addprinter -{ - UNISTR2 server_name; - uint32 level; - SPOOL_PRINTER_INFO_LEVEL info; - DEVMODE_CTR devmode_ctr; - SEC_DESC_BUF *secdesc_ctr; - uint32 user_level; - SPOOL_USER_LEVEL user; -} -SPOOL_Q_ADDPRINTER; - -typedef struct spool_r_addprinter -{ - WERROR status; -} -SPOOL_R_ADDPRINTER; +/********************************************/ -typedef struct spool_q_deleteprinter -{ +typedef struct { POLICY_HND handle; -} -SPOOL_Q_DELETEPRINTER; +} SPOOL_Q_DELETEPRINTER; -typedef struct spool_r_deleteprinter -{ +typedef struct { POLICY_HND handle; WERROR status; -} -SPOOL_R_DELETEPRINTER; +} SPOOL_R_DELETEPRINTER; -typedef struct spool_q_abortprinter -{ +/********************************************/ + +typedef struct { POLICY_HND handle; -} -SPOOL_Q_ABORTPRINTER; +} SPOOL_Q_ABORTPRINTER; -typedef struct spool_r_abortprinter -{ +typedef struct { WERROR status; -} -SPOOL_R_ABORTPRINTER; +} SPOOL_R_ABORTPRINTER; -typedef struct spool_q_addprinterex -{ - uint32 server_name_ptr; - UNISTR2 server_name; +/********************************************/ + +typedef struct { + UNISTR2 *server_name; uint32 level; SPOOL_PRINTER_INFO_LEVEL info; DEVMODE_CTR devmode_ctr; SEC_DESC_BUF *secdesc_ctr; uint32 user_switch; SPOOL_USER_CTR user_ctr; -} -SPOOL_Q_ADDPRINTEREX; +} SPOOL_Q_ADDPRINTEREX; -typedef struct spool_r_addprinterex -{ +typedef struct { POLICY_HND handle; WERROR status; -} -SPOOL_R_ADDPRINTEREX; +} SPOOL_R_ADDPRINTEREX; +/********************************************/ typedef struct spool_q_addprinterdriver { @@ -1758,14 +1689,14 @@ typedef struct spool_q_getprinterdriverdirectory uint32 environment_ptr; UNISTR2 environment; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_GETPRINTERDRIVERDIR; typedef struct spool_r_getprinterdriverdirectory { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; WERROR status; } @@ -1795,7 +1726,7 @@ typedef struct spool_q_enumprintprocessors uint32 environment_ptr; UNISTR2 environment; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_ENUMPRINTPROCESSORS; @@ -1808,7 +1739,7 @@ PRINTPROCESSOR_1; typedef struct spool_r_enumprintprocessors { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; uint32 returned; WERROR status; @@ -1822,7 +1753,7 @@ typedef struct spool_q_enumprintprocdatatypes uint32 processor_ptr; UNISTR2 processor; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_ENUMPRINTPROCDATATYPES; @@ -1835,7 +1766,7 @@ PRINTPROCDATATYPE_1; typedef struct spool_r_enumprintprocdatatypes { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; uint32 returned; WERROR status; @@ -1861,14 +1792,14 @@ typedef struct spool_q_enumprintmonitors uint32 name_ptr; UNISTR2 name; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_ENUMPRINTMONITORS; typedef struct spool_r_enumprintmonitors { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; uint32 returned; WERROR status; @@ -1996,7 +1927,7 @@ typedef struct spool_q_getjob POLICY_HND handle; uint32 jobid; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_GETJOB; @@ -2016,7 +1947,7 @@ PJOB_INFO; typedef struct spool_r_getjob { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; WERROR status; } @@ -2217,14 +2148,14 @@ typedef struct spool_q_getprintprocessordirectory UNISTR2 name; UNISTR2 environment; uint32 level; - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 offered; } SPOOL_Q_GETPRINTPROCESSORDIRECTORY; typedef struct spool_r_getprintprocessordirectory { - NEW_BUFFER *buffer; + RPC_BUFFER *buffer; uint32 needed; WERROR status; } diff --git a/source/include/rpc_srvsvc.h b/source/include/rpc_srvsvc.h index 5ebb77a8c21..f84054b878b 100644 --- a/source/include/rpc_srvsvc.h +++ b/source/include/rpc_srvsvc.h @@ -29,6 +29,7 @@ #define SRV_NET_FILE_ENUM 0x09 #define SRV_NET_FILE_CLOSE 0x0b #define SRV_NET_SESS_ENUM 0x0c +#define SRV_NET_SESS_DEL 0x0d #define SRV_NET_SHARE_ADD 0x0e #define SRV_NET_SHARE_ENUM_ALL 0x0f #define SRV_NET_SHARE_GET_INFO 0x10 @@ -193,6 +194,27 @@ typedef struct r_net_sess_enum_info } SRV_R_NET_SESS_ENUM; +/* SRV_Q_NET_SESS_DEL */ +typedef struct q_net_sess_del +{ + uint32 ptr_srv_name; /* pointer (to server name?) */ + UNISTR2 uni_srv_name; /* server name */ + + uint32 ptr_cli_name; /* pointer (to qualifier name) */ + UNISTR2 uni_cli_name; /* qualifier name "\\qualifier" */ + + uint32 ptr_user_name; /* pointer (to user name */ + UNISTR2 uni_user_name; /* user name */ + +} SRV_Q_NET_SESS_DEL; + +/* SRV_R_NET_SESS_DEL */ +typedef struct r_net_sess_del +{ + WERROR status; /* return status */ + +} SRV_R_NET_SESS_DEL; + /* CONN_INFO_0 (pointers to level 0 connection info strings) */ typedef struct ptr_conn_info0 { diff --git a/source/include/rpc_svcctl.h b/source/include/rpc_svcctl.h new file mode 100644 index 00000000000..90b90bd24b1 --- /dev/null +++ b/source/include/rpc_svcctl.h @@ -0,0 +1,246 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1997, + Copyright (C) Gerald (Jerry) Carter 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */ +#define _RPC_SVCCTL_H + + +/* svcctl pipe */ + +#define SVCCTL_CLOSE_SERVICE 0x00 +#define SVCCTL_CONTROL_SERVICE 0x01 +#define SVCCTL_QUERY_STATUS 0x06 +#define SVCCTL_ENUM_DEPENDENT_SERVICES_W 0x0d +#define SVCCTL_ENUM_SERVICES_STATUS_W 0x0e +#define SVCCTL_OPEN_SCMANAGER_W 0x0f +#define SVCCTL_OPEN_SERVICE_W 0x10 +#define SVCCTL_QUERY_SERVICE_CONFIG_W 0x11 +#define SVCCTL_START_SERVICE_W 0x13 +#define SVCCTL_GET_DISPLAY_NAME 0x14 +#define SVCCTL_QUERY_SERVICE_CONFIG2_W 0x27 + +/* ANSI versions not implemented currently +#define SVCCTL_ENUM_SERVICES_STATUS_A 0x0e +#define SVCCTL_OPEN_SCMANAGER_A 0x1b +*/ + +/* SERVER_STATUS - type */ + +#define SVCCTL_TYPE_WIN32 0x00000030 +#define SVCCTL_TYPE_DRIVER 0x0000000f + +/* SERVER_STATUS - state */ +#define SVCCTL_STATE_ACTIVE 0x00000001 +#define SVCCTL_STATE_INACTIVE 0x00000002 +#define SVCCTL_STATE_ALL ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE ) + +/* SERVER_STATUS - CurrentState */ + +#define SVCCTL_STOPPED 0x00000001 +#define SVCCTL_START_PENDING 0x00000002 +#define SVCCTL_STOP_PENDING 0x00000003 +#define SVCCTL_RUNNING 0x00000004 +#define SVCCTL_CONTINUE_PENDING 0x00000005 +#define SVCCTL_PAUSE_PENDING 0x00000006 +#define SVCCTL_PAUSED 0x00000007 + +/* SERVER_STATUS - ControlAccepted */ + +#define SVCCTL_ACCEPT_STOP 0x00000001 +#define SVCCTL_ACCEPT_PAUSE_CONTINUE 0x00000002 +#define SVCCTL_ACCEPT_SHUTDOWN 0x00000004 +#define SVCCTL_ACCEPT_PARAMCHANGE 0x00000008 +#define SVCCTL_ACCEPT_NETBINDCHANGE 0x00000010 +#define SVCCTL_ACCEPT_HARDWAREPROFILECHANGE 0x00000020 +#define SVCCTL_ACCEPT_POWEREVENT 0x00000040 + +/* Service Controls */ + +#define SVCCTL_CONTROL_STOP 0x00000001 +#define SVCCTL_CONTROL_PAUSE 0x00000002 +#define SVCCTL_CONTROL_CONTINUE 0x00000003 + +/* utility structures for RPCs */ + +typedef struct { + uint32 type; + uint32 state; + uint32 controls_accepted; + uint32 win32_exit_code; + uint32 service_exit_code; + uint32 check_point; + uint32 wait_hint; +} SERVICE_STATUS; + +typedef struct { + UNISTR servicename; + UNISTR displayname; + SERVICE_STATUS status; +} ENUM_SERVICES_STATUS; + +typedef struct { + uint32 service_type; + uint32 start_type; + uint32 error_control; + UNISTR2 *executablepath; + UNISTR2 *loadordergroup; + uint32 tag_id; + UNISTR2 *dependencies; + UNISTR2 *startname; + UNISTR2 *displayname; +} SERVICE_CONFIG; + + +/* rpc structures */ + +/**************************/ + +typedef struct { + POLICY_HND handle; +} SVCCTL_Q_CLOSE_SERVICE; + +typedef struct { + WERROR status; +} SVCCTL_R_CLOSE_SERVICE; + +/**************************/ + +typedef struct { + UNISTR2 *servername; + UNISTR2 *database; + uint32 access; +} SVCCTL_Q_OPEN_SCMANAGER; + +typedef struct { + POLICY_HND handle; + WERROR status; +} SVCCTL_R_OPEN_SCMANAGER; + +/**************************/ + +typedef struct { + POLICY_HND handle; + UNISTR2 servicename; + uint32 display_name_len; +} SVCCTL_Q_GET_DISPLAY_NAME; + +typedef struct { + UNISTR2 displayname; + uint32 display_name_len; + WERROR status; +} SVCCTL_R_GET_DISPLAY_NAME; + +/**************************/ + +typedef struct { + POLICY_HND handle; + UNISTR2 servicename; + uint32 access; +} SVCCTL_Q_OPEN_SERVICE; + +typedef struct { + POLICY_HND handle; + WERROR status; +} SVCCTL_R_OPEN_SERVICE; + +/**************************/ + +typedef struct { + POLICY_HND handle; + uint32 parmcount; + UNISTR4_ARRAY *parameters; +} SVCCTL_Q_START_SERVICE; + +typedef struct { + WERROR status; +} SVCCTL_R_START_SERVICE; + +/**************************/ + +typedef struct { + POLICY_HND handle; + uint32 control; +} SVCCTL_Q_CONTROL_SERVICE; + +typedef struct { + SERVICE_STATUS svc_status; + WERROR status; +} SVCCTL_R_CONTROL_SERVICE; + +/**************************/ + +typedef struct { + POLICY_HND handle; +} SVCCTL_Q_QUERY_STATUS; + +typedef struct { + SERVICE_STATUS svc_status; + WERROR status; +} SVCCTL_R_QUERY_STATUS; + +/**************************/ + +typedef struct { + POLICY_HND handle; + uint32 type; + uint32 state; + uint32 buffer_size; + uint32 *resume; +} SVCCTL_Q_ENUM_SERVICES_STATUS; + +typedef struct { + RPC_BUFFER buffer; + uint32 needed; + uint32 returned; + uint32 *resume; + WERROR status; +} SVCCTL_R_ENUM_SERVICES_STATUS; + +/**************************/ + +typedef struct { + POLICY_HND handle; + uint32 state; + uint32 buffer_size; +} SVCCTL_Q_ENUM_DEPENDENT_SERVICES; + +typedef struct { + RPC_BUFFER buffer; + uint32 needed; + uint32 returned; + WERROR status; +} SVCCTL_R_ENUM_DEPENDENT_SERVICES; + +/**************************/ + +typedef struct { + POLICY_HND handle; + uint32 buffer_size; +} SVCCTL_Q_QUERY_SERVICE_CONFIG; + +typedef struct { + SERVICE_CONFIG config; + uint32 needed; + WERROR status; +} SVCCTL_R_QUERY_SERVICE_CONFIG; + +#endif /* _RPC_SVCCTL_H */ + diff --git a/source/include/smb.h b/source/include/smb.h index 91ec52df237..f96d79fd063 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -103,6 +103,7 @@ typedef int BOOL; #define DOS_OPEN_RDONLY 0 #define DOS_OPEN_WRONLY 1 #define DOS_OPEN_RDWR 2 +#define DOS_OPEN_EXEC 3 #define DOS_OPEN_FCB 0xF /* define shifts and masks for share and open modes. */ @@ -193,6 +194,9 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN]; #define PIPE_NETDFS "\\PIPE\\netdfs" #define PIPE_ECHO "\\PIPE\\rpcecho" #define PIPE_SHUTDOWN "\\PIPE\\initshutdown" +#define PIPE_EPM "\\PIPE\\epmapper" +#define PIPE_SVCCTL "\\PIPE\\svcctl" +#define PIPE_EVENTLOG "\\PIPE\\eventlog" #define PIPE_NETLOGON_PLAIN "\\NETLOGON" @@ -207,7 +211,9 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN]; #define PI_NETDFS 8 #define PI_ECHO 9 #define PI_SHUTDOWN 10 -#define PI_MAX_PIPES 11 +#define PI_SVCCTL 11 +#define PI_EVENTLOG 12 +#define PI_MAX_PIPES 13 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ typedef struct nttime_info @@ -281,10 +287,28 @@ typedef struct sid_info } DOM_SID; -typedef struct sid_list { - uint32 count; - DOM_SID *list; -} SID_LIST; +/* Some well-known SIDs */ +extern const DOM_SID global_sid_World_Domain; +extern const DOM_SID global_sid_World; +extern const DOM_SID global_sid_Creator_Owner_Domain; +extern const DOM_SID global_sid_NT_Authority; +extern const DOM_SID global_sid_System; +extern const DOM_SID global_sid_NULL; +extern const DOM_SID global_sid_Authenticated_Users; +extern const DOM_SID global_sid_Network; +extern const DOM_SID global_sid_Creator_Owner; +extern const DOM_SID global_sid_Creator_Group; +extern const DOM_SID global_sid_Anonymous; +extern const DOM_SID global_sid_Builtin; +extern const DOM_SID global_sid_Builtin_Administrators; +extern const DOM_SID global_sid_Builtin_Users; +extern const DOM_SID global_sid_Builtin_Guests; +extern const DOM_SID global_sid_Builtin_Power_Users; +extern const DOM_SID global_sid_Builtin_Account_Operators; +extern const DOM_SID global_sid_Builtin_Server_Operators; +extern const DOM_SID global_sid_Builtin_Print_Operators; +extern const DOM_SID global_sid_Builtin_Backup_Operators; +extern const DOM_SID global_sid_Builtin_Replicator; /* * The complete list of SIDS belonging to this user. @@ -355,14 +379,14 @@ typedef struct time_info } UTIME; /* Structure used when SMBwritebmpx is active */ -typedef struct -{ - size_t wr_total_written; /* So we know when to discard this */ - int32 wr_timeout; - int32 wr_errclass; - int32 wr_error; /* Cached errors */ - BOOL wr_mode; /* write through mode) */ - BOOL wr_discard; /* discard all further data */ +typedef struct { + size_t wr_total_written; /* So we know when to discard this */ + int32 wr_timeout; + int32 wr_errclass; /* Cached errors */ + int32 wr_error; /* Cached errors */ + NTSTATUS wr_status; /* Cached errors */ + BOOL wr_mode; /* write through mode) */ + BOOL wr_discard; /* discard all further data */ } write_bmpx_struct; typedef struct write_cache @@ -388,6 +412,7 @@ typedef struct files_struct { int fnum; struct connection_struct *conn; int fd; + unsigned int num_smb_operations; uint16 rap_print_jobid; SMB_DEV_T dev; SMB_INO_T inode; @@ -509,6 +534,7 @@ typedef struct connection_struct time_t lastused; BOOL used; int num_files_open; + unsigned int num_smb_operations; /* Count of smb operations on this tree. */ BOOL case_sensitive; BOOL case_preserve; @@ -1382,13 +1408,6 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; */ #define COPYBUF_SIZE (8*1024) -/* - * Values used to override error codes. - */ -extern int unix_ERR_class; -extern int unix_ERR_code; -extern NTSTATUS unix_ERR_ntstatus; - /* * Used in chaining code. */ @@ -1717,6 +1736,11 @@ struct ea_struct { DATA_BLOB value; }; +struct ea_list { + struct ea_list *next, *prev; + struct ea_struct ea; +}; + /* EA names used internally in Samba. KEEP UP TO DATE with prohibited_ea_names in trans2.c !. */ #define SAMBA_POSIX_INHERITANCE_EA_NAME "user.SAMBA_PAI" /* EA to use for DOS attributes */ diff --git a/source/include/smb_macros.h b/source/include/smb_macros.h index de8d5b011f0..6d1e382bb82 100644 --- a/source/include/smb_macros.h +++ b/source/include/smb_macros.h @@ -43,7 +43,7 @@ * @note You are explicitly allowed to pass NULL pointers -- they will * always be ignored. **/ -#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) +#define SAFE_FREE(x) do { if ((x) != NULL) {free(CONST_DISCARD(void *, (x))); x=NULL;} } while(0) #endif /* zero a structure */ @@ -83,20 +83,25 @@ #define OPEN_CONN(conn) ((conn) && (conn)->open) #define IS_IPC(conn) ((conn) && (conn)->ipc) #define IS_PRINT(conn) ((conn) && (conn)->printer) +/* you must add the following extern declaration to files using this macro + * extern struct current_user current_user; + */ #define FSP_BELONGS_CONN(fsp,conn) do {\ - extern struct current_user current_user;\ if (!((fsp) && (conn) && ((conn)==(fsp)->conn) && (current_user.vuid==(fsp)->vuid))) \ return(ERROR_DOS(ERRDOS,ERRbadfid));\ } while(0) #define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn && current_user.vuid==(fsp)->vuid) +/* you must add the following extern declaration to files using this macro + * extern struct current_user current_user; + */ #define CHECK_FSP(fsp,conn) do {\ - extern struct current_user current_user;\ if (!FNUM_OK(fsp,conn)) \ return(ERROR_DOS(ERRDOS,ERRbadfid)); \ else if((fsp)->fd == -1) \ return(ERROR_DOS(ERRDOS,ERRbadaccess));\ + (fsp)->num_smb_operations++;\ } while(0) #define CHECK_READ(fsp) if (!(fsp)->can_read) \ @@ -104,9 +109,6 @@ #define CHECK_WRITE(fsp) if (!(fsp)->can_write) \ return(ERROR_DOS(ERRDOS,ERRbadaccess)) -#define CHECK_ERROR(fsp) if (HAS_CACHED_ERROR(fsp)) \ - return(CACHED_ERROR(fsp)) - #define ERROR_WAS_LOCK_DENIED(status) (NT_STATUS_EQUAL((status), NT_STATUS_LOCK_NOT_GRANTED) || \ NT_STATUS_EQUAL((status), NT_STATUS_FILE_LOCK_CONFLICT) ) @@ -165,25 +167,23 @@ #define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx))) #define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx))) -/* Macro to cache an error in a write_bmpx_struct */ -#define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \ - w->wr_discard = True, -1) /* Macro to test if an error has been cached for this fnum */ #define HAS_CACHED_ERROR(fsp) ((fsp)->wbmpx_ptr && \ (fsp)->wbmpx_ptr->wr_discard) /* Macro to turn the cached error into an error packet */ #define CACHED_ERROR(fsp) cached_error_packet(outbuf,fsp,__LINE__,__FILE__) -/* these are the datagram types */ -#define DGRAM_DIRECT_UNIQUE 0x10 - -#define ERROR_DOS(class,code) error_packet(outbuf,NT_STATUS_OK,class,code,False,__LINE__,__FILE__) -#define ERROR_FORCE_DOS(class,code) error_packet(outbuf,NT_STATUS_OK,class,code,True,__LINE__,__FILE__) -#define ERROR_NT(status) error_packet(outbuf,status,0,0,False,__LINE__,__FILE__) -#define ERROR_BOTH(status,class,code) error_packet(outbuf,status,class,code,False,__LINE__,__FILE__) +#define ERROR_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__) +#define ERROR_FORCE_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_INVALID,__LINE__,__FILE__) +#define ERROR_NT(status) error_packet(outbuf,0,0,status,__LINE__,__FILE__) +#define ERROR_FORCE_NT(status) error_packet(outbuf,-1,-1,status,__LINE__,__FILE__) +#define ERROR_BOTH(status,class,code) error_packet(outbuf,class,code,status,__LINE__,__FILE__) /* this is how errors are generated */ -#define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,__LINE__,__FILE__) +#define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,NT_STATUS_OK,__LINE__,__FILE__) + +/* these are the datagram types */ +#define DGRAM_DIRECT_UNIQUE 0x10 #define SMB_ROUNDUP(x,r) ( ((x)%(r)) ? ( (((x)+(r))/(r))*(r) ) : (x)) @@ -297,6 +297,8 @@ copy an IP address from one buffer to another #define TALLOC_REALLOC_ARRAY(ctx, ptr, type, count) (type *)talloc_realloc_array_((ctx),(ptr),sizeof(type),(count)) #define PRS_ALLOC_MEM(ps, type, count) (type *)prs_alloc_mem_((ps),sizeof(type),(count)) +#define PRS_ALLOC_MEM_VOID(ps, size) prs_alloc_mem_((ps),(size),1) + /* Get medieval on our ass about malloc.... */ @@ -345,6 +347,7 @@ copy an IP address from one buffer to another #define TALLOC_REALLOC_ARRAY(ctx, ptr, type, count) (type *)talloc_realloc_array((ctx),(ptr),sizeof(type),(count)) #define PRS_ALLOC_MEM(ps, type, count) (type *)prs_alloc_mem((ps),sizeof(type),(count)) +#define PRS_ALLOC_MEM_VOID(ps, size) prs_alloc_mem((ps),(size),1) /* Regular malloc code. */ @@ -356,4 +359,17 @@ copy an IP address from one buffer to another #endif +#define ADD_TO_ARRAY(mem_ctx, type, elem, array, num) \ +do { \ + *(array) = ((mem_ctx) != NULL) ? \ + TALLOC_REALLOC_ARRAY(mem_ctx, (*(array)), type, (*(num))+1) : \ + SMB_REALLOC_ARRAY((*(array)), type, (*(num))+1); \ + SMB_ASSERT((*(array)) != NULL); \ + (*(array))[*(num)] = (elem); \ + (*(num)) += 1; \ +} while (0) + +#define ADD_TO_LARGE_ARRAY(mem_ctx, type, elem, array, num, size) \ + add_to_large_array((mem_ctx), sizeof(type), &(elem), (void **)(array), (num), (size)); + #endif /* _SMB_MACROS_H */ diff --git a/source/include/smbldap.h b/source/include/smbldap.h index e6a6a1b7c68..b54b3f43256 100644 --- a/source/include/smbldap.h +++ b/source/include/smbldap.h @@ -185,5 +185,6 @@ struct ldapsam_privates { struct smbldap_state; #define LDAP_CONNECT_DEFAULT_TIMEOUT 15 +#define LDAP_PAGE_SIZE 1024 #endif /* _SMBLDAP_H */ diff --git a/source/include/trans2.h b/source/include/trans2.h index 68358344f4e..2aae1137dd7 100644 --- a/source/include/trans2.h +++ b/source/include/trans2.h @@ -226,6 +226,9 @@ Byte offset Type name description #define SMB_QUERY_FILE_STREAM_INFO 0x109 #define SMB_QUERY_COMPRESSION_INFO 0x10b +#define SMB_FIND_INFO_STANDARD 1 +#define SMB_FIND_EA_SIZE 2 +#define SMB_FIND_EA_LIST 3 #define SMB_FIND_FILE_DIRECTORY_INFO 0x101 #define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 #define SMB_FIND_FILE_NAMES_INFO 0x103 @@ -437,6 +440,9 @@ Offset Size Name #define SMB_QUERY_XATTR 0x205 /* need for non-user XATTRs */ #define SMB_QUERY_ATTR_FLAGS 0x206 /* chflags, chattr */ #define SMB_SET_ATTR_FLAGS 0x206 +#define SMB_QUERY_POSIX_PERMISSION 0x207 +#define SMB_QUERY_POSIX_LOCK 0x208 +#define SMB_SET_POSIX_LOCK 0x208 /* Transact 2 Find First levels */ #define SMB_FIND_FILE_UNIX 0x202 @@ -461,6 +467,12 @@ Offset Size Name #define CIFS_UNIX_FCNTL_LOCKS_CAP 0x1 #define CIFS_UNIX_POSIX_ACLS_CAP 0x2 +#define CIFS_UNIX_XATTTR_CAP 0x4 /* for support of other xattr + namespaces such as system, + security and trusted */ +#define CIFS_UNIX_EXTATTR_CAP 0x8 /* for support of chattr + (chflags) and lsattr */ + #define SMB_QUERY_POSIX_FS_INFO 0x201 |