diff options
37 files changed, 712 insertions, 1155 deletions
diff --git a/docs-xml/smbdotconf/misc/socketaddress.xml b/docs-xml/smbdotconf/misc/socketaddress.xml index 7566380e70..17018efd40 100644 --- a/docs-xml/smbdotconf/misc/socketaddress.xml +++ b/docs-xml/smbdotconf/misc/socketaddress.xml @@ -4,12 +4,14 @@ developer="1" xmlns:samba="http://www.samba.org/samba/DTD/samba-doc"> <description> - <para>This option allows you to control what - address Samba will listen for connections on. This is used to - support multiple virtual interfaces on the one server, each + <para>This option allows you to control what + address Samba will listen for connections on. This is used to + support multiple virtual interfaces on the one server, each with a different configuration.</para> - - <para>By default Samba will accept connections on any + <para>Setting this option should never be necessary on usual Samba + servers running only one nmbd.</para> + + <para>By default Samba will accept connections on any address.</para> </description> diff --git a/source3/client/client.c b/source3/client/client.c index da789161c9..c88b918dc8 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -218,13 +218,12 @@ static int readfile(char *b, int n, XFILE *f) Send a message. ****************************************************************************/ -static void send_message(void) +static void send_message(const char *username) { int total_len = 0; int grp_id; - if (!cli_message_start(cli, desthost, - get_cmdline_auth_info_username(), &grp_id)) { + if (!cli_message_start(cli, desthost, username, &grp_id)) { d_printf("message start: %s\n", cli_errstr(cli)); return; } @@ -4607,7 +4606,7 @@ static int do_tar_op(const char *base_directory) Handle a message operation. ****************************************************************************/ -static int do_message_op(void) +static int do_message_op(struct user_auth_info *auth_info) { struct sockaddr_storage ss; struct nmb_name called, calling; @@ -4648,7 +4647,7 @@ static int do_message_op(void) return 1; } - send_message(); + send_message(get_cmdline_auth_info_username(auth_info)); cli_cm_shutdown(); return 0; @@ -4695,6 +4694,7 @@ static int do_message_op(void) POPT_TABLEEND }; TALLOC_CTX *frame = talloc_stackframe(); + struct user_auth_info *auth_info; if (!client_set_cur_dir("\\")) { exit(ENOMEM); @@ -4724,6 +4724,12 @@ static int do_message_op(void) load_case_tables(); + auth_info = user_auth_info_init(frame); + if (auth_info == NULL) { + exit(1); + } + popt_common_set_auth_info(auth_info); + /* skip argv(0) */ pc = poptGetContext("smbclient", argc, (const char **) argv, long_options, 0); poptSetOtherOptionHelp(pc, "service <password>"); @@ -4751,8 +4757,11 @@ static int do_message_op(void) } /* if the service has already been retrieved then check if we have also a password */ - if (service_opt && (!get_cmdline_auth_info_got_pass()) && poptPeekArg(pc)) { - set_cmdline_auth_info_password(poptGetArg(pc)); + if (service_opt + && (!get_cmdline_auth_info_got_pass(auth_info)) + && poptPeekArg(pc)) { + set_cmdline_auth_info_password(auth_info, + poptGetArg(pc)); } switch (opt) { @@ -4858,8 +4867,11 @@ static int do_message_op(void) } /* if the service has already been retrieved then check if we have also a password */ - if (service_opt && !get_cmdline_auth_info_got_pass() && poptPeekArg(pc)) { - set_cmdline_auth_info_password(poptGetArg(pc)); + if (service_opt + && !get_cmdline_auth_info_got_pass(auth_info) + && poptPeekArg(pc)) { + set_cmdline_auth_info_password(auth_info, + poptGetArg(pc)); } /* check for the -P option */ @@ -4893,8 +4905,8 @@ static int do_message_op(void) argv[0], get_dyn_CONFIGFILE()); } - if (get_cmdline_auth_info_use_machine_account() && - !set_cmdline_auth_info_machine_account_creds()) { + if (get_cmdline_auth_info_use_machine_account(auth_info) && + !set_cmdline_auth_info_machine_account_creds(auth_info)) { exit(-1); } @@ -4929,7 +4941,7 @@ static int do_message_op(void) calling_name = talloc_strdup(frame, global_myname() ); } - smb_encrypt = get_cmdline_auth_info_smb_encrypt(); + smb_encrypt = get_cmdline_auth_info_smb_encrypt(auth_info); if (!init_names()) { fprintf(stderr, "init_names() failed\n"); exit(1); @@ -4947,7 +4959,7 @@ static int do_message_op(void) /* Store the username and password for dfs support */ - cli_cm_set_credentials(); + cli_cm_set_credentials(auth_info); DEBUG(3,("Client started (version %s).\n", SAMBA_VERSION_STRING)); @@ -4980,7 +4992,7 @@ static int do_message_op(void) } if (message) { - return do_message_op(); + return do_message_op(auth_info); } if (process(base_directory)) { diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c index 0bc61ae38f..9f4d1d3fd0 100644 --- a/source3/client/mount.cifs.c +++ b/source3/client/mount.cifs.c @@ -80,6 +80,9 @@ #define MOUNT_PASSWD_SIZE 64 #define DOMAIN_SIZE 64 +/* currently maximum length of IPv6 address string */ +#define MAX_ADDRESS_LEN INET6_ADDRSTRLEN + const char *thisprogram; int verboseflag = 0; static int got_password = 0; @@ -189,12 +192,6 @@ static char * getusername(void) { return username; } -static char * parse_cifs_url(char * unc_name) -{ - printf("\nMounting cifs URL not implemented yet. Attempt to mount %s\n",unc_name); - return NULL; -} - static int open_cred_file(char * file_name) { char * line_buf; @@ -494,7 +491,7 @@ static int parse_options(char ** optionsp, int * filesys_flags) } else if (strncmp(data, "ip", 2) == 0) { if (!value || !*value) { printf("target ip address argument missing"); - } else if (strnlen(value, 35) < 35) { + } else if (strnlen(value, MAX_ADDRESS_LEN) <= MAX_ADDRESS_LEN) { if(verboseflag) printf("ip address %s override specified\n",value); got_ip = 1; @@ -882,23 +879,23 @@ static void replace_char(char *string, char from, char to, int maxlen) } /* Note that caller frees the returned buffer if necessary */ -static char * parse_server(char ** punc_name) +static struct addrinfo * +parse_server(char ** punc_name) { char * unc_name = *punc_name; int length = strnlen(unc_name, MAX_UNC_LEN); char * share; - char * ipaddress_string = NULL; - struct hostent * host_entry = NULL; - struct in_addr server_ipaddr; + struct addrinfo *addrlist; + int rc; if(length > (MAX_UNC_LEN - 1)) { printf("mount error: UNC name too long"); return NULL; } - if (strncasecmp("cifs://",unc_name,7) == 0) - return parse_cifs_url(unc_name+7); - if (strncasecmp("smb://",unc_name,6) == 0) { - return parse_cifs_url(unc_name+6); + if ((strncasecmp("cifs://", unc_name, 7) == 0) || + (strncasecmp("smb://", unc_name, 6) == 0)) { + printf("\nMounting cifs URL not implemented yet. Attempt to mount %s\n", unc_name); + return NULL; } if(length < 3) { @@ -939,7 +936,12 @@ continue_unc_parsing: *share = 0; /* temporarily terminate the string */ share += 1; if(got_ip == 0) { - host_entry = gethostbyname(unc_name); + rc = getaddrinfo(unc_name, NULL, NULL, &addrlist); + if (rc != 0) { + printf("mount error: could not resolve address for %s: %s\n", + unc_name, gai_strerror(rc)); + addrlist = NULL; + } } *(share - 1) = '/'; /* put delimiter back */ @@ -954,23 +956,9 @@ continue_unc_parsing: printf("ip address specified explicitly\n"); return NULL; } - if(host_entry == NULL) { - printf("mount error: could not find target server. TCP name %s not found\n", unc_name); - return NULL; - } else { - /* BB should we pass an alternate version of the share name as Unicode */ - /* BB what about ipv6? BB */ - /* BB add retries with alternate servers in list */ + /* BB should we pass an alternate version of the share name as Unicode */ - memcpy(&server_ipaddr.s_addr, host_entry->h_addr, 4); - - ipaddress_string = inet_ntoa(server_ipaddr); - if(ipaddress_string == NULL) { - printf("mount error: could not get valid ip address for target server\n"); - return NULL; - } - return ipaddress_string; - } + return addrlist; } else { /* BB add code to find DFS root (send null path on get DFS Referral to specified server here */ printf("Mounting the DFS root for a particular server not implemented yet\n"); @@ -1034,10 +1022,11 @@ int main(int argc, char ** argv) int flags = MS_MANDLOCK; /* no need to set legacy MS_MGC_VAL */ char * orgoptions = NULL; char * share_name = NULL; - char * ipaddr = NULL; + const char * ipaddr = NULL; char * uuid = NULL; char * mountpoint = NULL; char * options = NULL; + char * optionstail; char * resolved_path = NULL; char * temp; char * dev_name; @@ -1050,10 +1039,14 @@ int main(int argc, char ** argv) int optlen = 0; int orgoptlen = 0; size_t options_size = 0; + size_t current_len; int retry = 0; /* set when we have to retry mount with uppercase */ + struct addrinfo *addrhead = NULL, *addr; struct stat statbuf; struct utsname sysinfo; struct mntent mountent; + struct sockaddr_in *addr4; + struct sockaddr_in6 *addr6; FILE * pmntfile; /* setlocale(LC_ALL, ""); @@ -1245,8 +1238,8 @@ int main(int argc, char ** argv) rc = EX_USAGE; goto mount_exit; } - ipaddr = parse_server(&share_name); - if((ipaddr == NULL) && (got_ip == 0)) { + addrhead = addr = parse_server(&share_name); + if((addrhead == NULL) && (got_ip == 0)) { printf("No ip address specified and hostname not found\n"); rc = EX_USAGE; goto mount_exit; @@ -1316,7 +1309,6 @@ int main(int argc, char ** argv) } /* FIXME launch daemon (handles dfs name resolution and credential change) remember to clear parms and overwrite password field before launching */ -mount_retry: if(orgoptions) { optlen = strlen(orgoptions); orgoptlen = optlen; @@ -1331,10 +1323,10 @@ mount_retry: } if(user_name) optlen += strlen(user_name) + 6; - if(ipaddr) - optlen += strlen(ipaddr) + 4; + optlen += MAX_ADDRESS_LEN + 4; if(mountpassword) optlen += strlen(mountpassword) + 6; +mount_retry: SAFE_FREE(options); options_size = optlen + 10 + DOMAIN_SIZE; options = (char *)malloc(options_size /* space for commas in password */ + 8 /* space for domain= , domain name itself was counted as part of the length username string above */); @@ -1344,18 +1336,12 @@ mount_retry: exit(EX_SYSERR); } - options[0] = 0; - strlcpy(options,"unc=",options_size); + strlcpy(options, "unc=", options_size); strlcat(options,share_name,options_size); /* scan backwards and reverse direction of slash */ temp = strrchr(options, '/'); if(temp > options + 6) *temp = '\\'; - if(ipaddr) { - strlcat(options,",ip=",options_size); - strlcat(options,ipaddr,options_size); - } - if(user_name) { /* check for syntax like user=domain\user */ if(got_domain == 0) @@ -1397,11 +1383,42 @@ mount_retry: /* convert all '\\' to '/' in share portion so that /proc/mounts looks pretty */ replace_char(dev_name, '\\', '/', strlen(share_name)); - if(mount(dev_name, mountpoint, "cifs", flags, options)) { - /* remember to kill daemon on error */ + if (!got_ip && addr) { + strlcat(options, ",ip=", options_size); + current_len = strnlen(options, options_size); + optionstail = options + current_len; + switch (addr->ai_addr->sa_family) { + case AF_INET6: + addr6 = (struct sockaddr_in6 *) addr->ai_addr; + ipaddr = inet_ntop(AF_INET6, &addr6->sin6_addr, optionstail, + options_size - current_len); + break; + case AF_INET: + addr4 = (struct sockaddr_in *) addr->ai_addr; + ipaddr = inet_ntop(AF_INET, &addr4->sin_addr, optionstail, + options_size - current_len); + break; + } + + /* if the address looks bogus, try the next one */ + if (!ipaddr) { + addr = addr->ai_next; + if (addr) + goto mount_retry; + rc = EX_SYSERR; + goto mount_exit; + } + } + + if (mount(dev_name, mountpoint, "cifs", flags, options)) { switch (errno) { - case 0: - printf("mount failed but no error number set\n"); + case ECONNREFUSED: + case EHOSTUNREACH: + if (addr) { + addr = addr->ai_next; + if (addr) + goto mount_retry; + } break; case ENODEV: printf("mount error: cifs filesystem not supported by the system\n"); @@ -1416,64 +1433,64 @@ mount_retry: goto mount_retry; } } - default: - printf("mount error %d = %s\n",errno,strerror(errno)); } + printf("mount error(%d): %s\n", errno, strerror(errno)); printf("Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)\n"); rc = EX_FAIL; - } else { - atexit(unlock_mtab); - rc = lock_mtab(); - if (rc) { - printf("cannot lock mtab"); - goto mount_exit; - } - pmntfile = setmntent(MOUNTED, "a+"); - if (!pmntfile) { - printf("could not update mount table\n"); - unlock_mtab(); - rc = EX_FILEIO; - goto mount_exit; - } - mountent.mnt_fsname = dev_name; - mountent.mnt_dir = mountpoint; - mountent.mnt_type = CONST_DISCARD(char *,"cifs"); - mountent.mnt_opts = (char *)malloc(220); - if(mountent.mnt_opts) { - char * mount_user = getusername(); - memset(mountent.mnt_opts,0,200); - if(flags & MS_RDONLY) - strlcat(mountent.mnt_opts,"ro",220); - else - strlcat(mountent.mnt_opts,"rw",220); - if(flags & MS_MANDLOCK) - strlcat(mountent.mnt_opts,",mand",220); - if(flags & MS_NOEXEC) - strlcat(mountent.mnt_opts,",noexec",220); - if(flags & MS_NOSUID) - strlcat(mountent.mnt_opts,",nosuid",220); - if(flags & MS_NODEV) - strlcat(mountent.mnt_opts,",nodev",220); - if(flags & MS_SYNCHRONOUS) - strlcat(mountent.mnt_opts,",sync",220); - if(mount_user) { - if(getuid() != 0) { - strlcat(mountent.mnt_opts, - ",user=", 220); - strlcat(mountent.mnt_opts, - mount_user, 220); - } + goto mount_exit; + } + + atexit(unlock_mtab); + rc = lock_mtab(); + if (rc) { + printf("cannot lock mtab"); + goto mount_exit; + } + pmntfile = setmntent(MOUNTED, "a+"); + if (!pmntfile) { + printf("could not update mount table\n"); + unlock_mtab(); + rc = EX_FILEIO; + goto mount_exit; + } + mountent.mnt_fsname = dev_name; + mountent.mnt_dir = mountpoint; + mountent.mnt_type = CONST_DISCARD(char *,"cifs"); + mountent.mnt_opts = (char *)malloc(220); + if(mountent.mnt_opts) { + char * mount_user = getusername(); + memset(mountent.mnt_opts,0,200); + if(flags & MS_RDONLY) + strlcat(mountent.mnt_opts,"ro",220); + else + strlcat(mountent.mnt_opts,"rw",220); + if(flags & MS_MANDLOCK) + strlcat(mountent.mnt_opts,",mand",220); + if(flags & MS_NOEXEC) + strlcat(mountent.mnt_opts,",noexec",220); + if(flags & MS_NOSUID) + strlcat(mountent.mnt_opts,",nosuid",220); + if(flags & MS_NODEV) + strlcat(mountent.mnt_opts,",nodev",220); + if(flags & MS_SYNCHRONOUS) + strlcat(mountent.mnt_opts,",sync",220); + if(mount_user) { + if(getuid() != 0) { + strlcat(mountent.mnt_opts, + ",user=", 220); + strlcat(mountent.mnt_opts, + mount_user, 220); } } - mountent.mnt_freq = 0; - mountent.mnt_passno = 0; - rc = addmntent(pmntfile,&mountent); - endmntent(pmntfile); - unlock_mtab(); - SAFE_FREE(mountent.mnt_opts); - if (rc) - rc = EX_FILEIO; } + mountent.mnt_freq = 0; + mountent.mnt_passno = 0; + rc = addmntent(pmntfile,&mountent); + endmntent(pmntfile); + unlock_mtab(); + SAFE_FREE(mountent.mnt_opts); + if (rc) + rc = EX_FILEIO; mount_exit: if(mountpassword) { int len = strlen(mountpassword); @@ -1481,6 +1498,8 @@ mount_exit: SAFE_FREE(mountpassword); } + if (addrhead) + freeaddrinfo(addrhead); SAFE_FREE(options); SAFE_FREE(orgoptions); SAFE_FREE(resolved_path); diff --git a/source3/include/ads.h b/source3/include/ads.h index b72d250940..abff9eaa8c 100644 --- a/source3/include/ads.h +++ b/source3/include/ads.h @@ -80,7 +80,6 @@ typedef struct ads_struct { char *server_site_name; char *client_site_name; time_t current_time; - int tried_closest_dc; char *schema_path; char *config_path; } config; diff --git a/source3/include/proto.h b/source3/include/proto.h index c813fafff5..6c6bba3a71 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -637,6 +637,7 @@ void pidfile_create(const char *program_name); /* The following definitions come from lib/popt_common.c */ +void popt_common_set_auth_info(struct user_auth_info *auth_info); /* The following definitions come from lib/privileges.c */ @@ -1139,22 +1140,28 @@ void gfree_all( void ); const char *my_netbios_names(int i); bool set_netbios_aliases(const char **str_array); bool init_names(void); -const char *get_cmdline_auth_info_username(void); -void set_cmdline_auth_info_username(const char *username); -const char *get_cmdline_auth_info_password(void); -void set_cmdline_auth_info_password(const char *password); -bool set_cmdline_auth_info_signing_state(const char *arg); -int get_cmdline_auth_info_signing_state(void); -void set_cmdline_auth_info_use_kerberos(bool b); -bool get_cmdline_auth_info_use_kerberos(void); -void set_cmdline_auth_info_use_krb5_ticket(void); -void set_cmdline_auth_info_smb_encrypt(void); -void set_cmdline_auth_info_use_machine_account(void); -bool get_cmdline_auth_info_got_pass(void); -bool get_cmdline_auth_info_smb_encrypt(void); -bool get_cmdline_auth_info_use_machine_account(void); -bool get_cmdline_auth_info_copy(struct user_auth_info *info); -bool set_cmdline_auth_info_machine_account_creds(void); +struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx); +const char *get_cmdline_auth_info_username(struct user_auth_info *auth_info); +void set_cmdline_auth_info_username(struct user_auth_info *auth_info, + const char *username); +void set_cmdline_auth_info_password(struct user_auth_info *auth_info, + const char *password); +const char *get_cmdline_auth_info_password(struct user_auth_info *auth_info); +bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info, + const char *arg); +int get_cmdline_auth_info_signing_state(struct user_auth_info *auth_info); +void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info, + bool b); +bool get_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info); +void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info); +void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info); +void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info); +bool get_cmdline_auth_info_got_pass(struct user_auth_info *auth_info); +bool get_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info); +bool get_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info); +struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx, + struct user_auth_info *info); +bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info); bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid, gid_t **gids, size_t *num_gids); const char *get_numlist(const char *p, uint32 **num, int *count); @@ -2411,7 +2418,7 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx, bool force_encrypt); void cli_cm_shutdown(void); void cli_cm_display(void); -void cli_cm_set_credentials(void); +void cli_cm_set_credentials(struct user_auth_info *auth_info); void cli_cm_set_port(int port_number); void cli_cm_set_dest_name_type(int type); void cli_cm_set_signing_state(int state); @@ -2976,6 +2983,7 @@ bool namecache_status_fetch(const char *keyname, /* The following definitions come from libsmb/namequery.c */ bool saf_store( const char *domain, const char *servername ); +bool saf_join_store( const char *domain, const char *servername ); bool saf_delete( const char *domain ); char *saf_fetch( const char *domain ); NODE_STATUS_STRUCT *node_status_query(int fd, @@ -6513,70 +6521,6 @@ bool svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_ bool svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth); bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth); -/* The following definitions come from rpc_server/srv_dfs_nt.c */ - -void _dfs_GetManagerVersion(pipes_struct *p, struct dfs_GetManagerVersion *r); -WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r); -WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r); -WERROR _dfs_Enum(pipes_struct *p, struct dfs_Enum *r); -WERROR _dfs_GetInfo(pipes_struct *p, struct dfs_GetInfo *r); -WERROR _dfs_SetInfo(pipes_struct *p, struct dfs_SetInfo *r); -WERROR _dfs_Rename(pipes_struct *p, struct dfs_Rename *r); -WERROR _dfs_Move(pipes_struct *p, struct dfs_Move *r); -WERROR _dfs_ManagerGetConfigInfo(pipes_struct *p, struct dfs_ManagerGetConfigInfo *r); -WERROR _dfs_ManagerSendSiteInfo(pipes_struct *p, struct dfs_ManagerSendSiteInfo *r); -WERROR _dfs_AddFtRoot(pipes_struct *p, struct dfs_AddFtRoot *r); -WERROR _dfs_RemoveFtRoot(pipes_struct *p, struct dfs_RemoveFtRoot *r); -WERROR _dfs_AddStdRoot(pipes_struct *p, struct dfs_AddStdRoot *r); -WERROR _dfs_RemoveStdRoot(pipes_struct *p, struct dfs_RemoveStdRoot *r); -WERROR _dfs_ManagerInitialize(pipes_struct *p, struct dfs_ManagerInitialize *r); -WERROR _dfs_AddStdRootForced(pipes_struct *p, struct dfs_AddStdRootForced *r); -WERROR _dfs_GetDcAddress(pipes_struct *p, struct dfs_GetDcAddress *r); -WERROR _dfs_SetDcAddress(pipes_struct *p, struct dfs_SetDcAddress *r); -WERROR _dfs_FlushFtTable(pipes_struct *p, struct dfs_FlushFtTable *r); -WERROR _dfs_Add2(pipes_struct *p, struct dfs_Add2 *r); -WERROR _dfs_Remove2(pipes_struct *p, struct dfs_Remove2 *r); -WERROR _dfs_EnumEx(pipes_struct *p, struct dfs_EnumEx *r); -WERROR _dfs_SetInfo2(pipes_struct *p, struct dfs_SetInfo2 *r); - -/* The following definitions come from rpc_server/srv_dssetup_nt.c */ - -WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p, - struct dssetup_DsRoleGetPrimaryDomainInformation *r); -WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p, - struct dssetup_DsRoleDnsNameToFlatName *r); -WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p, - struct dssetup_DsRoleDcAsDc *r); -WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p, - struct dssetup_DsRoleDcAsReplica *r); -WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p, - struct dssetup_DsRoleDemoteDc *r); -WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p, - struct dssetup_DsRoleGetDcOperationProgress *r); -WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p, - struct dssetup_DsRoleGetDcOperationResults *r); -WERROR _dssetup_DsRoleCancel(pipes_struct *p, - struct dssetup_DsRoleCancel *r); -WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p, - struct dssetup_DsRoleServerSaveStateForUpgrade *r); -WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p, - struct dssetup_DsRoleUpgradeDownlevelServer *r); -WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p, - struct dssetup_DsRoleAbortDownlevelServerUpgrade *r); - -/* The following definitions come from rpc_server/srv_echo_nt.c */ - -void _echo_AddOne(pipes_struct *p, struct echo_AddOne *r ); -void _echo_EchoData(pipes_struct *p, struct echo_EchoData *r); -void _echo_SinkData(pipes_struct *p, struct echo_SinkData *r); -void _echo_SourceData(pipes_struct *p, struct echo_SourceData *r); -void _echo_TestCall(pipes_struct *p, struct echo_TestCall *r); -NTSTATUS _echo_TestCall2(pipes_struct *p, struct echo_TestCall2 *r); -uint32 _echo_TestSleep(pipes_struct *p, struct echo_TestSleep *r); -void _echo_TestEnum(pipes_struct *p, struct echo_TestEnum *r); -void _echo_TestSurrounding(pipes_struct *p, struct echo_TestSurrounding *r); -uint16 _echo_TestDoublePointer(pipes_struct *p, struct echo_TestDoublePointer *r); - /* The following definitions come from rpc_server/srv_eventlog.c */ NTSTATUS rpc_eventlog2_init(void); @@ -6597,43 +6541,9 @@ bool parse_logentry( char *line, Eventlog_entry * entry, bool * eor ); /* The following definitions come from rpc_server/srv_eventlog_nt.c */ -NTSTATUS _eventlog_OpenEventLogW(pipes_struct *p, - struct eventlog_OpenEventLogW *r); -NTSTATUS _eventlog_ClearEventLogW(pipes_struct *p, - struct eventlog_ClearEventLogW *r); -NTSTATUS _eventlog_CloseEventLog( pipes_struct * p, struct eventlog_CloseEventLog *r ); NTSTATUS _eventlog_read_eventlog( pipes_struct * p, EVENTLOG_Q_READ_EVENTLOG * q_u, EVENTLOG_R_READ_EVENTLOG * r_u ); -NTSTATUS _eventlog_GetOldestRecord(pipes_struct *p, - struct eventlog_GetOldestRecord *r); -NTSTATUS _eventlog_GetNumRecords(pipes_struct *p, - struct eventlog_GetNumRecords *r); -NTSTATUS _eventlog_BackupEventLogW(pipes_struct *p, struct eventlog_BackupEventLogW *r); -NTSTATUS _eventlog_DeregisterEventSource(pipes_struct *p, struct eventlog_DeregisterEventSource *r); -NTSTATUS _eventlog_ChangeNotify(pipes_struct *p, struct eventlog_ChangeNotify *r); -NTSTATUS _eventlog_RegisterEventSourceW(pipes_struct *p, struct eventlog_RegisterEventSourceW *r); -NTSTATUS _eventlog_OpenBackupEventLogW(pipes_struct *p, struct eventlog_OpenBackupEventLogW *r); -NTSTATUS _eventlog_ReadEventLogW(pipes_struct *p, struct eventlog_ReadEventLogW *r); -NTSTATUS _eventlog_ReportEventW(pipes_struct *p, struct eventlog_ReportEventW *r); -NTSTATUS _eventlog_ClearEventLogA(pipes_struct *p, struct eventlog_ClearEventLogA *r); -NTSTATUS _eventlog_BackupEventLogA(pipes_struct *p, struct eventlog_BackupEventLogA *r); -NTSTATUS _eventlog_OpenEventLogA(pipes_struct *p, struct eventlog_OpenEventLogA *r); -NTSTATUS _eventlog_RegisterEventSourceA(pipes_struct *p, struct eventlog_RegisterEventSourceA *r); -NTSTATUS _eventlog_OpenBackupEventLogA(pipes_struct *p, struct eventlog_OpenBackupEventLogA *r); -NTSTATUS _eventlog_ReadEventLogA(pipes_struct *p, struct eventlog_ReadEventLogA *r); -NTSTATUS _eventlog_ReportEventA(pipes_struct *p, struct eventlog_ReportEventA *r); -NTSTATUS _eventlog_RegisterClusterSvc(pipes_struct *p, struct eventlog_RegisterClusterSvc *r); -NTSTATUS _eventlog_DeregisterClusterSvc(pipes_struct *p, struct eventlog_DeregisterClusterSvc *r); -NTSTATUS _eventlog_WriteClusterEvents(pipes_struct *p, struct eventlog_WriteClusterEvents *r); -NTSTATUS _eventlog_GetLogIntormation(pipes_struct *p, struct eventlog_GetLogIntormation *r); -NTSTATUS _eventlog_FlushEventLog(pipes_struct *p, struct eventlog_FlushEventLog *r); - -/* The following definitions come from rpc_server/srv_initshutdown_nt.c */ - -WERROR _initshutdown_Init(pipes_struct *p, struct initshutdown_Init *r); -WERROR _initshutdown_InitEx(pipes_struct *p, struct initshutdown_InitEx *r); -WERROR _initshutdown_Abort(pipes_struct *p, struct initshutdown_Abort *r); /* The following definitions come from rpc_server/srv_lsa_hnd.c */ @@ -6644,216 +6554,6 @@ bool close_policy_hnd(pipes_struct *p, POLICY_HND *hnd); void close_policy_by_pipe(pipes_struct *p); bool pipe_access_check(pipes_struct *p); -/* The following definitions come from rpc_server/srv_lsa_nt.c */ - -NTSTATUS _lsa_OpenPolicy2(pipes_struct *p, - struct lsa_OpenPolicy2 *r); -NTSTATUS _lsa_OpenPolicy(pipes_struct *p, - struct lsa_OpenPolicy *r); -NTSTATUS _lsa_EnumTrustDom(pipes_struct *p, - struct lsa_EnumTrustDom *r); -NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p, - struct lsa_QueryInfoPolicy *r); -NTSTATUS _lsa_LookupSids(pipes_struct *p, - struct lsa_LookupSids *r); -NTSTATUS _lsa_LookupSids2(pipes_struct *p, - struct lsa_LookupSids2 *r); -NTSTATUS _lsa_LookupSids3(pipes_struct *p, - struct lsa_LookupSids3 *r); -NTSTATUS _lsa_LookupNames(pipes_struct *p, - struct lsa_LookupNames *r); -NTSTATUS _lsa_LookupNames2(pipes_struct *p, - struct lsa_LookupNames2 *r); -NTSTATUS _lsa_LookupNames3(pipes_struct *p, - struct lsa_LookupNames3 *r); -NTSTATUS _lsa_LookupNames4(pipes_struct *p, - struct lsa_LookupNames4 *r); -NTSTATUS _lsa_Close(pipes_struct *p, struct lsa_Close *r); -NTSTATUS _lsa_OpenSecret(pipes_struct *p, struct lsa_OpenSecret *r); -NTSTATUS _lsa_OpenTrustedDomain(pipes_struct *p, struct lsa_OpenTrustedDomain *r); -NTSTATUS _lsa_CreateTrustedDomain(pipes_struct *p, struct lsa_CreateTrustedDomain *r); -NTSTATUS _lsa_CreateSecret(pipes_struct *p, struct lsa_CreateSecret *r); -NTSTATUS _lsa_SetSecret(pipes_struct *p, struct lsa_SetSecret *r); -NTSTATUS _lsa_DeleteObject(pipes_struct *p, - struct lsa_DeleteObject *r); -NTSTATUS _lsa_EnumPrivs(pipes_struct *p, - struct lsa_EnumPrivs *r); -NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p, - struct lsa_LookupPrivDisplayName *r); -NTSTATUS _lsa_EnumAccounts(pipes_struct *p, - struct lsa_EnumAccounts *r); -NTSTATUS _lsa_GetUserName(pipes_struct *p, - struct lsa_GetUserName *r); -NTSTATUS _lsa_CreateAccount(pipes_struct *p, - struct lsa_CreateAccount *r); -NTSTATUS _lsa_OpenAccount(pipes_struct *p, - struct lsa_OpenAccount *r); -NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p, - struct lsa_EnumPrivsAccount *r); -NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p, - struct lsa_GetSystemAccessAccount *r); -NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p, - struct lsa_SetSystemAccessAccount *r); -NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p, - struct lsa_AddPrivilegesToAccount *r); -NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p, - struct lsa_RemovePrivilegesFromAccount *r); -NTSTATUS _lsa_QuerySecurity(pipes_struct *p, - struct lsa_QuerySecurity *r); -NTSTATUS _lsa_AddAccountRights(pipes_struct *p, - struct lsa_AddAccountRights *r); -NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p, - struct lsa_RemoveAccountRights *r); -NTSTATUS _lsa_EnumAccountRights(pipes_struct *p, - struct lsa_EnumAccountRights *r); -NTSTATUS _lsa_LookupPrivValue(pipes_struct *p, - struct lsa_LookupPrivValue *r); -NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r); -NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r); -NTSTATUS _lsa_ChangePassword(pipes_struct *p, struct lsa_ChangePassword *r); -NTSTATUS _lsa_SetInfoPolicy(pipes_struct *p, struct lsa_SetInfoPolicy *r); -NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r); -NTSTATUS _lsa_GetQuotasForAccount(pipes_struct *p, struct lsa_GetQuotasForAccount *r); -NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccount *r); -NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r); -NTSTATUS _lsa_SetInformationTrustedDomain(pipes_struct *p, struct lsa_SetInformationTrustedDomain *r); -NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r); -NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r); -NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r); -NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r); -NTSTATUS _lsa_SetTrustedDomainInfo(pipes_struct *p, struct lsa_SetTrustedDomainInfo *r); -NTSTATUS _lsa_DeleteTrustedDomain(pipes_struct *p, struct lsa_DeleteTrustedDomain *r); -NTSTATUS _lsa_StorePrivateData(pipes_struct *p, struct lsa_StorePrivateData *r); -NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateData *r); -NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r); -NTSTATUS _lsa_SetInfoPolicy2(pipes_struct *p, struct lsa_SetInfoPolicy2 *r); -NTSTATUS _lsa_QueryTrustedDomainInfoByName(pipes_struct *p, struct lsa_QueryTrustedDomainInfoByName *r); -NTSTATUS _lsa_SetTrustedDomainInfoByName(pipes_struct *p, struct lsa_SetTrustedDomainInfoByName *r); -NTSTATUS _lsa_EnumTrustedDomainsEx(pipes_struct *p, struct lsa_EnumTrustedDomainsEx *r); -NTSTATUS _lsa_CreateTrustedDomainEx(pipes_struct *p, struct lsa_CreateTrustedDomainEx *r); -NTSTATUS _lsa_CloseTrustedDomainEx(pipes_struct *p, struct lsa_CloseTrustedDomainEx *r); -NTSTATUS _lsa_QueryDomainInformationPolicy(pipes_struct *p, struct lsa_QueryDomainInformationPolicy *r); -NTSTATUS _lsa_SetDomainInformationPolicy(pipes_struct *p, struct lsa_SetDomainInformationPolicy *r); -NTSTATUS _lsa_OpenTrustedDomainByName(pipes_struct *p, struct lsa_OpenTrustedDomainByName *r); -NTSTATUS _lsa_TestCall(pipes_struct *p, struct lsa_TestCall *r); -NTSTATUS _lsa_CreateTrustedDomainEx2(pipes_struct *p, struct lsa_CreateTrustedDomainEx2 *r); -NTSTATUS _lsa_CREDRWRITE(pipes_struct *p, struct lsa_CREDRWRITE *r); -NTSTATUS _lsa_CREDRREAD(pipes_struct *p, struct lsa_CREDRREAD *r); -NTSTATUS _lsa_CREDRENUMERATE(pipes_struct *p, struct lsa_CREDRENUMERATE *r); -NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRWRITEDOMAINCREDENTIALS *r); -NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRREADDOMAINCREDENTIALS *r); -NTSTATUS _lsa_CREDRDELETE(pipes_struct *p, struct lsa_CREDRDELETE *r); -NTSTATUS _lsa_CREDRGETTARGETINFO(pipes_struct *p, struct lsa_CREDRGETTARGETINFO *r); -NTSTATUS _lsa_CREDRPROFILELOADED(pipes_struct *p, struct lsa_CREDRPROFILELOADED *r); -NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTYPES *r); -NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r); -NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r); -NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r); -NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r); -NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r); -NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r); -NTSTATUS _lsa_LSAROPENPOLICYSCE(pipes_struct *p, struct lsa_LSAROPENPOLICYSCE *r); -NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r); -NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r); -NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r); - -/* The following definitions come from rpc_server/srv_netlog_nt.c */ - -WERROR _netr_LogonControl(pipes_struct *p, - struct netr_LogonControl *r); -WERROR _netr_LogonControl2(pipes_struct *p, - struct netr_LogonControl2 *r); -WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p, - struct netr_NetrEnumerateTrustedDomains *r); -NTSTATUS _netr_ServerReqChallenge(pipes_struct *p, - struct netr_ServerReqChallenge *r); -NTSTATUS _netr_ServerAuthenticate(pipes_struct *p, - struct netr_ServerAuthenticate *r); -NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p, - struct netr_ServerAuthenticate2 *r); -NTSTATUS _netr_ServerPasswordSet(pipes_struct *p, - struct netr_ServerPasswordSet *r); -NTSTATUS _netr_LogonSamLogoff(pipes_struct *p, - struct netr_LogonSamLogoff *r); -NTSTATUS _netr_LogonSamLogon(pipes_struct *p, - struct netr_LogonSamLogon *r); -NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p, - struct netr_LogonSamLogonEx *r); -WERROR _netr_LogonUasLogon(pipes_struct *p, - struct netr_LogonUasLogon *r); -WERROR _netr_LogonUasLogoff(pipes_struct *p, - struct netr_LogonUasLogoff *r); -NTSTATUS _netr_DatabaseDeltas(pipes_struct *p, - struct netr_DatabaseDeltas *r); -NTSTATUS _netr_DatabaseSync(pipes_struct *p, - struct netr_DatabaseSync *r); -NTSTATUS _netr_AccountDeltas(pipes_struct *p, - struct netr_AccountDeltas *r); -NTSTATUS _netr_AccountSync(pipes_struct *p, - struct netr_AccountSync *r); -WERROR _netr_GetDcName(pipes_struct *p, - struct netr_GetDcName *r); -WERROR _netr_GetAnyDCName(pipes_struct *p, - struct netr_GetAnyDCName *r); -NTSTATUS _netr_DatabaseSync2(pipes_struct *p, - struct netr_DatabaseSync2 *r); -NTSTATUS _netr_DatabaseRedo(pipes_struct *p, - struct netr_DatabaseRedo *r); -WERROR _netr_LogonControl2Ex(pipes_struct *p, - struct netr_LogonControl2Ex *r); -WERROR _netr_DsRGetDCName(pipes_struct *p, - struct netr_DsRGetDCName *r); -WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p, - struct netr_NETRLOGONDUMMYROUTINE1 *r); -WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p, - struct netr_NETRLOGONSETSERVICEBITS *r); -WERROR _netr_LogonGetTrustRid(pipes_struct *p, - struct netr_LogonGetTrustRid *r); -WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p, - struct netr_NETRLOGONCOMPUTESERVERDIGEST *r); -WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p, - struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r); -NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p, - struct netr_ServerAuthenticate3 *r); -WERROR _netr_DsRGetDCNameEx(pipes_struct *p, - struct netr_DsRGetDCNameEx *r); -WERROR _netr_DsRGetSiteName(pipes_struct *p, - struct netr_DsRGetSiteName *r); -NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p, - struct netr_LogonGetDomainInfo *r); -NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p, - struct netr_ServerPasswordSet2 *r); -WERROR _netr_ServerPasswordGet(pipes_struct *p, - struct netr_ServerPasswordGet *r); -WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p, - struct netr_NETRLOGONSENDTOSAM *r); -WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p, - struct netr_DsRAddressToSitenamesW *r); -WERROR _netr_DsRGetDCNameEx2(pipes_struct *p, - struct netr_DsRGetDCNameEx2 *r); -WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p, - struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r); -WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p, - struct netr_NetrEnumerateTrustedDomainsEx *r); -WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p, - struct netr_DsRAddressToSitenamesExW *r); -WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p, - struct netr_DsrGetDcSiteCoverageW *r); -WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p, - struct netr_DsrEnumerateDomainTrusts *r); -WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p, - struct netr_DsrDeregisterDNSHostRecords *r); -NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p, - struct netr_ServerTrustPasswordsGet *r); -WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p, - struct netr_DsRGetForestTrustInformation *r); -WERROR _netr_GetForestTrustInformation(pipes_struct *p, - struct netr_GetForestTrustInformation *r); -NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p, - struct netr_LogonSamLogonWithFlags *r); -WERROR _netr_ServerGetTrustInfo(pipes_struct *p, - struct netr_ServerGetTrustInfo *r); - /* The following definitions come from rpc_server/srv_ntsvcs.c */ void ntsvcs2_get_pipe_fns( struct api_struct **fns, int *n_fns ); @@ -6861,137 +6561,7 @@ NTSTATUS rpc_ntsvcs2_init(void); /* The following definitions come from rpc_server/srv_ntsvcs_nt.c */ -WERROR _PNP_GetVersion(pipes_struct *p, - struct PNP_GetVersion *r); -WERROR _PNP_GetDeviceListSize(pipes_struct *p, - struct PNP_GetDeviceListSize *r); WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, NTSVCS_R_GET_DEVICE_LIST *r_u ); -WERROR _PNP_ValidateDeviceInstance(pipes_struct *p, - struct PNP_ValidateDeviceInstance *r); -WERROR _PNP_GetHwProfInfo(pipes_struct *p, - struct PNP_GetHwProfInfo *r); -WERROR _PNP_HwProfFlags(pipes_struct *p, - struct PNP_HwProfFlags *r); -WERROR _PNP_Disconnect(pipes_struct *p, - struct PNP_Disconnect *r); -WERROR _PNP_Connect(pipes_struct *p, - struct PNP_Connect *r); -WERROR _PNP_GetGlobalState(pipes_struct *p, - struct PNP_GetGlobalState *r); -WERROR _PNP_InitDetection(pipes_struct *p, - struct PNP_InitDetection *r); -WERROR _PNP_ReportLogOn(pipes_struct *p, - struct PNP_ReportLogOn *r); -WERROR _PNP_GetRootDeviceInstance(pipes_struct *p, - struct PNP_GetRootDeviceInstance *r); -WERROR _PNP_GetRelatedDeviceInstance(pipes_struct *p, - struct PNP_GetRelatedDeviceInstance *r); -WERROR _PNP_EnumerateSubKeys(pipes_struct *p, - struct PNP_EnumerateSubKeys *r); -WERROR _PNP_GetDeviceList(pipes_struct *p, - struct PNP_GetDeviceList *r); -WERROR _PNP_GetDepth(pipes_struct *p, - struct PNP_GetDepth *r); -WERROR _PNP_GetDeviceRegProp(pipes_struct *p, - struct PNP_GetDeviceRegProp *r); -WERROR _PNP_SetDeviceRegProp(pipes_struct *p, - struct PNP_SetDeviceRegProp *r); -WERROR _PNP_GetClassInstance(pipes_struct *p, - struct PNP_GetClassInstance *r); -WERROR _PNP_CreateKey(pipes_struct *p, - struct PNP_CreateKey *r); -WERROR _PNP_DeleteRegistryKey(pipes_struct *p, - struct PNP_DeleteRegistryKey *r); -WERROR _PNP_GetClassCount(pipes_struct *p, - struct PNP_GetClassCount *r); -WERROR _PNP_GetClassName(pipes_struct *p, - struct PNP_GetClassName *r); -WERROR _PNP_DeleteClassKey(pipes_struct *p, - struct PNP_DeleteClassKey *r); -WERROR _PNP_GetInterfaceDeviceAlias(pipes_struct *p, - struct PNP_GetInterfaceDeviceAlias *r); -WERROR _PNP_GetInterfaceDeviceList(pipes_struct *p, - struct PNP_GetInterfaceDeviceList *r); -WERROR _PNP_GetInterfaceDeviceListSize(pipes_struct *p, - struct PNP_GetInterfaceDeviceListSize *r); -WERROR _PNP_RegisterDeviceClassAssociation(pipes_struct *p, - struct PNP_RegisterDeviceClassAssociation *r); -WERROR _PNP_UnregisterDeviceClassAssociation(pipes_struct *p, - struct PNP_UnregisterDeviceClassAssociation *r); -WERROR _PNP_GetClassRegProp(pipes_struct *p, - struct PNP_GetClassRegProp *r); -WERROR _PNP_SetClassRegProp(pipes_struct *p, - struct PNP_SetClassRegProp *r); -WERROR _PNP_CreateDevInst(pipes_struct *p, - struct PNP_CreateDevInst *r); -WERROR _PNP_DeviceInstanceAction(pipes_struct *p, - struct PNP_DeviceInstanceAction *r); -WERROR _PNP_GetDeviceStatus(pipes_struct *p, - struct PNP_GetDeviceStatus *r); -WERROR _PNP_SetDeviceProblem(pipes_struct *p, - struct PNP_SetDeviceProblem *r); -WERROR _PNP_DisableDevInst(pipes_struct *p, - struct PNP_DisableDevInst *r); -WERROR _PNP_UninstallDevInst(pipes_struct *p, - struct PNP_UninstallDevInst *r); -WERROR _PNP_AddID(pipes_struct *p, - struct PNP_AddID *r); -WERROR _PNP_RegisterDriver(pipes_struct *p, - struct PNP_RegisterDriver *r); -WERROR _PNP_QueryRemove(pipes_struct *p, - struct PNP_QueryRemove *r); -WERROR _PNP_RequestDeviceEject(pipes_struct *p, - struct PNP_RequestDeviceEject *r); -WERROR _PNP_IsDockStationPresent(pipes_struct *p, - struct PNP_IsDockStationPresent *r); -WERROR _PNP_RequestEjectPC(pipes_struct *p, - struct PNP_RequestEjectPC *r); -WERROR _PNP_AddEmptyLogConf(pipes_struct *p, - struct PNP_AddEmptyLogConf *r); -WERROR _PNP_FreeLogConf(pipes_struct *p, - struct PNP_FreeLogConf *r); -WERROR _PNP_GetFirstLogConf(pipes_struct *p, - struct PNP_GetFirstLogConf *r); -WERROR _PNP_GetNextLogConf(pipes_struct *p, - struct PNP_GetNextLogConf *r); -WERROR _PNP_GetLogConfPriority(pipes_struct *p, - struct PNP_GetLogConfPriority *r); -WERROR _PNP_AddResDes(pipes_struct *p, - struct PNP_AddResDes *r); -WERROR _PNP_FreeResDes(pipes_struct *p, - struct PNP_FreeResDes *r); -WERROR _PNP_GetNextResDes(pipes_struct *p, - struct PNP_GetNextResDes *r); -WERROR _PNP_GetResDesData(pipes_struct *p, - struct PNP_GetResDesData *r); -WERROR _PNP_GetResDesDataSize(pipes_struct *p, - struct PNP_GetResDesDataSize *r); -WERROR _PNP_ModifyResDes(pipes_struct *p, - struct PNP_ModifyResDes *r); -WERROR _PNP_DetectResourceLimit(pipes_struct *p, - struct PNP_DetectResourceLimit *r); -WERROR _PNP_QueryResConfList(pipes_struct *p, - struct PNP_QueryResConfList *r); -WERROR _PNP_SetHwProf(pipes_struct *p, - struct PNP_SetHwProf *r); -WERROR _PNP_QueryArbitratorFreeData(pipes_struct *p, - struct PNP_QueryArbitratorFreeData *r); -WERROR _PNP_QueryArbitratorFreeSize(pipes_struct *p, - struct PNP_QueryArbitratorFreeSize *r); -WERROR _PNP_RunDetection(pipes_struct *p, - struct PNP_RunDetection *r); -WERROR _PNP_RegisterNotification(pipes_struct *p, - struct PNP_RegisterNotification *r); -WERROR _PNP_UnregisterNotification(pipes_struct *p, - struct PNP_UnregisterNotification *r); -WERROR _PNP_GetCustomDevProp(pipes_struct *p, - struct PNP_GetCustomDevProp *r); -WERROR _PNP_GetVersionInternal(pipes_struct *p, - struct PNP_GetVersionInternal *r); -WERROR _PNP_GetBlockedDriverInfo(pipes_struct *p, - struct PNP_GetBlockedDriverInfo *r); -WERROR _PNP_GetServerSideDeviceInstallFlags(pipes_struct *p, - struct PNP_GetServerSideDeviceInstallFlags *r); /* The following definitions come from rpc_server/srv_pipe.c */ @@ -7028,145 +6598,6 @@ NTSTATUS np_write(struct files_struct *fsp, const uint8_t *data, size_t len, NTSTATUS np_read(struct files_struct *fsp, uint8_t *data, size_t len, ssize_t *nread, bool *is_data_outstanding); - -/* The following definitions come from rpc_server/srv_samr_nt.c */ - -NTSTATUS _samr_Close(pipes_struct *p, struct samr_Close *r); -NTSTATUS _samr_OpenDomain(pipes_struct *p, - struct samr_OpenDomain *r); -NTSTATUS _samr_GetUserPwInfo(pipes_struct *p, - struct samr_GetUserPwInfo *r); -NTSTATUS _samr_SetSecurity(pipes_struct *p, - struct samr_SetSecurity *r); -NTSTATUS _samr_QuerySecurity(pipes_struct *p, - struct samr_QuerySecurity *r); -NTSTATUS _samr_EnumDomainUsers(pipes_struct *p, - struct samr_EnumDomainUsers *r); -NTSTATUS _samr_EnumDomainGroups(pipes_struct *p, - struct samr_EnumDomainGroups *r); -NTSTATUS _samr_EnumDomainAliases(pipes_struct *p, - struct samr_EnumDomainAliases *r); -NTSTATUS _samr_QueryDisplayInfo(pipes_struct *p, - struct samr_QueryDisplayInfo *r); -NTSTATUS _samr_QueryDisplayInfo2(pipes_struct *p, - struct samr_QueryDisplayInfo2 *r); -NTSTATUS _samr_QueryDisplayInfo3(pipes_struct *p, - struct samr_QueryDisplayInfo3 *r); -NTSTATUS _samr_QueryAliasInfo(pipes_struct *p, - struct samr_QueryAliasInfo *r); -NTSTATUS _samr_LookupNames(pipes_struct *p, - struct samr_LookupNames *r); -NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p, - struct samr_ChangePasswordUser2 *r); -NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p, - struct samr_ChangePasswordUser3 *r); -NTSTATUS _samr_LookupRids(pipes_struct *p, - struct samr_LookupRids *r); -NTSTATUS _samr_OpenUser(pipes_struct *p, - struct samr_OpenUser *r); -NTSTATUS _samr_QueryUserInfo(pipes_struct *p, - struct samr_QueryUserInfo *r); -NTSTATUS _samr_GetGroupsForUser(pipes_struct *p, - struct samr_GetGroupsForUser *r); -NTSTATUS _samr_QueryDomainInfo(pipes_struct *p, - struct samr_QueryDomainInfo *r); -NTSTATUS _samr_CreateUser2(pipes_struct *p, - struct samr_CreateUser2 *r); -NTSTATUS _samr_Connect(pipes_struct *p, - struct samr_Connect *r); -NTSTATUS _samr_Connect2(pipes_struct *p, - struct samr_Connect2 *r); -NTSTATUS _samr_Connect4(pipes_struct *p, - struct samr_Connect4 *r); -NTSTATUS _samr_Connect5(pipes_struct *p, - struct samr_Connect5 *r); -NTSTATUS _samr_LookupDomain(pipes_struct *p, - struct samr_LookupDomain *r); -NTSTATUS _samr_EnumDomains(pipes_struct *p, - struct samr_EnumDomains *r); -NTSTATUS _samr_OpenAlias(pipes_struct *p, - struct samr_OpenAlias *r); -NTSTATUS _samr_SetUserInfo(pipes_struct *p, - struct samr_SetUserInfo *r); -NTSTATUS _samr_SetUserInfo2(pipes_struct *p, - struct samr_SetUserInfo2 *r); -NTSTATUS _samr_GetAliasMembership(pipes_struct *p, - struct samr_GetAliasMembership *r); -NTSTATUS _samr_GetMembersInAlias(pipes_struct *p, - struct samr_GetMembersInAlias *r); -NTSTATUS _samr_QueryGroupMember(pipes_struct *p, - struct samr_QueryGroupMember *r); -NTSTATUS _samr_AddAliasMember(pipes_struct *p, - struct samr_AddAliasMember *r); -NTSTATUS _samr_DeleteAliasMember(pipes_struct *p, - struct samr_DeleteAliasMember *r); -NTSTATUS _samr_AddGroupMember(pipes_struct *p, - struct samr_AddGroupMember *r); -NTSTATUS _samr_DeleteGroupMember(pipes_struct *p, - struct samr_DeleteGroupMember *r); -NTSTATUS _samr_DeleteUser(pipes_struct *p, - struct samr_DeleteUser *r); -NTSTATUS _samr_DeleteDomainGroup(pipes_struct *p, - struct samr_DeleteDomainGroup *r); -NTSTATUS _samr_DeleteDomAlias(pipes_struct *p, - struct samr_DeleteDomAlias *r); -NTSTATUS _samr_CreateDomainGroup(pipes_struct *p, - struct samr_CreateDomainGroup *r); -NTSTATUS _samr_CreateDomAlias(pipes_struct *p, - struct samr_CreateDomAlias *r); -NTSTATUS _samr_QueryGroupInfo(pipes_struct *p, - struct samr_QueryGroupInfo *r); -NTSTATUS _samr_SetGroupInfo(pipes_struct *p, - struct samr_SetGroupInfo *r); -NTSTATUS _samr_SetAliasInfo(pipes_struct *p, - struct samr_SetAliasInfo *r); -NTSTATUS _samr_GetDomPwInfo(pipes_struct *p, - struct samr_GetDomPwInfo *r); -NTSTATUS _samr_OpenGroup(pipes_struct *p, - struct samr_OpenGroup *r); -NTSTATUS _samr_RemoveMemberFromForeignDomain(pipes_struct *p, - struct samr_RemoveMemberFromForeignDomain *r); -NTSTATUS _samr_QueryDomainInfo2(pipes_struct *p, - struct samr_QueryDomainInfo2 *r); -NTSTATUS _samr_SetDomainInfo(pipes_struct *p, - struct samr_SetDomainInfo *r); -NTSTATUS _samr_GetDisplayEnumerationIndex(pipes_struct *p, - struct samr_GetDisplayEnumerationIndex *r); -NTSTATUS _samr_GetDisplayEnumerationIndex2(pipes_struct *p, - struct samr_GetDisplayEnumerationIndex2 *r); -NTSTATUS _samr_Shutdown(pipes_struct *p, - struct samr_Shutdown *r); -NTSTATUS _samr_CreateUser(pipes_struct *p, - struct samr_CreateUser *r); -NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p, - struct samr_SetMemberAttributesOfGroup *r); -NTSTATUS _samr_ChangePasswordUser(pipes_struct *p, - struct samr_ChangePasswordUser *r); -NTSTATUS _samr_TestPrivateFunctionsDomain(pipes_struct *p, - struct samr_TestPrivateFunctionsDomain *r); -NTSTATUS _samr_TestPrivateFunctionsUser(pipes_struct *p, - struct samr_TestPrivateFunctionsUser *r); -NTSTATUS _samr_QueryUserInfo2(pipes_struct *p, - struct samr_QueryUserInfo2 *r); -NTSTATUS _samr_AddMultipleMembersToAlias(pipes_struct *p, - struct samr_AddMultipleMembersToAlias *r); -NTSTATUS _samr_RemoveMultipleMembersFromAlias(pipes_struct *p, - struct samr_RemoveMultipleMembersFromAlias *r); -NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p, - struct samr_OemChangePasswordUser2 *r); -NTSTATUS _samr_SetBootKeyInformation(pipes_struct *p, - struct samr_SetBootKeyInformation *r); -NTSTATUS _samr_GetBootKeyInformation(pipes_struct *p, - struct samr_GetBootKeyInformation *r); -NTSTATUS _samr_Connect3(pipes_struct *p, - struct samr_Connect3 *r); -NTSTATUS _samr_RidToSid(pipes_struct *p, - struct samr_RidToSid *r); -NTSTATUS _samr_SetDsrmPassword(pipes_struct *p, - struct samr_SetDsrmPassword *r); -NTSTATUS _samr_ValidatePassword(pipes_struct *p, - struct samr_ValidatePassword *r); - /* The following definitions come from rpc_server/srv_samr_util.c */ void copy_id20_to_sam_passwd(struct samu *to, @@ -7326,79 +6757,7 @@ WERROR _spoolss_xcvdataport(pipes_struct *p, SPOOL_Q_XCVDATAPORT *q_u, SPOOL_R_X /* The following definitions come from rpc_server/srv_srvsvc_nt.c */ -WERROR _srvsvc_NetFileEnum(pipes_struct *p, - struct srvsvc_NetFileEnum *r); -WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p, - struct srvsvc_NetSrvGetInfo *r); -WERROR _srvsvc_NetSrvSetInfo(pipes_struct *p, - struct srvsvc_NetSrvSetInfo *r); -WERROR _srvsvc_NetConnEnum(pipes_struct *p, - struct srvsvc_NetConnEnum *r); -WERROR _srvsvc_NetSessEnum(pipes_struct *p, - struct srvsvc_NetSessEnum *r); -WERROR _srvsvc_NetSessDel(pipes_struct *p, - struct srvsvc_NetSessDel *r); -WERROR _srvsvc_NetShareEnumAll(pipes_struct *p, - struct srvsvc_NetShareEnumAll *r); -WERROR _srvsvc_NetShareEnum(pipes_struct *p, - struct srvsvc_NetShareEnum *r); -WERROR _srvsvc_NetShareGetInfo(pipes_struct *p, - struct srvsvc_NetShareGetInfo *r); char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname); -WERROR _srvsvc_NetShareSetInfo(pipes_struct *p, - struct srvsvc_NetShareSetInfo *r); -WERROR _srvsvc_NetShareAdd(pipes_struct *p, - struct srvsvc_NetShareAdd *r); -WERROR _srvsvc_NetShareDel(pipes_struct *p, - struct srvsvc_NetShareDel *r); -WERROR _srvsvc_NetShareDelSticky(pipes_struct *p, - struct srvsvc_NetShareDelSticky *r); -WERROR _srvsvc_NetRemoteTOD(pipes_struct *p, - struct srvsvc_NetRemoteTOD *r); -WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, - struct srvsvc_NetGetFileSecurity *r); -WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, - struct srvsvc_NetSetFileSecurity *r); -WERROR _srvsvc_NetDiskEnum(pipes_struct *p, - struct srvsvc_NetDiskEnum *r); -WERROR _srvsvc_NetNameValidate(pipes_struct *p, - struct srvsvc_NetNameValidate *r); -WERROR _srvsvc_NetFileClose(pipes_struct *p, struct srvsvc_NetFileClose *r); -WERROR _srvsvc_NetCharDevEnum(pipes_struct *p, struct srvsvc_NetCharDevEnum *r); -WERROR _srvsvc_NetCharDevGetInfo(pipes_struct *p, struct srvsvc_NetCharDevGetInfo *r); -WERROR _srvsvc_NetCharDevControl(pipes_struct *p, struct srvsvc_NetCharDevControl *r); -WERROR _srvsvc_NetCharDevQEnum(pipes_struct *p, struct srvsvc_NetCharDevQEnum *r); -WERROR _srvsvc_NetCharDevQGetInfo(pipes_struct *p, struct srvsvc_NetCharDevQGetInfo *r); -WERROR _srvsvc_NetCharDevQSetInfo(pipes_struct *p, struct srvsvc_NetCharDevQSetInfo *r); -WERROR _srvsvc_NetCharDevQPurge(pipes_struct *p, struct srvsvc_NetCharDevQPurge *r); -WERROR _srvsvc_NetCharDevQPurgeSelf(pipes_struct *p, struct srvsvc_NetCharDevQPurgeSelf *r); -WERROR _srvsvc_NetFileGetInfo(pipes_struct *p, struct srvsvc_NetFileGetInfo *r); -WERROR _srvsvc_NetShareCheck(pipes_struct *p, struct srvsvc_NetShareCheck *r); -WERROR _srvsvc_NetServerStatisticsGet(pipes_struct *p, struct srvsvc_NetServerStatisticsGet *r); -WERROR _srvsvc_NetTransportAdd(pipes_struct *p, struct srvsvc_NetTransportAdd *r); -WERROR _srvsvc_NetTransportEnum(pipes_struct *p, struct srvsvc_NetTransportEnum *r); -WERROR _srvsvc_NetTransportDel(pipes_struct *p, struct srvsvc_NetTransportDel *r); -WERROR _srvsvc_NetSetServiceBits(pipes_struct *p, struct srvsvc_NetSetServiceBits *r); -WERROR _srvsvc_NetPathType(pipes_struct *p, struct srvsvc_NetPathType *r); -WERROR _srvsvc_NetPathCanonicalize(pipes_struct *p, struct srvsvc_NetPathCanonicalize *r); -WERROR _srvsvc_NetPathCompare(pipes_struct *p, struct srvsvc_NetPathCompare *r); -WERROR _srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p, struct srvsvc_NETRPRNAMECANONICALIZE *r); -WERROR _srvsvc_NetPRNameCompare(pipes_struct *p, struct srvsvc_NetPRNameCompare *r); -WERROR _srvsvc_NetShareDelStart(pipes_struct *p, struct srvsvc_NetShareDelStart *r); -WERROR _srvsvc_NetShareDelCommit(pipes_struct *p, struct srvsvc_NetShareDelCommit *r); -WERROR _srvsvc_NetServerTransportAddEx(pipes_struct *p, struct srvsvc_NetServerTransportAddEx *r); -WERROR _srvsvc_NetServerSetServiceBitsEx(pipes_struct *p, struct srvsvc_NetServerSetServiceBitsEx *r); -WERROR _srvsvc_NETRDFSGETVERSION(pipes_struct *p, struct srvsvc_NETRDFSGETVERSION *r); -WERROR _srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSCREATELOCALPARTITION *r); -WERROR _srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSDELETELOCALPARTITION *r); -WERROR _srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r); -WERROR _srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p, struct srvsvc_NETRDFSSETSERVERINFO *r); -WERROR _srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSCREATEEXITPOINT *r); -WERROR _srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSDELETEEXITPOINT *r); -WERROR _srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p, struct srvsvc_NETRDFSMODIFYPREFIX *r); -WERROR _srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p, struct srvsvc_NETRDFSFIXLOCALVOLUME *r); -WERROR _srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r); -WERROR _srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p, struct srvsvc_NETRSERVERTRANSPORTDELEX *r); /* The following definitions come from rpc_server/srv_svcctl.c */ @@ -7408,138 +6767,9 @@ NTSTATUS rpc_svcctl2_init(void); /* The following definitions come from rpc_server/srv_svcctl_nt.c */ bool init_service_op_table( void ); -WERROR _svcctl_OpenSCManagerW(pipes_struct *p, - struct svcctl_OpenSCManagerW *r); -WERROR _svcctl_OpenServiceW(pipes_struct *p, - struct svcctl_OpenServiceW *r); -WERROR _svcctl_CloseServiceHandle(pipes_struct *p, struct svcctl_CloseServiceHandle *r); -WERROR _svcctl_GetServiceDisplayNameW(pipes_struct *p, - struct svcctl_GetServiceDisplayNameW *r); -WERROR _svcctl_QueryServiceStatus(pipes_struct *p, - struct svcctl_QueryServiceStatus *r); WERROR _svcctl_enum_services_status(pipes_struct *p, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, SVCCTL_R_ENUM_SERVICES_STATUS *r_u); -WERROR _svcctl_StartServiceW(pipes_struct *p, - struct svcctl_StartServiceW *r); -WERROR _svcctl_ControlService(pipes_struct *p, - struct svcctl_ControlService *r); -WERROR _svcctl_EnumDependentServicesW(pipes_struct *p, - struct svcctl_EnumDependentServicesW *r); WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u ); WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u ); -WERROR _svcctl_LockServiceDatabase(pipes_struct *p, - struct svcctl_LockServiceDatabase *r); -WERROR _svcctl_UnlockServiceDatabase(pipes_struct *p, - struct svcctl_UnlockServiceDatabase *r); -WERROR _svcctl_QueryServiceObjectSecurity(pipes_struct *p, - struct svcctl_QueryServiceObjectSecurity *r); -WERROR _svcctl_SetServiceObjectSecurity(pipes_struct *p, - struct svcctl_SetServiceObjectSecurity *r); -WERROR _svcctl_DeleteService(pipes_struct *p, struct svcctl_DeleteService *r); -WERROR _svcctl_SetServiceStatus(pipes_struct *p, struct svcctl_SetServiceStatus *r); -WERROR _svcctl_NotifyBootConfigStatus(pipes_struct *p, struct svcctl_NotifyBootConfigStatus *r); -WERROR _svcctl_SCSetServiceBitsW(pipes_struct *p, struct svcctl_SCSetServiceBitsW *r); -WERROR _svcctl_ChangeServiceConfigW(pipes_struct *p, struct svcctl_ChangeServiceConfigW *r); -WERROR _svcctl_CreateServiceW(pipes_struct *p, struct svcctl_CreateServiceW *r); -WERROR _svcctl_EnumServicesStatusW(pipes_struct *p, struct svcctl_EnumServicesStatusW *r); -WERROR _svcctl_QueryServiceConfigW(pipes_struct *p, struct svcctl_QueryServiceConfigW *r); -WERROR _svcctl_QueryServiceLockStatusW(pipes_struct *p, struct svcctl_QueryServiceLockStatusW *r); -WERROR _svcctl_GetServiceKeyNameW(pipes_struct *p, struct svcctl_GetServiceKeyNameW *r); -WERROR _svcctl_SCSetServiceBitsA(pipes_struct *p, struct svcctl_SCSetServiceBitsA *r); -WERROR _svcctl_ChangeServiceConfigA(pipes_struct *p, struct svcctl_ChangeServiceConfigA *r); -WERROR _svcctl_CreateServiceA(pipes_struct *p, struct svcctl_CreateServiceA *r); -WERROR _svcctl_EnumDependentServicesA(pipes_struct *p, struct svcctl_EnumDependentServicesA *r); -WERROR _svcctl_EnumServicesStatusA(pipes_struct *p, struct svcctl_EnumServicesStatusA *r); -WERROR _svcctl_OpenSCManagerA(pipes_struct *p, struct svcctl_OpenSCManagerA *r); -WERROR _svcctl_OpenServiceA(pipes_struct *p, struct svcctl_OpenServiceA *r); -WERROR _svcctl_QueryServiceConfigA(pipes_struct *p, struct svcctl_QueryServiceConfigA *r); -WERROR _svcctl_QueryServiceLockStatusA(pipes_struct *p, struct svcctl_QueryServiceLockStatusA *r); -WERROR _svcctl_StartServiceA(pipes_struct *p, struct svcctl_StartServiceA *r); -WERROR _svcctl_GetServiceDisplayNameA(pipes_struct *p, struct svcctl_GetServiceDisplayNameA *r); -WERROR _svcctl_GetServiceKeyNameA(pipes_struct *p, struct svcctl_GetServiceKeyNameA *r); -WERROR _svcctl_GetCurrentGroupeStateW(pipes_struct *p, struct svcctl_GetCurrentGroupeStateW *r); -WERROR _svcctl_EnumServiceGroupW(pipes_struct *p, struct svcctl_EnumServiceGroupW *r); -WERROR _svcctl_ChangeServiceConfig2A(pipes_struct *p, struct svcctl_ChangeServiceConfig2A *r); -WERROR _svcctl_ChangeServiceConfig2W(pipes_struct *p, struct svcctl_ChangeServiceConfig2W *r); -WERROR _svcctl_QueryServiceConfig2A(pipes_struct *p, struct svcctl_QueryServiceConfig2A *r); -WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p, struct svcctl_QueryServiceConfig2W *r); -WERROR _svcctl_QueryServiceStatusEx(pipes_struct *p, struct svcctl_QueryServiceStatusEx *r); -WERROR _EnumServicesStatusExA(pipes_struct *p, struct EnumServicesStatusExA *r); -WERROR _EnumServicesStatusExW(pipes_struct *p, struct EnumServicesStatusExW *r); -WERROR _svcctl_SCSendTSMessage(pipes_struct *p, struct svcctl_SCSendTSMessage *r); - -/* The following definitions come from rpc_server/srv_winreg_nt.c */ - -WERROR _winreg_CloseKey(pipes_struct *p, struct winreg_CloseKey *r); -WERROR _winreg_OpenHKLM(pipes_struct *p, struct winreg_OpenHKLM *r); -WERROR _winreg_OpenHKPD(pipes_struct *p, struct winreg_OpenHKPD *r); -WERROR _winreg_OpenHKPT(pipes_struct *p, struct winreg_OpenHKPT *r); -WERROR _winreg_OpenHKCR(pipes_struct *p, struct winreg_OpenHKCR *r); -WERROR _winreg_OpenHKU(pipes_struct *p, struct winreg_OpenHKU *r); -WERROR _winreg_OpenHKCU(pipes_struct *p, struct winreg_OpenHKCU *r); -WERROR _winreg_OpenHKCC(pipes_struct *p, struct winreg_OpenHKCC *r); -WERROR _winreg_OpenHKDD(pipes_struct *p, struct winreg_OpenHKDD *r); -WERROR _winreg_OpenHKPN(pipes_struct *p, struct winreg_OpenHKPN *r); -WERROR _winreg_OpenKey(pipes_struct *p, struct winreg_OpenKey *r); -WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r); -WERROR _winreg_QueryInfoKey(pipes_struct *p, struct winreg_QueryInfoKey *r); -WERROR _winreg_GetVersion(pipes_struct *p, struct winreg_GetVersion *r); -WERROR _winreg_EnumKey(pipes_struct *p, struct winreg_EnumKey *r); -WERROR _winreg_EnumValue(pipes_struct *p, struct winreg_EnumValue *r); -WERROR _winreg_InitiateSystemShutdown(pipes_struct *p, struct winreg_InitiateSystemShutdown *r); -WERROR _winreg_InitiateSystemShutdownEx(pipes_struct *p, struct winreg_InitiateSystemShutdownEx *r); -WERROR _winreg_AbortSystemShutdown(pipes_struct *p, struct winreg_AbortSystemShutdown *r); -WERROR _winreg_RestoreKey(pipes_struct *p, struct winreg_RestoreKey *r); -WERROR _winreg_SaveKey(pipes_struct *p, struct winreg_SaveKey *r); -WERROR _winreg_SaveKeyEx(pipes_struct *p, struct winreg_SaveKeyEx *r); -WERROR _winreg_CreateKey( pipes_struct *p, struct winreg_CreateKey *r); -WERROR _winreg_SetValue(pipes_struct *p, struct winreg_SetValue *r); -WERROR _winreg_DeleteKey(pipes_struct *p, struct winreg_DeleteKey *r); -WERROR _winreg_DeleteValue(pipes_struct *p, struct winreg_DeleteValue *r); -WERROR _winreg_GetKeySecurity(pipes_struct *p, struct winreg_GetKeySecurity *r); -WERROR _winreg_SetKeySecurity(pipes_struct *p, struct winreg_SetKeySecurity *r); -WERROR _winreg_FlushKey(pipes_struct *p, struct winreg_FlushKey *r); -WERROR _winreg_UnLoadKey(pipes_struct *p, struct winreg_UnLoadKey *r); -WERROR _winreg_ReplaceKey(pipes_struct *p, struct winreg_ReplaceKey *r); -WERROR _winreg_LoadKey(pipes_struct *p, struct winreg_LoadKey *r); -WERROR _winreg_NotifyChangeKeyValue(pipes_struct *p, struct winreg_NotifyChangeKeyValue *r); -WERROR _winreg_QueryMultipleValues(pipes_struct *p, struct winreg_QueryMultipleValues *r); -WERROR _winreg_QueryMultipleValues2(pipes_struct *p, struct winreg_QueryMultipleValues2 *r); - -/* The following definitions come from rpc_server/srv_wkssvc_nt.c */ - -WERROR _wkssvc_NetWkstaGetInfo(pipes_struct *p, struct wkssvc_NetWkstaGetInfo *r); -WERROR _wkssvc_NetWkstaSetInfo(pipes_struct *p, struct wkssvc_NetWkstaSetInfo *r); -WERROR _wkssvc_NetWkstaEnumUsers(pipes_struct *p, struct wkssvc_NetWkstaEnumUsers *r); -WERROR _wkssvc_NetrWkstaUserGetInfo(pipes_struct *p, struct wkssvc_NetrWkstaUserGetInfo *r); -WERROR _wkssvc_NetrWkstaUserSetInfo(pipes_struct *p, struct wkssvc_NetrWkstaUserSetInfo *r); -WERROR _wkssvc_NetWkstaTransportEnum(pipes_struct *p, struct wkssvc_NetWkstaTransportEnum *r); -WERROR _wkssvc_NetrWkstaTransportAdd(pipes_struct *p, struct wkssvc_NetrWkstaTransportAdd *r); -WERROR _wkssvc_NetrWkstaTransportDel(pipes_struct *p, struct wkssvc_NetrWkstaTransportDel *r); -WERROR _wkssvc_NetrUseAdd(pipes_struct *p, struct wkssvc_NetrUseAdd *r); -WERROR _wkssvc_NetrUseGetInfo(pipes_struct *p, struct wkssvc_NetrUseGetInfo *r); -WERROR _wkssvc_NetrUseDel(pipes_struct *p, struct wkssvc_NetrUseDel *r); -WERROR _wkssvc_NetrUseEnum(pipes_struct *p, struct wkssvc_NetrUseEnum *r); -WERROR _wkssvc_NetrMessageBufferSend(pipes_struct *p, struct wkssvc_NetrMessageBufferSend *r); -WERROR _wkssvc_NetrWorkstationStatisticsGet(pipes_struct *p, struct wkssvc_NetrWorkstationStatisticsGet *r) ; -WERROR _wkssvc_NetrLogonDomainNameAdd(pipes_struct *p, struct wkssvc_NetrLogonDomainNameAdd *r); -WERROR _wkssvc_NetrLogonDomainNameDel(pipes_struct *p, struct wkssvc_NetrLogonDomainNameDel *r); -WERROR _wkssvc_NetrJoinDomain(pipes_struct *p, struct wkssvc_NetrJoinDomain *r); -WERROR _wkssvc_NetrUnjoinDomain(pipes_struct *p, struct wkssvc_NetrUnjoinDomain *r); -WERROR _wkssvc_NetrRenameMachineInDomain(pipes_struct *p, struct wkssvc_NetrRenameMachineInDomain *r); -WERROR _wkssvc_NetrValidateName(pipes_struct *p, struct wkssvc_NetrValidateName *r); -WERROR _wkssvc_NetrGetJoinInformation(pipes_struct *p, struct wkssvc_NetrGetJoinInformation *r); -WERROR _wkssvc_NetrGetJoinableOus(pipes_struct *p, struct wkssvc_NetrGetJoinableOus *r); -WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, - struct wkssvc_NetrJoinDomain2 *r); -WERROR _wkssvc_NetrUnjoinDomain2(pipes_struct *p, - struct wkssvc_NetrUnjoinDomain2 *r); -WERROR _wkssvc_NetrRenameMachineInDomain2(pipes_struct *p, struct wkssvc_NetrRenameMachineInDomain2 *r); -WERROR _wkssvc_NetrValidateName2(pipes_struct *p, struct wkssvc_NetrValidateName2 *r); -WERROR _wkssvc_NetrGetJoinableOus2(pipes_struct *p, struct wkssvc_NetrGetJoinableOus2 *r); -WERROR _wkssvc_NetrAddAlternateComputerName(pipes_struct *p, struct wkssvc_NetrAddAlternateComputerName *r); -WERROR _wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p, struct wkssvc_NetrRemoveAlternateComputerName *r); -WERROR _wkssvc_NetrSetPrimaryComputername(pipes_struct *p, struct wkssvc_NetrSetPrimaryComputername *r); -WERROR _wkssvc_NetrEnumerateComputerNames(pipes_struct *p, struct wkssvc_NetrEnumerateComputerNames *r); /* The following definitions come from rpcclient/cmd_dfs.c */ diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 119ceeb158..5149da0cb3 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -333,7 +333,7 @@ do { \ /* Warning - this must only be called with 0 <= c < 128. IT WILL * GIVE GARBAGE if c > 128 or c < 0. JRA. */ -extern char toupper_ascii_fast_table[]; +extern const char toupper_ascii_fast_table[]; #define toupper_ascii_fast(c) toupper_ascii_fast_table[(unsigned int)(c)]; #endif diff --git a/source3/lib/display_sec.c b/source3/lib/display_sec.c index a0d93d6fe7..636639c11d 100644 --- a/source3/lib/display_sec.c +++ b/source3/lib/display_sec.c @@ -240,7 +240,7 @@ void display_sec_acl(SEC_ACL *sec_acl) void display_acl_type(uint16 type) { - static fstring typestr=""; + fstring typestr=""; typestr[0] = 0; diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index 9e67c5257d..cad14ec493 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -318,7 +318,7 @@ const struct poptOption popt_common_dynconfig[] = { * exit on failure * ****************************************************************************/ -static void get_password_file(void) +static void get_password_file(struct user_auth_info *auth_info) { int fd = -1; char *p; @@ -377,13 +377,14 @@ static void get_password_file(void) } SAFE_FREE(spec); - set_cmdline_auth_info_password(pass); + set_cmdline_auth_info_password(auth_info, pass); if (close_it) { close(fd); } } -static void get_credentials_file(const char *file) +static void get_credentials_file(struct user_auth_info *auth_info, + const char *file) { XFILE *auth; fstring buf; @@ -426,9 +427,9 @@ static void get_credentials_file(const char *file) val++; if (strwicmp("password", param) == 0) { - set_cmdline_auth_info_password(val); + set_cmdline_auth_info_password(auth_info, val); } else if (strwicmp("username", param) == 0) { - set_cmdline_auth_info_username(val); + set_cmdline_auth_info_username(auth_info, val); } else if (strwicmp("domain", param) == 0) { set_global_myworkgroup(val); } @@ -453,13 +454,16 @@ static void popt_common_credentials_callback(poptContext con, const struct poptOption *opt, const char *arg, const void *data) { + struct user_auth_info *auth_info = talloc_get_type_abort( + *((const char **)data), struct user_auth_info); char *p; if (reason == POPT_CALLBACK_REASON_PRE) { - set_cmdline_auth_info_username("GUEST"); + set_cmdline_auth_info_username(auth_info, "GUEST"); if (getenv("LOGNAME")) { - set_cmdline_auth_info_username(getenv("LOGNAME")); + set_cmdline_auth_info_username(auth_info, + getenv("LOGNAME")); } if (getenv("USER")) { @@ -467,24 +471,25 @@ static void popt_common_credentials_callback(poptContext con, if (!puser) { exit(ENOMEM); } - set_cmdline_auth_info_username(puser); + set_cmdline_auth_info_username(auth_info, puser); if ((p = strchr_m(puser,'%'))) { size_t len; *p = 0; len = strlen(p+1); - set_cmdline_auth_info_password(p+1); + set_cmdline_auth_info_password(auth_info, p+1); memset(strchr_m(getenv("USER"),'%')+1,'X',len); } SAFE_FREE(puser); } if (getenv("PASSWD")) { - set_cmdline_auth_info_password(getenv("PASSWD")); + set_cmdline_auth_info_password(auth_info, + getenv("PASSWD")); } if (getenv("PASSWD_FD") || getenv("PASSWD_FILE")) { - get_password_file(); + get_password_file(auth_info); } return; @@ -499,19 +504,22 @@ static void popt_common_credentials_callback(poptContext con, if ((lp=strchr_m(puser,'%'))) { size_t len; *lp = 0; - set_cmdline_auth_info_username(puser); - set_cmdline_auth_info_password(lp+1); + set_cmdline_auth_info_username(auth_info, + puser); + set_cmdline_auth_info_password(auth_info, + lp+1); len = strlen(lp+1); memset(strchr_m(arg,'%')+1,'X',len); } else { - set_cmdline_auth_info_username(puser); + set_cmdline_auth_info_username(auth_info, + puser); } SAFE_FREE(puser); } break; case 'A': - get_credentials_file(arg); + get_credentials_file(auth_info, arg); break; case 'k': @@ -519,31 +527,40 @@ static void popt_common_credentials_callback(poptContext con, d_printf("No kerberos support compiled in\n"); exit(1); #else - set_cmdline_auth_info_use_krb5_ticket(); + set_cmdline_auth_info_use_krb5_ticket(auth_info); #endif break; case 'S': - if (!set_cmdline_auth_info_signing_state(arg)) { + if (!set_cmdline_auth_info_signing_state(auth_info, arg)) { fprintf(stderr, "Unknown signing option %s\n", arg ); exit(1); } break; case 'P': - set_cmdline_auth_info_use_machine_account(); + set_cmdline_auth_info_use_machine_account(auth_info); break; case 'N': - set_cmdline_auth_info_password(""); + set_cmdline_auth_info_password(auth_info, ""); break; case 'e': - set_cmdline_auth_info_smb_encrypt(); + set_cmdline_auth_info_smb_encrypt(auth_info); break; } } +static struct user_auth_info *global_auth_info; + +void popt_common_set_auth_info(struct user_auth_info *auth_info) +{ + global_auth_info = auth_info; +} + struct poptOption popt_common_credentials[] = { - { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE, (void *)popt_common_credentials_callback }, + { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE, + (void *)popt_common_credentials_callback, 0, + (const char *)&global_auth_info }, { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "USERNAME" }, { "no-pass", 'N', POPT_ARG_NONE, NULL, 'N', "Don't ask for a password" }, { "kerberos", 'k', POPT_ARG_NONE, NULL, 'k', "Use kerberos (active directory) authentication" }, diff --git a/source3/lib/util.c b/source3/lib/util.c index 074b523ae0..dd23d547b5 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -280,135 +280,154 @@ bool init_names(void) Used mainly in client tools. ****************************************************************************/ -static struct user_auth_info cmdline_auth_info = { - NULL, /* username */ - NULL, /* password */ - false, /* got_pass */ - false, /* use_kerberos */ - Undefined, /* signing state */ - false, /* smb_encrypt */ - false /* use machine account */ -}; - -const char *get_cmdline_auth_info_username(void) -{ - if (!cmdline_auth_info.username) { +struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx) +{ + struct user_auth_info *result; + + result = TALLOC_ZERO_P(mem_ctx, struct user_auth_info); + if (result == NULL) { + return NULL; + } + + result->signing_state = Undefined; + return result; +} + +const char *get_cmdline_auth_info_username(struct user_auth_info *auth_info) +{ + if (!auth_info->username) { return ""; } - return cmdline_auth_info.username; + return auth_info->username; } -void set_cmdline_auth_info_username(const char *username) +void set_cmdline_auth_info_username(struct user_auth_info *auth_info, + const char *username) { - SAFE_FREE(cmdline_auth_info.username); - cmdline_auth_info.username = SMB_STRDUP(username); - if (!cmdline_auth_info.username) { + TALLOC_FREE(auth_info->username); + auth_info->username = talloc_strdup(auth_info, username); + if (!auth_info->username) { exit(ENOMEM); } } -const char *get_cmdline_auth_info_password(void) +const char *get_cmdline_auth_info_password(struct user_auth_info *auth_info) { - if (!cmdline_auth_info.password) { + if (!auth_info->password) { return ""; } - return cmdline_auth_info.password; + return auth_info->password; } -void set_cmdline_auth_info_password(const char *password) +void set_cmdline_auth_info_password(struct user_auth_info *auth_info, + const char *password) { - SAFE_FREE(cmdline_auth_info.password); - cmdline_auth_info.password = SMB_STRDUP(password); - if (!cmdline_auth_info.password) { + TALLOC_FREE(auth_info->password); + auth_info->password = talloc_strdup(auth_info, password); + if (!auth_info->password) { exit(ENOMEM); } - cmdline_auth_info.got_pass = true; + auth_info->got_pass = true; } -bool set_cmdline_auth_info_signing_state(const char *arg) +bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info, + const char *arg) { - cmdline_auth_info.signing_state = -1; + auth_info->signing_state = -1; if (strequal(arg, "off") || strequal(arg, "no") || strequal(arg, "false")) { - cmdline_auth_info.signing_state = false; + auth_info->signing_state = false; } else if (strequal(arg, "on") || strequal(arg, "yes") || strequal(arg, "true") || strequal(arg, "auto")) { - cmdline_auth_info.signing_state = true; + auth_info->signing_state = true; } else if (strequal(arg, "force") || strequal(arg, "required") || strequal(arg, "forced")) { - cmdline_auth_info.signing_state = Required; + auth_info->signing_state = Required; } else { return false; } return true; } -int get_cmdline_auth_info_signing_state(void) +int get_cmdline_auth_info_signing_state(struct user_auth_info *auth_info) { - return cmdline_auth_info.signing_state; + return auth_info->signing_state; } -void set_cmdline_auth_info_use_kerberos(bool b) +void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info, + bool b) { - cmdline_auth_info.use_kerberos = b; + auth_info->use_kerberos = b; } -bool get_cmdline_auth_info_use_kerberos(void) +bool get_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info) { - return cmdline_auth_info.use_kerberos; + return auth_info->use_kerberos; } /* This should only be used by lib/popt_common.c JRA */ -void set_cmdline_auth_info_use_krb5_ticket(void) +void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info) { - cmdline_auth_info.use_kerberos = true; - cmdline_auth_info.got_pass = true; + auth_info->use_kerberos = true; + auth_info->got_pass = true; } /* This should only be used by lib/popt_common.c JRA */ -void set_cmdline_auth_info_smb_encrypt(void) +void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info) { - cmdline_auth_info.smb_encrypt = true; + auth_info->smb_encrypt = true; } -void set_cmdline_auth_info_use_machine_account(void) +void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info) { - cmdline_auth_info.use_machine_account = true; + auth_info->use_machine_account = true; } -bool get_cmdline_auth_info_got_pass(void) +bool get_cmdline_auth_info_got_pass(struct user_auth_info *auth_info) { - return cmdline_auth_info.got_pass; + return auth_info->got_pass; } -bool get_cmdline_auth_info_smb_encrypt(void) +bool get_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info) { - return cmdline_auth_info.smb_encrypt; + return auth_info->smb_encrypt; } -bool get_cmdline_auth_info_use_machine_account(void) +bool get_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info) { - return cmdline_auth_info.use_machine_account; + return auth_info->use_machine_account; } -bool get_cmdline_auth_info_copy(struct user_auth_info *info) +struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx, + struct user_auth_info *src) { - *info = cmdline_auth_info; - /* Now re-alloc the strings. */ - info->username = SMB_STRDUP(get_cmdline_auth_info_username()); - info->password = SMB_STRDUP(get_cmdline_auth_info_password()); - if (!info->username || !info->password) { - return false; + struct user_auth_info *result; + + result = user_auth_info_init(mem_ctx); + if (result == NULL) { + return NULL; } - return true; + + *result = *src; + + result->username = talloc_strdup( + result, get_cmdline_auth_info_username(src)); + result->password = talloc_strdup( + result, get_cmdline_auth_info_password(src)); + if ((result->username == NULL) || (result->password == NULL)) { + TALLOC_FREE(result); + return NULL; + } + + return result; } -bool set_cmdline_auth_info_machine_account_creds(void) +bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info) { char *pass = NULL; char *account = NULL; - if (!get_cmdline_auth_info_use_machine_account()) { + if (!get_cmdline_auth_info_use_machine_account(auth_info)) { return false; } @@ -430,8 +449,8 @@ bool set_cmdline_auth_info_machine_account_creds(void) return false; } - set_cmdline_auth_info_username(account); - set_cmdline_auth_info_password(pass); + set_cmdline_auth_info_username(auth_info, account); + set_cmdline_auth_info_password(auth_info, pass); SAFE_FREE(account); SAFE_FREE(pass); diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index fde4f825e8..9358061797 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -24,7 +24,7 @@ #include "includes.h" -char toupper_ascii_fast_table[128] = { +const char toupper_ascii_fast_table[128] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 932e42e076..cf8a7ebb1b 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -162,6 +162,11 @@ bool ads_closest_dc(ADS_STRUCT *ads) return True; } + if (ads->config.client_site_name == NULL) { + DEBUG(10,("ads_closest_dc: client belongs to no site\n")); + return True; + } + DEBUG(10,("ads_closest_dc: %s is not the closest DC\n", ads->config.ldap_server_name)); @@ -267,10 +272,12 @@ static bool ads_try_connect(ADS_STRUCT *ads, const char *server, bool gc) static NTSTATUS ads_find_dc(ADS_STRUCT *ads) { + const char *c_domain; const char *c_realm; int count, i=0; struct ip_service *ip_list; const char *realm; + const char *domain; bool got_realm = False; bool use_own_domain = False; char *sitename; @@ -308,13 +315,44 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) return NT_STATUS_INVALID_PARAMETER; /* rather need MISSING_PARAMETER ... */ } + if ( use_own_domain ) { + c_domain = lp_workgroup(); + } else { + c_domain = ads->server.workgroup; + } + realm = c_realm; + domain = c_domain; + + /* + * In case of LDAP we use get_dc_name() as that + * creates the custom krb5.conf file + */ + if (!(ads->auth.flags & ADS_AUTH_NO_BIND)) { + fstring srv_name; + struct sockaddr_storage ip_out; + + DEBUG(6,("ads_find_dc: (ldap) looking for %s '%s'\n", + (got_realm ? "realm" : "domain"), realm)); + + if (get_dc_name(domain, realm, srv_name, &ip_out)) { + /* + * we call ads_try_connect() to fill in the + * ads->config details + */ + if (ads_try_connect(ads, srv_name, false)) { + return NT_STATUS_OK; + } + } + + return NT_STATUS_NO_LOGON_SERVERS; + } sitename = sitename_fetch(realm); again: - DEBUG(6,("ads_find_dc: looking for %s '%s'\n", + DEBUG(6,("ads_find_dc: (cldap) looking for %s '%s'\n", (got_realm ? "realm" : "domain"), realm)); status = get_sorted_dc_list(realm, sitename, &ip_list, &count, got_realm); @@ -613,9 +651,8 @@ got_connection: /* cache the successful connection for workgroup and realm */ if (ads_closest_dc(ads)) { - print_sockaddr(addr, sizeof(addr), &ads->ldap.ss); - saf_store( ads->server.workgroup, addr); - saf_store( ads->server.realm, addr); + saf_store( ads->server.workgroup, ads->config.ldap_server_name); + saf_store( ads->server.realm, ads->config.ldap_server_name); } ldap_set_option(ads->ldap.ld, LDAP_OPT_PROTOCOL_VERSION, &version); diff --git a/source3/libads/ndr.c b/source3/libads/ndr.c index 6324a22041..6ada66ca40 100644 --- a/source3/libads/ndr.c +++ b/source3/libads/ndr.c @@ -75,7 +75,6 @@ void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ndr_print_string(ndr, "server_site_name", r->config.server_site_name); ndr_print_string(ndr, "client_site_name", r->config.client_site_name); ndr_print_time_t(ndr, "current_time", r->config.current_time); - ndr_print_bool(ndr, "tried_closest_dc", r->config.tried_closest_dc); ndr_print_string(ndr, "schema_path", r->config.schema_path); ndr_print_string(ndr, "config_path", r->config.config_path); ndr->depth--; diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 908fb78ab4..691f6ff8eb 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1521,7 +1521,10 @@ static WERROR libnet_join_post_processing(TALLOC_CTX *mem_ctx, return WERR_OK; } - saf_store(r->in.domain_name, r->in.dc_name); + saf_join_store(r->out.netbios_domain_name, r->in.dc_name); + if (r->out.dns_domain_name) { + saf_join_store(r->out.dns_domain_name, r->in.dc_name); + } #ifdef WITH_ADS if (r->out.domain_is_ad) { @@ -1752,6 +1755,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, r->in.domain_name, NULL, NULL, + DS_FORCE_REDISCOVERY | DS_DIRECTORY_SERVICE_REQUIRED | DS_WRITABLE_REQUIRED | DS_RETURN_DNS_NAME, diff --git a/source3/librpc/gen_ndr/cli_netlogon.c b/source3/librpc/gen_ndr/cli_netlogon.c index a1bcb2cb38..1ce4e67c56 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.c +++ b/source3/librpc/gen_ndr/cli_netlogon.c @@ -2306,8 +2306,7 @@ NTSTATUS rpccli_netr_ServerGetTrustInfo(struct rpc_pipe_client *cli, struct netr_Authenticator *return_authenticator /* [out] [ref] */, struct samr_Password *new_owf_password /* [out] [ref] */, struct samr_Password *old_owf_password /* [out] [ref] */, - struct netr_TrustInfo **trust_info /* [out] [ref] */, - WERROR *werror) + struct netr_TrustInfo **trust_info /* [out] [ref] */) { struct netr_ServerGetTrustInfo r; NTSTATUS status; @@ -2348,10 +2347,6 @@ NTSTATUS rpccli_netr_ServerGetTrustInfo(struct rpc_pipe_client *cli, *trust_info = *r.out.trust_info; /* Return result */ - if (werror) { - *werror = r.out.result; - } - - return werror_to_ntstatus(r.out.result); + return r.out.result; } diff --git a/source3/librpc/gen_ndr/cli_netlogon.h b/source3/librpc/gen_ndr/cli_netlogon.h index 7a2d43b3c1..3fbc00e9da 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.h +++ b/source3/librpc/gen_ndr/cli_netlogon.h @@ -366,6 +366,5 @@ NTSTATUS rpccli_netr_ServerGetTrustInfo(struct rpc_pipe_client *cli, struct netr_Authenticator *return_authenticator /* [out] [ref] */, struct samr_Password *new_owf_password /* [out] [ref] */, struct samr_Password *old_owf_password /* [out] [ref] */, - struct netr_TrustInfo **trust_info /* [out] [ref] */, - WERROR *werror); + struct netr_TrustInfo **trust_info /* [out] [ref] */); #endif /* __CLI_NETLOGON__ */ diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c index af8228cd5a..81f8ddcab9 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.c +++ b/source3/librpc/gen_ndr/ndr_netlogon.c @@ -15613,7 +15613,7 @@ static enum ndr_err_code ndr_push_netr_ServerGetTrustInfo(struct ndr_push *ndr, if (*r->out.trust_info) { NDR_CHECK(ndr_push_netr_TrustInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.trust_info)); } - NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } @@ -15721,7 +15721,7 @@ static enum ndr_err_code ndr_pull_netr_ServerGetTrustInfo(struct ndr_pull *ndr, NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trust_info_1, 0); } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trust_info_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } @@ -15781,7 +15781,7 @@ _PUBLIC_ void ndr_print_netr_ServerGetTrustInfo(struct ndr_print *ndr, const cha } ndr->depth--; ndr->depth--; - ndr_print_WERROR(ndr, "result", r->out.result); + ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; } ndr->depth--; diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h index 02a4a447e0..7fb253446a 100644 --- a/source3/librpc/gen_ndr/netlogon.h +++ b/source3/librpc/gen_ndr/netlogon.h @@ -1727,7 +1727,7 @@ struct netr_ServerGetTrustInfo { struct samr_Password *new_owf_password;/* [ref] */ struct samr_Password *old_owf_password;/* [ref] */ struct netr_TrustInfo **trust_info;/* [ref] */ - WERROR result; + NTSTATUS result; } out; }; diff --git a/source3/librpc/gen_ndr/srv_netlogon.h b/source3/librpc/gen_ndr/srv_netlogon.h index 3bbe4d02fa..cd68d12f1e 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.h +++ b/source3/librpc/gen_ndr/srv_netlogon.h @@ -47,7 +47,7 @@ NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p, struct netr_ServerTrustP WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p, struct netr_DsRGetForestTrustInformation *r); WERROR _netr_GetForestTrustInformation(pipes_struct *p, struct netr_GetForestTrustInformation *r); NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p, struct netr_LogonSamLogonWithFlags *r); -WERROR _netr_ServerGetTrustInfo(pipes_struct *p, struct netr_ServerGetTrustInfo *r); +NTSTATUS _netr_ServerGetTrustInfo(pipes_struct *p, struct netr_ServerGetTrustInfo *r); void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns); NTSTATUS rpc_netlogon_init(void); #endif /* __SRV_NETLOGON__ */ diff --git a/source3/librpc/rpc/dcerpc.c b/source3/librpc/rpc/dcerpc.c index 77bb7b33a2..69bfc6f329 100644 --- a/source3/librpc/rpc/dcerpc.c +++ b/source3/librpc/rpc/dcerpc.c @@ -117,6 +117,10 @@ NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req) return NT_STATUS_OK; } +#if 0 + +Completely unfinished and unused -- vl :-) + /** * Connect to a DCE/RPC interface. * @@ -178,3 +182,5 @@ _PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe return nt_status; } + +#endif diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index d33775fbb8..125345fccb 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -22,22 +22,21 @@ static const struct { int prot; - const char *name; -} prots[] = { - {PROTOCOL_CORE,"PC NETWORK PROGRAM 1.0"}, - {PROTOCOL_COREPLUS,"MICROSOFT NETWORKS 1.03"}, - {PROTOCOL_LANMAN1,"MICROSOFT NETWORKS 3.0"}, - {PROTOCOL_LANMAN1,"LANMAN1.0"}, - {PROTOCOL_LANMAN2,"LM1.2X002"}, - {PROTOCOL_LANMAN2,"DOS LANMAN2.1"}, - {PROTOCOL_LANMAN2,"LANMAN2.1"}, - {PROTOCOL_LANMAN2,"Samba"}, - {PROTOCOL_NT1,"NT LANMAN 1.0"}, - {PROTOCOL_NT1,"NT LM 0.12"}, - {-1,NULL} + const char name[24]; +} prots[10] = { + {PROTOCOL_CORE, "PC NETWORK PROGRAM 1.0"}, + {PROTOCOL_COREPLUS, "MICROSOFT NETWORKS 1.03"}, + {PROTOCOL_LANMAN1, "MICROSOFT NETWORKS 3.0"}, + {PROTOCOL_LANMAN1, "LANMAN1.0"}, + {PROTOCOL_LANMAN2, "LM1.2X002"}, + {PROTOCOL_LANMAN2, "DOS LANMAN2.1"}, + {PROTOCOL_LANMAN2, "LANMAN2.1"}, + {PROTOCOL_LANMAN2, "Samba"}, + {PROTOCOL_NT1, "NT LANMAN 1.0"}, + {PROTOCOL_NT1, "NT LM 0.12"}, }; -static const char *star_smbserver_name = "*SMBSERVER"; +#define STAR_SMBSERVER "*SMBSERVER" /** * Set the user session key for a connection @@ -863,7 +862,7 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user, if (principal == NULL && !is_ipaddress(cli->desthost) && - !strequal(star_smbserver_name, + !strequal(STAR_SMBSERVER, cli->desthost)) { char *realm = NULL; char *machine = NULL; @@ -1221,9 +1220,10 @@ void cli_negprot_send(struct cli_state *cli) cli_set_message(cli->outbuf,0,0,True); p = smb_buf(cli->outbuf); - for (numprots=0; - prots[numprots].name && prots[numprots].prot<=cli->protocol; - numprots++) { + for (numprots=0; numprots < ARRAY_SIZE(prots); numprots++) { + if (prots[numprots].prot > cli->protocol) { + break; + } *p++ = 2; p += clistr_push(cli, p, prots[numprots].name, -1, STR_TERMINATE); } @@ -1252,18 +1252,23 @@ bool cli_negprot(struct cli_state *cli) memset(cli->outbuf,'\0',smb_size); + plength = 0; + /* setup the protocol strings */ - for (plength=0,numprots=0; - prots[numprots].name && prots[numprots].prot<=cli->protocol; - numprots++) + for (numprots=0; numprots < ARRAY_SIZE(prots); numprots++) { + if (prots[numprots].prot > cli->protocol) { + break; + } plength += strlen(prots[numprots].name)+2; + } cli_set_message(cli->outbuf,0,plength,True); p = smb_buf(cli->outbuf); - for (numprots=0; - prots[numprots].name && prots[numprots].prot<=cli->protocol; - numprots++) { + for (numprots=0; numprots < ARRAY_SIZE(prots); numprots++) { + if (prots[numprots].prot > cli->protocol) { + break; + } *p++ = 2; p += clistr_push(cli, p, prots[numprots].name, -1, STR_TERMINATE); } @@ -1495,7 +1500,7 @@ NTSTATUS cli_connect(struct cli_state *cli, /* reasonable default hostname */ if (!host) { - host = star_smbserver_name; + host = STAR_SMBSERVER; } fstrcpy(cli->desthost, host); @@ -1643,8 +1648,8 @@ again: *p = 0; goto again; } - if (strcmp(called.name, star_smbserver_name)) { - make_nmb_name(&called , star_smbserver_name, 0x20); + if (strcmp(called.name, STAR_SMBSERVER)) { + make_nmb_name(&called , STAR_SMBSERVER, 0x20); goto again; } return NT_STATUS_BAD_NETWORK_NAME; @@ -1774,7 +1779,7 @@ bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srcho */ if(is_ipaddress(desthost)) { - make_nmb_name(&called, star_smbserver_name, 0x20); + make_nmb_name(&called, STAR_SMBSERVER, 0x20); } else { make_nmb_name(&called, desthost, 0x20); } @@ -1783,7 +1788,7 @@ bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srcho NTSTATUS status; struct nmb_name smbservername; - make_nmb_name(&smbservername, star_smbserver_name, 0x20); + make_nmb_name(&smbservername, STAR_SMBSERVER, 0x20); /* * If the name wasn't *SMBSERVER then diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 35922b13e9..f0ac39fed0 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -471,18 +471,19 @@ static void cm_set_password(const char *newpass) /**************************************************************************** ****************************************************************************/ -void cli_cm_set_credentials(void) +void cli_cm_set_credentials(struct user_auth_info *auth_info) { SAFE_FREE(cm_creds.username); - cm_creds.username = SMB_STRDUP(get_cmdline_auth_info_username()); + cm_creds.username = SMB_STRDUP(get_cmdline_auth_info_username( + auth_info)); - if (get_cmdline_auth_info_got_pass()) { - cm_set_password(get_cmdline_auth_info_password()); + if (get_cmdline_auth_info_got_pass(auth_info)) { + cm_set_password(get_cmdline_auth_info_password(auth_info)); } - cm_creds.use_kerberos = get_cmdline_auth_info_use_kerberos(); + cm_creds.use_kerberos = get_cmdline_auth_info_use_kerberos(auth_info); cm_creds.fallback_after_kerberos = false; - cm_creds.signing_state = get_cmdline_auth_info_signing_state(); + cm_creds.signing_state = get_cmdline_auth_info_signing_state(auth_info); } /**************************************************************************** diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index ecf49396d1..1c2a0d56c4 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -109,6 +109,7 @@ NTSTATUS cli_read_andx_recv(struct async_req *req, ssize_t *received, uint16_t *vwv; uint16_t num_bytes; uint8_t *bytes; + uint8_t *buf; NTSTATUS status; size_t size; @@ -136,6 +137,24 @@ NTSTATUS cli_read_andx_recv(struct async_req *req, ssize_t *received, return NT_STATUS_UNEXPECTED_IO_ERROR; } + /* + * bcc field must be valid for small reads, for large reads the 16-bit + * bcc field can't be correct. + */ + + if ((size < 0xffff) && (size > num_bytes)) { + DEBUG(5, ("server announced more bytes than sent\n")); + return NT_STATUS_INVALID_NETWORK_RESPONSE; + } + + buf = (uint8_t *)smb_base(cli_req->inbuf) + SVAL(vwv+6, 0); + + if (trans_oob(smb_len(cli_req->inbuf), SVAL(vwv+6, 0), size) + || (buf < bytes)) { + DEBUG(5, ("server returned invalid read&x data offset\n")); + return NT_STATUS_INVALID_NETWORK_RESPONSE; + } + *rcvbuf = (uint8_t *)(smb_base(cli_req->inbuf) + SVAL(vwv + 6, 0)); *received = size; return NT_STATUS_OK; diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index d8c2b70175..3491544175 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -1119,6 +1119,27 @@ static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx, num_dcs, info); } +static bool is_closest_site(struct netr_DsRGetDCNameInfo *info) +{ + if (info->dc_flags & DS_SERVER_CLOSEST) { + return true; + } + + if (!info->client_site_name) { + return true; + } + + if (!info->dc_site_name) { + return false; + } + + if (strcmp(info->client_site_name, info->dc_site_name) == 0) { + return true; + } + + return false; +} + /******************************************************************** dsgetdcname. @@ -1136,6 +1157,8 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; struct netr_DsRGetDCNameInfo *myinfo = NULL; char *query_site = NULL; + bool first = true; + struct netr_DsRGetDCNameInfo *first_info = NULL; DEBUG(10,("dsgetdcname: domain_name: %s, " "domain_guid: %s, site_name: %s, flags: 0x%08x\n", @@ -1163,7 +1186,6 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, status = dsgetdcname_cached(mem_ctx, msg_ctx, domain_name, domain_guid, flags, query_site, &myinfo); if (NT_STATUS_IS_OK(status)) { - *info = myinfo; goto done; } @@ -1176,12 +1198,27 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, domain_guid, flags, query_site, &myinfo); - if (NT_STATUS_IS_OK(status)) { - *info = myinfo; - } - done: SAFE_FREE(query_site); - return status; + if (!NT_STATUS_IS_OK(status)) { + if (!first) { + *info = first_info; + return NT_STATUS_OK; + } + return status; + } + + if (!first) { + TALLOC_FREE(first_info); + } else if (!is_closest_site(myinfo)) { + first = false; + first_info = myinfo; + /* TODO: may use the next_closest_site here */ + query_site = SMB_STRDUP(myinfo->client_site_name); + goto rediscover; + } + + *info = myinfo; + return NT_STATUS_OK; } diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index 19843383de..becee17f65 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -633,13 +633,19 @@ smbc_set_credentials(char *workgroup, smbc_bool use_kerberos, char *signing_state) { - - set_cmdline_auth_info_username(user); - set_cmdline_auth_info_password(password); - set_cmdline_auth_info_use_kerberos(use_kerberos); - if (! set_cmdline_auth_info_signing_state(signing_state)) { + struct user_auth_info *auth_info; + + auth_info = user_auth_info_init(talloc_tos()); + if (auth_info == NULL) { + return; + } + set_cmdline_auth_info_username(auth_info, user); + set_cmdline_auth_info_password(auth_info, password); + set_cmdline_auth_info_use_kerberos(auth_info, use_kerberos); + if (! set_cmdline_auth_info_signing_state(auth_info, signing_state)) { DEBUG(0, ("Invalid signing state: %s", signing_state)); } set_global_myworkgroup(workgroup); - cli_cm_set_credentials(); + cli_cm_set_credentials(auth_info); + TALLOC_FREE(auth_info); } diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index aa313f2c05..d12e7487f6 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -1193,8 +1193,6 @@ SMBC_mkdir_ctx(SMBCCTX *context, * Our list function simply checks to see if a directory is not empty */ -static int smbc_rmdir_dirempty = True; - static void rmdir_list_fn(const char *mnt, file_info *finfo, @@ -1203,7 +1201,8 @@ rmdir_list_fn(const char *mnt, { if (strncmp(finfo->name, ".", 1) != 0 && strncmp(finfo->name, "..", 2) != 0) { - smbc_rmdir_dirempty = False; + bool *smbc_rmdir_dirempty = (bool *)state; + *smbc_rmdir_dirempty = false; } } @@ -1292,8 +1291,7 @@ SMBC_rmdir_ctx(SMBCCTX *context, /* Local storage to avoid buffer overflows */ char *lpath; - - smbc_rmdir_dirempty = True; /* Make this so ... */ + bool smbc_rmdir_dirempty = true; lpath = talloc_asprintf(frame, "%s\\*", targetpath); @@ -1305,7 +1303,8 @@ SMBC_rmdir_ctx(SMBCCTX *context, if (cli_list(targetcli, lpath, aDIR | aSYSTEM | aHIDDEN, - rmdir_list_fn, NULL) < 0) { + rmdir_list_fn, + &smbc_rmdir_dirempty) < 0) { /* Fix errno to ignore latest error ... */ DEBUG(5, ("smbc_rmdir: " diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index bcf849b795..05679570d4 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -34,6 +34,8 @@ bool global_in_nmbd = False; ****************************************************************************/ #define SAFKEY_FMT "SAF/DOMAIN/%s" #define SAF_TTL 900 +#define SAFJOINKEY_FMT "SAFJOIN/DOMAIN/%s" +#define SAFJOIN_TTL 3600 static char *saf_key(const char *domain) { @@ -44,6 +46,15 @@ static char *saf_key(const char *domain) return keystr; } +static char *saf_join_key(const char *domain) +{ + char *keystr; + + asprintf_strupper_m(&keystr, SAFJOINKEY_FMT, domain); + + return keystr; +} + /**************************************************************************** ****************************************************************************/ @@ -69,7 +80,7 @@ bool saf_store( const char *domain, const char *servername ) return False; key = saf_key( domain ); - expire = time( NULL ) + SAF_TTL; + expire = time( NULL ) + lp_parm_int(-1, "saf","ttl", SAF_TTL); DEBUG(10,("saf_store: domain = [%s], server = [%s], expire = [%u]\n", domain, servername, (unsigned int)expire )); @@ -81,6 +92,38 @@ bool saf_store( const char *domain, const char *servername ) return ret; } +bool saf_join_store( const char *domain, const char *servername ) +{ + char *key; + time_t expire; + bool ret = False; + + if ( !domain || !servername ) { + DEBUG(2,("saf_join_store: Refusing to store empty domain or servername!\n")); + return False; + } + + if ( (strlen(domain) == 0) || (strlen(servername) == 0) ) { + DEBUG(0,("saf_join_store: refusing to store 0 length domain or servername!\n")); + return False; + } + + if ( !gencache_init() ) + return False; + + key = saf_join_key( domain ); + expire = time( NULL ) + lp_parm_int(-1, "saf","join ttl", SAFJOIN_TTL); + + DEBUG(10,("saf_join_store: domain = [%s], server = [%s], expire = [%u]\n", + domain, servername, (unsigned int)expire )); + + ret = gencache_set( key, servername, expire ); + + SAFE_FREE( key ); + + return ret; +} + bool saf_delete( const char *domain ) { char *key; @@ -94,15 +137,22 @@ bool saf_delete( const char *domain ) if ( !gencache_init() ) return False; + key = saf_join_key(domain); + ret = gencache_del(key); + SAFE_FREE(key); + + if (ret) { + DEBUG(10,("saf_delete[join]: domain = [%s]\n", domain )); + } + key = saf_key(domain); ret = gencache_del(key); + SAFE_FREE(key); if (ret) { DEBUG(10,("saf_delete: domain = [%s]\n", domain )); } - SAFE_FREE( key ); - return ret; } @@ -124,6 +174,18 @@ char *saf_fetch( const char *domain ) if ( !gencache_init() ) return False; + key = saf_join_key( domain ); + + ret = gencache_get( key, &server, &timeout ); + + SAFE_FREE( key ); + + if ( ret ) { + DEBUG(5,("saf_fetch[join]: Returning \"%s\" for \"%s\" domain\n", + server, domain )); + return server; + } + key = saf_key( domain ); ret = gencache_get( key, &server, &timeout ); @@ -2098,6 +2160,15 @@ NTSTATUS get_sorted_dc_list( const char *domain, status = get_dc_list(domain, sitename, ip_list, count, lookup_type, &ordered); + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_LOGON_SERVERS) + && sitename) { + DEBUG(3,("get_sorted_dc_list: no server for name %s available" + " in site %s, fallback to all servers\n", + domain, sitename)); + status = get_dc_list(domain, NULL, ip_list, + count, lookup_type, &ordered); + } + if (!NT_STATUS_IS_OK(status)) { SAFE_FREE(*ip_list); *count = 0; diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index 46450059f4..038690d0f1 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -1402,10 +1402,10 @@ NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p, /**************************************************************** ****************************************************************/ -WERROR _netr_ServerGetTrustInfo(pipes_struct *p, - struct netr_ServerGetTrustInfo *r) +NTSTATUS _netr_ServerGetTrustInfo(pipes_struct *p, + struct netr_ServerGetTrustInfo *r) { p->rng_fault_state = true; - return WERR_NOT_SUPPORTED; + return NT_STATUS_NOT_IMPLEMENTED; } diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 26a73203b9..038acfbcdc 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -2641,6 +2641,8 @@ done: /**************************************************************************** ****************************************************************************/ +extern struct user_auth_info *rpcclient_auth_info; + static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) @@ -2671,11 +2673,11 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli, nt_status = cli_full_connection(&cli_server2, global_myname(), servername2, NULL, 0, "IPC$", "IPC", - get_cmdline_auth_info_username(), + get_cmdline_auth_info_username(rpcclient_auth_info), lp_workgroup(), - get_cmdline_auth_info_password(), - get_cmdline_auth_info_use_kerberos() ? CLI_FULL_CONNECTION_USE_KERBEROS : 0, - get_cmdline_auth_info_signing_state(), NULL); + get_cmdline_auth_info_password(rpcclient_auth_info), + get_cmdline_auth_info_use_kerberos(rpcclient_auth_info) ? CLI_FULL_CONNECTION_USE_KERBEROS : 0, + get_cmdline_auth_info_signing_state(rpcclient_auth_info), NULL); if ( !NT_STATUS_IS_OK(nt_status) ) return WERR_GENERAL_FAILURE; diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index e8ffddb6dc..dc125007e3 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -28,6 +28,8 @@ static enum pipe_auth_type pipe_default_auth_type = PIPE_AUTH_TYPE_NONE; static enum pipe_auth_level pipe_default_auth_level = PIPE_AUTH_LEVEL_NONE; static unsigned int timeout = 0; +struct user_auth_info *rpcclient_auth_info; + /* List to hold groups of commands. * * Commands are defined in a list of arrays: arrays are easy to @@ -560,6 +562,7 @@ static void add_command_set(struct cmd_set *cmd_set) * @param cmd Command to run, as a single string. **/ static NTSTATUS do_cmd(struct cli_state *cli, + struct user_auth_info *auth_info, struct cmd_set *cmd_entry, int argc, char **argv) { @@ -589,8 +592,8 @@ static NTSTATUS do_cmd(struct cli_state *cli, cli, cmd_entry->interface, pipe_default_auth_level, lp_workgroup(), - get_cmdline_auth_info_username(), - get_cmdline_auth_info_password(), + get_cmdline_auth_info_username(auth_info), + get_cmdline_auth_info_password(auth_info), &cmd_entry->rpc_pipe); break; case PIPE_AUTH_TYPE_NTLMSSP: @@ -598,8 +601,8 @@ static NTSTATUS do_cmd(struct cli_state *cli, cli, cmd_entry->interface, pipe_default_auth_level, lp_workgroup(), - get_cmdline_auth_info_username(), - get_cmdline_auth_info_password(), + get_cmdline_auth_info_username(auth_info), + get_cmdline_auth_info_password(auth_info), &cmd_entry->rpc_pipe); break; case PIPE_AUTH_TYPE_SCHANNEL: @@ -687,7 +690,8 @@ static NTSTATUS do_cmd(struct cli_state *cli, * * @returns The NTSTATUS from running the command. **/ -static NTSTATUS process_cmd(struct cli_state *cli, char *cmd) +static NTSTATUS process_cmd(struct user_auth_info *auth_info, + struct cli_state *cli, char *cmd) { struct cmd_list *temp_list; NTSTATUS result = NT_STATUS_OK; @@ -713,7 +717,8 @@ static NTSTATUS process_cmd(struct cli_state *cli, char *cmd) goto out_free; } - result = do_cmd(cli, temp_set, argc, argv); + result = do_cmd(cli, auth_info, temp_set, + argc, argv); goto out_free; } @@ -784,6 +789,12 @@ out_free: facilities. See lib/debug.c */ setup_logging("rpcclient", True); + rpcclient_auth_info = user_auth_info_init(frame); + if (rpcclient_auth_info == NULL) { + exit(1); + } + popt_common_set_auth_info(rpcclient_auth_info); + /* Parse options */ pc = poptGetContext("rpcclient", argc, (const char **) argv, @@ -850,16 +861,16 @@ out_free: * from stdin if necessary */ - if (get_cmdline_auth_info_use_machine_account() && - !set_cmdline_auth_info_machine_account_creds()) { + if (get_cmdline_auth_info_use_machine_account(rpcclient_auth_info) && + !set_cmdline_auth_info_machine_account_creds(rpcclient_auth_info)) { result = 1; goto done; } - if (!get_cmdline_auth_info_got_pass()) { + if (!get_cmdline_auth_info_got_pass(rpcclient_auth_info)) { char *pass = getpass("Password:"); if (pass) { - set_cmdline_auth_info_password(pass); + set_cmdline_auth_info_password(rpcclient_auth_info, pass); } } @@ -868,7 +879,7 @@ out_free: server += 2; } - if (get_cmdline_auth_info_use_kerberos()) { + if (get_cmdline_auth_info_use_kerberos(rpcclient_auth_info)) { flags |= CLI_FULL_CONNECTION_USE_KERBEROS | CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS; } @@ -877,11 +888,12 @@ out_free: nt_status = cli_full_connection(&cli, global_myname(), server, opt_ipaddr ? &server_ss : NULL, opt_port, "IPC$", "IPC", - get_cmdline_auth_info_username(), + get_cmdline_auth_info_username(rpcclient_auth_info), lp_workgroup(), - get_cmdline_auth_info_password(), + get_cmdline_auth_info_password(rpcclient_auth_info), flags, - get_cmdline_auth_info_signing_state(),NULL); + get_cmdline_auth_info_signing_state(rpcclient_auth_info), + NULL); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0,("Cannot connect to server. Error was %s\n", nt_errstr(nt_status))); @@ -889,10 +901,10 @@ out_free: goto done; } - if (get_cmdline_auth_info_smb_encrypt()) { + if (get_cmdline_auth_info_smb_encrypt(rpcclient_auth_info)) { nt_status = cli_cm_force_encryption(cli, - get_cmdline_auth_info_username(), - get_cmdline_auth_info_password(), + get_cmdline_auth_info_username(rpcclient_auth_info), + get_cmdline_auth_info_password(rpcclient_auth_info), lp_workgroup(), "IPC$"); if (!NT_STATUS_IS_OK(nt_status)) { @@ -927,7 +939,7 @@ out_free: result = 0; while((cmd=next_command(&p)) != NULL) { - NTSTATUS cmd_result = process_cmd(cli, cmd); + NTSTATUS cmd_result = process_cmd(rpcclient_auth_info, cli, cmd); SAFE_FREE(cmd); result = NT_STATUS_IS_ERR(cmd_result); } @@ -946,7 +958,7 @@ out_free: break; if (line[0] != '\n') - process_cmd(cli, line); + process_cmd(rpcclient_auth_info, cli, line); SAFE_FREE(line); } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 77ad1664ef..d22eda2bb5 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1048,7 +1048,7 @@ bool map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func uint32 access_mask; uint32 share_mode; uint32 create_disposition; - uint32 create_options = 0; + uint32 create_options = FILE_NON_DIRECTORY_FILE; DEBUG(10,("map_open_params_to_ntcreate: fname = %s, deny_mode = 0x%x, " "open_func = 0x%x\n", @@ -3067,7 +3067,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn, files_struct *dir_fsp; char *parent_fname = NULL; - if (root_dir_fid == 0 || !fname || !new_fname || !*new_fname) { + if (root_dir_fid == 0 || !fname || !new_fname) { return NT_STATUS_INTERNAL_ERROR; } diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index 24a201013a..a24843ff64 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -915,7 +915,7 @@ static void reply_spnego_auth(struct smb_request *req, DEBUG(3,("reply_spnego_auth: network " "misconfiguration, client sent us a " "krb5 ticket and kerberos security " - "not enabled")); + "not enabled\n")); reply_nterror(req, nt_status_squash( NT_STATUS_LOGON_FAILURE)); SAFE_FREE(kerb_mech); diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index b03fefe14a..27d534665c 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -293,7 +293,7 @@ retry: tried_closest_dc = true; /* avoid loop */ - if (!ads->config.tried_closest_dc) { + if (!ads_closest_dc(ads)) { namecache_delete(ads->server.realm, 0x1C); namecache_delete(ads->server.workgroup, 0x1C); diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 1bfc4757da..f07b5011c8 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -735,6 +735,8 @@ static int owner_set(struct cli_state *cli, enum chown_mode change_mode, if (!cli_set_secdesc(cli, fnum, sd)) { printf("ERROR: secdesc set failed: %s\n", cli_errstr(cli)); + cli_close(cli, fnum); + return EXIT_FAILED; } cli_close(cli, fnum); @@ -949,7 +951,8 @@ static int cacl_set(struct cli_state *cli, char *filename, /***************************************************** Return a connection to a server. *******************************************************/ -static struct cli_state *connect_one(const char *server, const char *share) +static struct cli_state *connect_one(struct user_auth_info *auth_info, + const char *server, const char *share) { struct cli_state *c = NULL; struct sockaddr_storage ss; @@ -958,41 +961,41 @@ static struct cli_state *connect_one(const char *server, const char *share) zero_sockaddr(&ss); - if (get_cmdline_auth_info_use_kerberos()) { + if (get_cmdline_auth_info_use_kerberos(auth_info)) { flags |= CLI_FULL_CONNECTION_USE_KERBEROS | CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS; } - if (get_cmdline_auth_info_use_machine_account() && - !set_cmdline_auth_info_machine_account_creds()) { + if (get_cmdline_auth_info_use_machine_account(auth_info) && + !set_cmdline_auth_info_machine_account_creds(auth_info)) { return NULL; } - if (!get_cmdline_auth_info_got_pass()) { + if (!get_cmdline_auth_info_got_pass(auth_info)) { char *pass = getpass("Password: "); if (pass) { - set_cmdline_auth_info_password(pass); + set_cmdline_auth_info_password(auth_info, pass); } } nt_status = cli_full_connection(&c, global_myname(), server, &ss, 0, share, "?????", - get_cmdline_auth_info_username(), + get_cmdline_auth_info_username(auth_info), lp_workgroup(), - get_cmdline_auth_info_password(), + get_cmdline_auth_info_password(auth_info), flags, - get_cmdline_auth_info_signing_state(), + get_cmdline_auth_info_signing_state(auth_info), NULL); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0,("cli_full_connection failed! (%s)\n", nt_errstr(nt_status))); return NULL; } - if (get_cmdline_auth_info_smb_encrypt()) { + if (get_cmdline_auth_info_smb_encrypt(auth_info)) { nt_status = cli_cm_force_encryption(c, - get_cmdline_auth_info_username(), - get_cmdline_auth_info_password(), + get_cmdline_auth_info_username(auth_info), + get_cmdline_auth_info_password(auth_info), lp_workgroup(), share); if (!NT_STATUS_IS_OK(nt_status)) { @@ -1038,6 +1041,7 @@ static struct cli_state *connect_one(const char *server, const char *share) TALLOC_CTX *frame = talloc_stackframe(); const char *owner_username = ""; char *server; + struct user_auth_info *auth_info; load_case_tables(); @@ -1053,6 +1057,12 @@ static struct cli_state *connect_one(const char *server, const char *share) lp_load(get_dyn_CONFIGFILE(),True,False,False,True); load_interfaces(); + auth_info = user_auth_info_init(frame); + if (auth_info == NULL) { + exit(1); + } + popt_common_set_auth_info(auth_info); + pc = poptGetContext("smbcacls", argc, argv, long_options, 0); poptSetOtherOptionHelp(pc, "//server1/share1 filename\nACLs look like: " @@ -1129,7 +1139,7 @@ static struct cli_state *connect_one(const char *server, const char *share) share++; if (!test_args) { - cli = connect_one(server, share); + cli = connect_one(auth_info, server, share); if (!cli) { exit(EXIT_FAILED); } diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c index 8938cc5e65..a95394b125 100644 --- a/source3/utils/smbcquotas.c +++ b/source3/utils/smbcquotas.c @@ -37,6 +37,7 @@ static struct cli_state *cli_ipc; static struct rpc_pipe_client *global_pipe_hnd; static POLICY_HND pol; static bool got_policy_hnd; +static struct user_auth_info *smbcquotas_auth_info; static struct cli_state *connect_one(const char *share); @@ -373,42 +374,42 @@ static struct cli_state *connect_one(const char *share) zero_sockaddr(&ss); - if (get_cmdline_auth_info_use_machine_account() && - !set_cmdline_auth_info_machine_account_creds()) { + if (get_cmdline_auth_info_use_machine_account(smbcquotas_auth_info) && + !set_cmdline_auth_info_machine_account_creds(smbcquotas_auth_info)) { return NULL; } - if (get_cmdline_auth_info_use_kerberos()) { + if (get_cmdline_auth_info_use_kerberos(smbcquotas_auth_info)) { flags |= CLI_FULL_CONNECTION_USE_KERBEROS | CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS; } - if (!get_cmdline_auth_info_got_pass()) { + if (!get_cmdline_auth_info_got_pass(smbcquotas_auth_info)) { char *pass = getpass("Password: "); if (pass) { - set_cmdline_auth_info_password(pass); + set_cmdline_auth_info_password(smbcquotas_auth_info, pass); } } nt_status = cli_full_connection(&c, global_myname(), server, &ss, 0, share, "?????", - get_cmdline_auth_info_username(), + get_cmdline_auth_info_username(smbcquotas_auth_info), lp_workgroup(), - get_cmdline_auth_info_password(), + get_cmdline_auth_info_password(smbcquotas_auth_info), flags, - get_cmdline_auth_info_signing_state(), + get_cmdline_auth_info_signing_state(smbcquotas_auth_info), NULL); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0,("cli_full_connection failed! (%s)\n", nt_errstr(nt_status))); return NULL; } - if (get_cmdline_auth_info_smb_encrypt()) { + if (get_cmdline_auth_info_smb_encrypt(smbcquotas_auth_info)) { nt_status = cli_cm_force_encryption(c, - get_cmdline_auth_info_username(), - get_cmdline_auth_info_password(), + get_cmdline_auth_info_username(smbcquotas_auth_info), + get_cmdline_auth_info_password(smbcquotas_auth_info), lp_workgroup(), share); if (!NT_STATUS_IS_OK(nt_status)) { @@ -475,6 +476,12 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" }, lp_load(get_dyn_CONFIGFILE(),True,False,False,True); load_interfaces(); + smbcquotas_auth_info = user_auth_info_init(frame); + if (smbcquotas_auth_info == NULL) { + exit(1); + } + popt_common_set_auth_info(smbcquotas_auth_info); + pc = poptGetContext("smbcquotas", argc, argv, long_options, 0); poptSetOtherOptionHelp(pc, "//server1/share1"); @@ -537,7 +544,8 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" }, todo = USER_QUOTA; if (!fix_user) { - username_str = talloc_strdup(frame, get_cmdline_auth_info_username()); + username_str = talloc_strdup( + frame, get_cmdline_auth_info_username(smbcquotas_auth_info)); if (!username_str) { exit(EXIT_PARSE_ERROR); } diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c index 9fc02bac13..6c69300e85 100644 --- a/source3/utils/smbtree.c +++ b/source3/utils/smbtree.c @@ -272,7 +272,7 @@ static bool print_tree(struct user_auth_info *user_info) int main(int argc,char *argv[]) { TALLOC_CTX *frame = talloc_stackframe(); - struct user_auth_info local_auth_info; + struct user_auth_info *auth_info; struct poptOption long_options[] = { POPT_AUTOHELP { "broadcast", 'b', POPT_ARG_VAL, &use_bcast, True, "Use broadcast instead of using the master browser" }, @@ -293,6 +293,12 @@ static bool print_tree(struct user_auth_info *user_info) setup_logging(argv[0],True); + auth_info = user_auth_info_init(frame); + if (auth_info == NULL) { + exit(1); + } + popt_common_set_auth_info(auth_info); + pc = poptGetContext("smbtree", argc, (const char **)argv, long_options, POPT_CONTEXT_KEEP_FIRST); while(poptGetNextOpt(pc) != -1); @@ -303,26 +309,22 @@ static bool print_tree(struct user_auth_info *user_info) /* Parse command line args */ - if (get_cmdline_auth_info_use_machine_account() && - !set_cmdline_auth_info_machine_account_creds()) { + if (get_cmdline_auth_info_use_machine_account(auth_info) && + !set_cmdline_auth_info_machine_account_creds(auth_info)) { TALLOC_FREE(frame); return 1; } - if (!get_cmdline_auth_info_got_pass()) { + if (!get_cmdline_auth_info_got_pass(auth_info)) { char *pass = getpass("Password: "); if (pass) { - set_cmdline_auth_info_password(pass); + set_cmdline_auth_info_password(auth_info, pass); } } /* Now do our stuff */ - if (!get_cmdline_auth_info_copy(&local_auth_info)) { - return 1; - } - - if (!print_tree(&local_auth_info)) { + if (!print_tree(auth_info)) { TALLOC_FREE(frame); return 1; } diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 1dcc70adae..0ecf11d0e5 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -173,35 +173,35 @@ static void terminate(bool is_parent) exit(0); } -static bool do_sigterm; +static SIG_ATOMIC_T do_sigterm = 0; static void termination_handler(int signum) { - do_sigterm = True; + do_sigterm = 1; sys_select_signal(signum); } -static bool do_sigusr2; +static SIG_ATOMIC_T do_sigusr2 = 0; static void sigusr2_handler(int signum) { - do_sigusr2 = True; + do_sigusr2 = 1; sys_select_signal(SIGUSR2); } -static bool do_sighup; +static SIG_ATOMIC_T do_sighup = 0; static void sighup_handler(int signum) { - do_sighup = True; + do_sighup = 1; sys_select_signal(SIGHUP); } -static bool do_sigchld; +static SIG_ATOMIC_T do_sigchld = 0; static void sigchld_handler(int signum) { - do_sigchld = True; + do_sigchld = 1; sys_select_signal(SIGCHLD); } @@ -224,7 +224,7 @@ static void msg_shutdown(struct messaging_context *msg, struct server_id server_id, DATA_BLOB *data) { - do_sigterm = True; + do_sigterm = 1; } @@ -802,7 +802,7 @@ void winbind_check_sighup(const char *lfile) flush_caches(); reload_services_file(lfile); - do_sighup = False; + do_sighup = 0; } } @@ -977,13 +977,13 @@ static void process_loop(void) if (do_sigusr2) { print_winbindd_status(); - do_sigusr2 = False; + do_sigusr2 = 0; } if (do_sigchld) { pid_t pid; - do_sigchld = False; + do_sigchld = 0; while ((pid = sys_waitpid(-1, NULL, WNOHANG)) > 0) { winbind_child_died(pid); diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index ef0fa5138a..9f35aae4d0 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -1422,6 +1422,52 @@ done: return ret; } +/* + test RAW_OPEN_OPENX against an existing directory to + ensure it returns NT_STATUS_FILE_IS_A_DIRECTORY. + Samba 3.2.0 - 3.2.6 are known to fail this. + +*/ +static bool test_openx_over_dir(struct smbcli_state *cli, TALLOC_CTX *tctx) +{ + union smb_open io; + const char *fname = BASEDIR "\\openx_over_dir"; + NTSTATUS status; + int d_fnum = -1; + int fnum = -1; + bool ret = true; + + printf("Checking RAW_OPEN_OPENX over an existing directory\n"); + smbcli_unlink(cli->tree, fname); + + /* Create the Directory */ + status = create_directory_handle(cli->tree, fname, &d_fnum); + smbcli_close(cli->tree, d_fnum); + + /* Prepare to open the file over the directory. */ + io.openx.level = RAW_OPEN_OPENX; + io.openx.in.fname = fname; + io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO; + io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR; + io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN; + io.openx.in.search_attrs = 0; + io.openx.in.file_attrs = 0; + io.openx.in.write_time = 0; + io.openx.in.size = 1024*1024; + io.openx.in.timeout = 0; + + status = smb_raw_open(cli->tree, tctx, &io); + CHECK_STATUS(status, NT_STATUS_FILE_IS_A_DIRECTORY); + fnum = io.openx.out.file.fnum; + +done: + smbcli_close(cli->tree, fnum); + smbcli_unlink(cli->tree, fname); + + return ret; +} + + /* A little torture test to expose a race condition in Samba 3.0.20 ... :-) */ static bool test_raw_open_multi(struct torture_context *tctx) @@ -1624,6 +1670,7 @@ bool torture_raw_open(struct torture_context *torture, struct smbcli_state *cli) ret &= test_ctemp(cli, torture); ret &= test_chained(cli, torture); ret &= test_no_leading_slash(cli, torture); + ret &= test_openx_over_dir(cli, torture); ret &= test_open_for_delete(cli, torture); smb_raw_exit(cli->session); |