📄 libmsrpc.h
字号:
/* * Unix SMB/CIFS implementation. * MS-RPC client library API definitions/prototypes * * Copyright (C) Chris Nicholls 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 LIBMSRPC_H#define LIBMSRPC_H#include "includes.h"#include "libsmbclient.h"#include "libsmb_internal.h"/*server capability levels*/#define SRV_WIN_NT4 1#define SRV_WIN_2K 2#define SRV_WIN_2K_SP3 3#define SRV_WIN_2K3 4/**@defgroup handle Server Handle*//**@defgroup Library_Functions Library/Utility Functions*//**@defgroup lsa_defs LSA Definitions*//**@defgroup LSA_Functions LSA Functions*//**@defgroup reg_defs Registry Definitions*//**@defgroup Reg_Functions Registry Functions*//**@defgroup sam_defs SAM Definitions*//**@defgroup SAM_Functions SAM Functions*//**@defgroup svc_defs Service Control Definitions*//**@defgroup SCM_Functions Service Control Functions*//**Operation was unsuccessful*/#define CAC_FAILURE 0/**Operation was successful*/#define CAC_SUCCESS 1/**Operation was only partially successful * an example of this is if you try to lookup a list of accounts to SIDs and not all accounts can be resolved*/#define CAC_PARTIAL_SUCCESS 2/**@ingroup CAC_errors Use this to see if the last operation failed - useful for enumeration functions that use multiple calls*/#define CAC_OP_FAILED(status) !NT_STATUS_IS_OK(status) && \ NT_STATUS_V(status) != NT_STATUS_V(STATUS_SOME_UNMAPPED) && \ NT_STATUS_V(status) != NT_STATUS_V(STATUS_NO_MORE_FILES) && \ NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_NO_MORE_ENTRIES) && \ NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_NONE_MAPPED) && \ NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_GUIDS_EXHAUSTED)/**Privilege string constants*/#define CAC_SE_CREATE_TOKEN "SeCreateTokenPrivilege"#define CAC_SE_ASSIGN_PRIMARY_TOKEN "SeAssignPrimaryTokenPrivilege"#define CAC_SE_LOCK_MEMORY "SeLockMemoryPrivilege"#define CAC_SE_INCREASE_QUOTA "SeIncreaseQuotaPrivilege"#define CAC_SE_MACHINE_ACCOUNT "SeMachineAccountPrivilege"#define CAC_SE_TCB "SeTcbPrivilege"#define CAC_SE_SECURITY "SeSecurityPrivilege"#define CAC_SE_TAKE_OWNERSHIP "SeTakeOwnershipPrivilege"#define CAC_SE_LOAD_DRIVER "SeLoadDriverPrivilege"#define CAC_SE_SYSTEM_PROFILE "SeSystemProfilePrivilege"#define CAC_SE_SYSTEM_TIME "SeSystemtimePrivilege"#define CAC_SE_PROFILE_SINGLE_PROC "SeProfileSingleProcessPrivilege"#define CAC_SE_INCREASE_BASE_PRIORITY "SeIncreaseBasePriorityPrivilege"#define CAC_SE_CREATE_PAGEFILE "SeCreatePagefilePrivilege"#define CAC_SE_CREATE_PERMANENT "SeCreatePermanentPrivilege"#define CAC_SE_BACKUP "SeBackupPrivilege"#define CAC_SE_RESTORE "SeRestorePrivilege"#define CAC_SE_SHUTDOWN "SeShutdownPrivilege"#define CAC_SE_DEBUG "SeDebugPrivilege"#define CAC_SE_AUDIT "SeAuditPrivilege"#define CAC_SE_SYSTEM_ENV "SeSystemEnvironmentPrivilege"#define CAC_SE_CHANGE_NOTIFY "SeChangeNotifyPrivilege"#define CAC_SE_REMOTE_SHUTDOWN "SeRemoteShutdownPrivilege"#define CAC_SE_UNDOCK "SeUndockPrivilege"#define CAC_SE_SYNC_AGENT "SeSyncAgentPrivilege"#define CAC_SE_ENABLE_DELEGATION "SeEnableDelegationPrivilege"#define CAC_SE_MANAGE_VOLUME "SeManageVolumePrivilege"#define CAC_SE_IMPERSONATE "SeImpersonatePrivilege"#define CAC_SE_CREATE_GLOBAL "SeCreateGlobalPrivilege"#define CAC_SE_PRINT_OPERATOR "SePrintOperatorPrivilege"#define CAC_SE_NETWORK_LOGON "SeNetworkLogonRight"#define CAC_SE_INTERACTIVE_LOGON "SeInteractiveLogonRight"#define CAC_SE_BATCH_LOGON "SeBatchLogonRight"#define CAC_SE_SERVICE_LOGON "SeServiceLogonRight"#define CAC_SE_ADD_USERS "SeAddUsersPrivilege"#define CAC_SE_DISK_OPERATOR "SeDiskOperatorPrivilege"/** * @addtogroup lsa_defs * @{ *//**used to specify what data to retrieve using cac_LsaQueryTrustedDomainInformation*/#define CAC_INFO_TRUSTED_DOMAIN_NAME 0x1#define CAC_INFO_TRUSTED_DOMAIN_POSIX_OFFSET 0x3#define CAC_INFO_TRUSTED_DOMAIN_PASSWORD 0x4/**Used when requesting machine domain information*/#define CAC_DOMAIN_INFO 0x0003/**Used when requesting machine local information*/#define CAC_LOCAL_INFO 0x0005/**Stores information about a SID*/typedef struct _CACSIDINFO { /**The actual SID*/ DOM_SID sid; /**The name of the object which maps to this SID*/ char *name; /**The domain the SID belongs to*/ char *domain;} CacSidInfo;/* @} *//** * @addtogroup reg_defs * @{ *//**Null terminated string*/typedef char* REG_SZ_DATA;/**Null terminated string with windows environment variables that should be expanded*/typedef char* REG_EXPAND_SZ_DATA;/**Binary data of some kind*/typedef struct _REGBINARYDATA { uint32 data_length; uint8 * data;} REG_BINARY_DATA; /**32-bit (little endian) number*/typedef uint32 REG_DWORD_DATA;/**32-bit big endian number*/typedef uint32 REG_DWORD_BE_DATA;/**array of strings*/typedef struct _REGMULTISZDATA { uint32 num_strings; char **strings;} REG_MULTI_SZ_DATA;typedef union _REGVALUEDATA { REG_SZ_DATA reg_sz; REG_EXPAND_SZ_DATA reg_expand_sz; REG_BINARY_DATA reg_binary; REG_DWORD_DATA reg_dword; REG_DWORD_BE_DATA reg_dword_be; REG_MULTI_SZ_DATA reg_multi_sz;} REG_VALUE_DATA;/**@}*//** * @addtogroup sam_defs * @{ */#define CAC_USER_RID 0x1#define CAC_GROUP_RID 0x2typedef struct _CACLOOKUPRIDSRECORD { char *name; uint32 rid; /**If found, this will be one of: * - CAC_USER_RID * - CAC_GROUP_RID */ uint32 type; /*if the name or RID was looked up, then found = True*/ BOOL found;} CacLookupRidsRecord;typedef struct _CACUSERINFO { /**Last logon time*/ time_t logon_time; /**Last logoff time*/ time_t logoff_time; /**Last kickoff time*/ time_t kickoff_time; /**Last password set time*/ time_t pass_last_set_time; /**Time password can change*/ time_t pass_can_change_time; /**Time password must change*/ time_t pass_must_change_time; /**LM user password*/ uint8 lm_password[8]; /**NT user password*/ uint8 nt_password[8]; /**User's RID*/ uint32 rid; /**RID of primary group*/ uint32 group_rid; /**User's ACB mask*/ uint32 acb_mask; /**Bad password count*/ uint16 bad_passwd_count; /**Number of logons*/ uint16 logon_count; /**Change password at next logon?*/ BOOL pass_must_change; /**Username*/ char *username; /**User's full name*/ char *full_name; /**User's home directory*/ char *home_dir; /**Home directory drive*/ char *home_drive; /**Logon script*/ char *logon_script; /**Path to profile*/ char *profile_path; /**Account description*/ char *description; /**Login from workstations*/ char *workstations; char *dial; /**Possible logon hours*/ LOGON_HRS *logon_hours;} CacUserInfo;typedef struct _CACGROUPINFO { /**Group name*/ char *name; /**Description*/ char *description; /**Number of members*/ uint32 num_members;} CacGroupInfo, CacAliasInfo;/**Represents a period (duration) of time*/typedef struct _CACTIME { /**Number of days*/ uint32 days; /**Number of hours*/ uint32 hours; /**Number of minutes*/ uint32 minutes; /**number of seconds*/ uint32 seconds;} CacTime;typedef struct _CACDOMINFO { /**The server role. Should be one of: * ROLE_STANDALONE * ROLE_DOMAIN_MEMBER * ROLE_DOMAIN_BDC * ROLE_DOMAIN_PDC * see include/smb.h */ uint32 server_role; /**Number of domain users*/ uint32 num_users; /**Number of domain groups*/ uint32 num_domain_groups; /**Number of local groups*/ uint32 num_local_groups; /**Comment*/ char *comment; /**Domain name*/ char *domain_name; /**Server name*/ char *server_name; /**Minimum password length*/ uint16 min_pass_length; /**How many previous passwords to remember - ie, password cannot be the same as N previous passwords*/ uint16 pass_history; /**How long (from now) before passwords expire*/ CacTime expire; /**How long (from now) before passwords can be changed*/ CacTime min_pass_age; /**How long users are locked out for too many bad password attempts*/ CacTime lockout_duration; /**How long before lockouts are reset*/ CacTime lockout_reset; /**How many bad password attempts before lockout occurs*/ uint16 num_bad_attempts;} CacDomainInfo;/**@}*/ /*sam_defs*//**@addtogroup svc_defs * @{ */typedef struct _CACSERVICE { /**The service name*/ char *service_name; /**The display name of the service*/ char *display_name; /**Current status of the service - see include/rpc_svcctl.h for SERVICE_STATUS definition*/ SERVICE_STATUS status;} CacService;typedef struct __CACSERVICECONFIG { /**The service type*/ uint32 type; /**The start type. Should be one of: * - SVCCTL_BOOT_START * - SVCCTL_SYSTEM_START * - SVCCTL_AUTO_START * - SVCCTL_DEMAND_START */ uint32 start_type; uint32 error_control; /**Path to executable*/ char *exe_path; /***/ char *load_order_group; uint32 tag_id; /**Any dependencies for the service*/ char *dependencies; /**Run as...*/ char *start_name; /**Service display name*/ char *display_name; } CacServiceConfig;/**@}*/ /*svc_defs*/#include "libmsrpc_internal.h"/** * @addtogroup handle * @{ *//** * Server handle used to keep track of client/server/pipe information. Use cac_NewServerHandle() to allocate. * Initiliaze as many values as possible before calling cac_Connect(). * * @note When allocating memory for the fields, use SMB_MALLOC() (or equivalent) instead of talloc() (or equivalent) - * If memory is not allocated for a field, cac_Connect will allocate sizeof(fstring) bytes for it. * * @note It may be wise to allocate large buffers for these fields and strcpy data into them. * * @see cac_NewServerHandle() * @see cac_FreeHandle() */typedef struct _CACSERVERHANDLE { /** debug level */ int debug; /** netbios name used to make connections */ char *netbios_name; /** domain name used to make connections */ char *domain; /** username used to make connections */ char *username; /** user's password plain text string
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -