From d20608c8f314476ca7dde8a9a61495431b4bccff Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Dec 2007 09:43:18 -0500 Subject: Merge in J.Layton patch and resolve conflict. (This used to be commit 6b1a118eaaab405eeef0cf3c0488a2747af562ba) --- source3/client/mount.cifs.c | 90 ++++++++++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 26 deletions(-) diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c index ec245ed200..a25ccc54de 100644 --- a/source3/client/mount.cifs.c +++ b/source3/client/mount.cifs.c @@ -62,6 +62,8 @@ #define MS_BIND 4096 #endif +#define MAX_UNC_LEN 1024 + #define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr))) const char *thisprogram; @@ -73,7 +75,6 @@ static int got_ip = 0; static int got_unc = 0; static int got_uid = 0; static int got_gid = 0; -static int free_share_name = 0; static char * user_name = NULL; static char * mountpassword = NULL; char * domain_name = NULL; @@ -828,17 +829,27 @@ static char * check_for_domain(char **ppuser) return domainnm; } +/* replace all occurances of "from" in a string with "to" */ +static void replace_char(char *string, char from, char to) +{ + while (string) { + string = strchr(string, from); + if (string) + *string = to; + } +} + /* Note that caller frees the returned buffer if necessary */ static char * parse_server(char ** punc_name) { char * unc_name = *punc_name; - int length = strnlen(unc_name,1024); + int length = strnlen(unc_name, MAX_UNC_LEN); char * share; char * ipaddress_string = NULL; struct hostent * host_entry = NULL; struct in_addr server_ipaddr; - if(length > 1023) { + if(length > (MAX_UNC_LEN - 1)) { printf("mount error: UNC name too long"); return NULL; } @@ -857,7 +868,6 @@ static char * parse_server(char ** punc_name) /* check for nfs syntax ie server:share */ share = strchr(unc_name,':'); if(share) { - free_share_name = 1; *punc_name = (char *)malloc(length+3); if(*punc_name == NULL) { /* put the original string back if @@ -865,9 +875,9 @@ static char * parse_server(char ** punc_name) *punc_name = unc_name; return NULL; } - *share = '/'; strncpy((*punc_name)+2,unc_name,length); + free(unc_name); unc_name = *punc_name; unc_name[length+2] = 0; goto continue_unc_parsing; @@ -878,18 +888,21 @@ static char * parse_server(char ** punc_name) } } else { continue_unc_parsing: - unc_name[0] = '/'; - unc_name[1] = '/'; + unc_name[0] = '\\'; + unc_name[1] = '\\'; unc_name += 2; - if ((share = strchr(unc_name, '/')) || - (share = strchr(unc_name,'\\'))) { + + /* convert any '/' in unc to '\\' */ + replace_char(unc_name, '/', '\\'); + + if ((share = strchr(unc_name,'\\'))) { *share = 0; /* temporarily terminate the string */ share += 1; if(got_ip == 0) { host_entry = gethostbyname(unc_name); } - *(share - 1) = '/'; /* put the slash back */ - if ((prefixpath = strchr(share, '/'))) { + *(share - 1) = '\\'; /* put delimiter back */ + if ((prefixpath = strchr(share, '\\'))) { *prefixpath = 0; /* permanently terminate the string */ if (!strlen(++prefixpath)) prefixpath = NULL; /* this needs to be done explicitly */ @@ -954,6 +967,25 @@ static struct option longopts[] = { { NULL, 0, NULL, 0 } }; +/* convert a string to uppercase. return false if the string + * wasn't ASCII or was a NULL ptr */ +static int +uppercase_string(char *string) +{ + if (!string) + return 0; + + while (*string) { + /* check for unicode */ + if ((unsigned char) string[0] & 0x80) + return 0; + *string = toupper((unsigned char) *string); + string++; + } + + return 1; +} + int main(int argc, char ** argv) { int c; @@ -966,6 +998,7 @@ int main(int argc, char ** argv) char * options = NULL; char * resolved_path = NULL; char * temp; + char * dev_name; int rc; int rsize = 0; int wsize = 0; @@ -1002,8 +1035,16 @@ int main(int argc, char ** argv) printf(" node: %s machine: %s sysname %s domain %s\n", sysinfo.nodename,sysinfo.machine,sysinfo.sysname,sysinfo.domainname); #endif */ if(argc > 2) { - share_name = argv[1]; + dev_name = argv[1]; + share_name = strndup(argv[1], MAX_UNC_LEN); + if (share_name == NULL) { + fprintf(stderr, "%s: %s", argv[0], strerror(ENOMEM)); + exit(1); + } mountpoint = argv[2]; + } else { + mount_cifs_usage(); + exit(1); } /* add sharename in opts string as unc= parm */ @@ -1143,7 +1184,7 @@ int main(int argc, char ** argv) } } - if((argc < 3) || (share_name == NULL) || (mountpoint == NULL)) { + if((argc < 3) || (dev_name == NULL) || (mountpoint == NULL)) { mount_cifs_usage(); exit(1); } @@ -1301,10 +1342,12 @@ mount_retry: } if(verboseflag) printf("\nmount.cifs kernel mount options %s \n",options); - if(mount(share_name, mountpoint, "cifs", flags, options)) { - /* remember to kill daemon on error */ - char * tmp; + /* convert all '\\' to '/' so that /proc/mounts looks pretty */ + replace_char(dev_name, '\\', '/'); + + if(mount(dev_name, mountpoint, "cifs", flags, options)) { + /* remember to kill daemon on error */ switch (errno) { case 0: printf("mount failed but no error number set\n"); @@ -1315,12 +1358,9 @@ mount_retry: case ENXIO: if(retry == 0) { retry = 1; - tmp = share_name; - while (*tmp && !(((unsigned char)tmp[0]) & 0x80)) { - *tmp = toupper((unsigned char)*tmp); - tmp++; - } - if(!*tmp) { + if (uppercase_string(dev_name) && + uppercase_string(share_name) && + uppercase_string(prefixpath)) { printf("retrying with upper case share name\n"); goto mount_retry; } @@ -1334,7 +1374,7 @@ mount_retry: } else { pmntfile = setmntent(MOUNTED, "a+"); if(pmntfile) { - mountent.mnt_fsname = share_name; + mountent.mnt_fsname = dev_name; mountent.mnt_dir = mountpoint; mountent.mnt_type = CONST_DISCARD(char *,"cifs"); mountent.mnt_opts = (char *)malloc(220); @@ -1394,8 +1434,6 @@ mount_exit: free(resolved_path); } - if(free_share_name) { - free(share_name); - } + free(share_name); return rc; } -- cgit From 8f28bda7f8c18de597d345126c9ee03e99776e55 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Dec 2007 10:44:09 -0800 Subject: Fix bug #5121 (unix passwd sync not working on a streams based system). Jeremy. (This used to be commit 545cd2139cfc9484b733693814d4724d37125942) --- source3/lib/replace/libreplace.m4 | 1 + source3/lib/replace/system/network.h | 4 ++++ source3/smbd/chgpasswd.c | 14 +++++++------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/source3/lib/replace/libreplace.m4 b/source3/lib/replace/libreplace.m4 index c10a4b2381..7a5283a4d6 100644 --- a/source3/lib/replace/libreplace.m4 +++ b/source3/lib/replace/libreplace.m4 @@ -100,6 +100,7 @@ AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h arpa/inet.h) AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h) AC_CHECK_HEADERS(sys/sockio.h sys/un.h) AC_CHECK_HEADERS(sys/mount.h mntent.h) +AC_CHECK_HEADERS(stropts.h) dnl we need to check that net/if.h really can be used, to cope with hpux dnl where including it always fails diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index d3ae2bf398..9087c02da1 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -78,6 +78,10 @@ #include #endif +#ifdef HAVE_STROPTS_H +#include +#endif + #ifdef REPLACE_INET_NTOA /* define is in "replace.h" */ char *rep_inet_ntoa(struct in_addr ip); diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index 5ccf3ed9da..e478122e9b 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -159,19 +159,19 @@ static int dochild(int master, const char *slavedev, const struct passwd *pass, DEBUG(3, ("More weirdness, could not open %s\n", slavedev)); return (False); } -#if defined(I_PUSH) && defined(I_FIND) +#if defined(TIOCSCTTY) + if (ioctl(slave, TIOCSCTTY, 0) < 0) + { + DEBUG(3, ("Error in ioctl call for slave pty\n")); + /* return(False); */ + } +#elif defined(I_PUSH) && defined(I_FIND) if (ioctl(slave, I_FIND, "ptem") == 0) { ioctl(slave, I_PUSH, "ptem"); } if (ioctl(slave, I_FIND, "ldterm") == 0) { ioctl(slave, I_PUSH, "ldterm"); } -#elif defined(TIOCSCTTY) - if (ioctl(slave, TIOCSCTTY, 0) < 0) - { - DEBUG(3, ("Error in ioctl call for slave pty\n")); - /* return(False); */ - } #endif /* Close master. */ -- cgit From 4869ccfed6ba8c44fb49844a5a8abbb671518954 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Dec 2007 15:21:38 -0500 Subject: While 'data' is usually 0 terminated, nothing in the spec requires that. The correct way is to copy only 'length' bytes. Simo. (This used to be commit 814c1b0e0034fb67c7718760dfcf913904f3e7fa) --- source3/libads/kerberos.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index 227f95d15e..4fc23956bd 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -521,7 +521,10 @@ char *kerberos_get_default_realm_from_ccache( void ) #if defined(HAVE_KRB5_PRINCIPAL_GET_REALM) realm = SMB_STRDUP(krb5_principal_get_realm(ctx, princ)); #elif defined(HAVE_KRB5_PRINC_REALM) - realm = SMB_STRDUP(krb5_princ_realm(ctx, princ)->data); + { + krb5_data *realm_data = krb5_princ_realm(ctx, princ); + realm = SMB_STRNDUP(realm_data->data, realm_data->length); + } #endif out: -- cgit From d9682dfb5918c20516d45de20c4f3d5824572e20 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 17 Dec 2007 23:02:39 +0100 Subject: Do not close netlogon pipe in get_schannel_session_key_common(). This removes one forgotten call of cli_rpc_pipe_close(netlogon_pipe). Correction of e77c4022cfbb868e608edcb06b676658b0e201ad. Michael (This used to be commit 7f6593cddef048dd05140b05d306c708d8134f0e) --- source3/rpc_client/cli_pipe.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index f61ea95d04..5a4ccf4f02 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -2466,7 +2466,6 @@ static bool get_schannel_session_key_common(struct rpc_pipe_client *netlogon_pip if (((*pneg_flags) & NETLOGON_NEG_SCHANNEL) == 0) { DEBUG(3, ("get_schannel_session_key: Server %s did not offer schannel\n", cli->desthost)); - cli_rpc_pipe_close(netlogon_pipe); *perr = NT_STATUS_INVALID_NETWORK_RESPONSE; return false; } -- cgit From d9553e8fd19a0832f3fbd19ffcc595a701d87e34 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Mon, 17 Dec 2007 17:33:48 -0600 Subject: Fix a segv in winbindd caused by trying to free an fstring. Make a copy of the machine_password and machine_account strings in all conditional paths so that SAFE_FREE() will always be valid. (This used to be commit 194c4640b158457a6d0d5ea91e28d41d619c77de) --- source3/winbindd/winbindd_cm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index cb366a293c..6c5633c2b2 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -2005,11 +2005,15 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx, domain_name = domain->name; goto schannel; } else { - machine_password = conn_pwd; - machine_account = conn->cli->user_name; + machine_password = SMB_STRDUP(conn_pwd); + machine_account = SMB_STRDUP(conn->cli->user_name); domain_name = conn->cli->domain; } + if (!machine_password || !machine_account) { + result = NT_STATUS_NO_MEMORY; + goto done; + } /* We have an authenticated connection. Use a NTLMSSP SPNEGO authenticated SAMR pipe with sign & seal. */ -- cgit From c8071c3522abefb651596e2335e724ae50cb8a90 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Dec 2007 16:20:44 -0800 Subject: Use the %*s feature of snprintf to remove anothe static fstring. Jeremy. (This used to be commit 4ae4b2358688bf289305a2db0ed01b653ac073b2) --- source3/lib/util.c | 13 ++++--------- source3/rpc_parse/parse_prs.c | 32 ++++++++++++++++---------------- source3/rpc_parse/parse_srv.c | 12 ++++++------ 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/source3/lib/util.c b/source3/lib/util.c index 73b035b22b..11c14ea538 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2227,17 +2227,12 @@ void dump_data_pw(const char *msg, const uchar * data, size_t len) #endif } -char *tab_depth(int depth) +const char *tab_depth(int level, int depth) { - static fstring spaces; - size_t len = depth * 4; - if (len > sizeof(fstring)-1) { - len = sizeof(fstring)-1; + if( DEBUGLVL(level) ) { + dbgtext("%*s", depth*4, ""); } - - memset(spaces, ' ', len); - spaces[len] = 0; - return spaces; + return ""; } /***************************************************************************** diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 4abf63e71d..23dae9f3a1 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -85,7 +85,7 @@ void prs_dump_region(const char *name, int v, prs_struct *ps, void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name) { - DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(depth), ps->data_offset, fn_name, desc)); + DEBUG(5+depth, ("%s%06x %s %s\n", tab_depth(5+depth,depth), ps->data_offset, fn_name, desc)); } /** @@ -621,7 +621,7 @@ bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) else SCVAL(q,0,*data8); - DEBUG(5,("%s%04x %s: %02x\n", tab_depth(depth), ps->data_offset, name, *data8)); + DEBUG(5,("%s%04x %s: %02x\n", tab_depth(5,depth), ps->data_offset, name, *data8)); ps->data_offset += 1; @@ -686,7 +686,7 @@ bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16) SSVAL(q,0,*data16); } - DEBUG(5,("%s%04x %s: %04x\n", tab_depth(depth), ps->data_offset, name, *data16)); + DEBUG(5,("%s%04x %s: %04x\n", tab_depth(5,depth), ps->data_offset, name, *data16)); ps->data_offset += sizeof(uint16); @@ -715,7 +715,7 @@ bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32) SIVAL(q,0,*data32); } - DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32)); + DEBUG(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32)); ps->data_offset += sizeof(uint32); @@ -744,7 +744,7 @@ bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32) SIVALS(q,0,*data32); } - DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32)); + DEBUG(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32)); ps->data_offset += sizeof(int32); @@ -773,7 +773,7 @@ bool prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status) SIVAL(q,0,NT_STATUS_V(*status)); } - DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name, nt_errstr(*status))); ps->data_offset += sizeof(uint32); @@ -803,7 +803,7 @@ bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *st SIVAL(q,0,NT_STATUS_V(*status)); } - DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name, dcerpc_errstr(NT_STATUS_V(*status)))); ps->data_offset += sizeof(uint32); @@ -834,7 +834,7 @@ bool prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status) SIVAL(q,0,W_ERROR_V(*status)); } - DEBUG(5,("%s%04x %s: %s\n", tab_depth(depth), ps->data_offset, name, + DEBUG(5,("%s%04x %s: %s\n", tab_depth(5,depth), ps->data_offset, name, dos_errstr(*status))); ps->data_offset += sizeof(uint32); @@ -862,7 +862,7 @@ bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint SCVAL(q, i, data8s[i]); } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset ,name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset ,name)); if (charmode) print_asc(5, (unsigned char*)data8s, len); else { @@ -905,7 +905,7 @@ bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uin } } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); if (charmode) print_asc(5, (unsigned char*)data16s, 2*len); else { @@ -947,7 +947,7 @@ static void dbg_rw_punival(bool charmode, const char *name, int depth, prs_struc } } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); if (charmode) print_asc(5, (unsigned char*)out_buf, 2*len); else { @@ -1002,7 +1002,7 @@ bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uin } } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); if (charmode) print_asc(5, (unsigned char*)data32s, 4*len); else { @@ -1103,7 +1103,7 @@ bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STR } else { str->buffer = NULL; /* Return early to ensure Coverity isn't confused. */ - DEBUG(5,("%s%04x %s: \n", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: \n", tab_depth(5,depth), ps->data_offset, name)); return True; } } @@ -1116,7 +1116,7 @@ bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STR SCVAL(q, i, str->buffer[i]); } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); if (charmode) print_asc(5, (unsigned char*)str->buffer, str->str_str_len); else { @@ -1252,7 +1252,7 @@ bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) len++; - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); print_asc(5, (unsigned char*)start, 2*len); DEBUG(5, ("\n")); } @@ -1309,7 +1309,7 @@ bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) str->buffer[len++] = '\0'; } - DEBUG(5,("%s%04x %s: ", tab_depth(depth), ps->data_offset, name)); + DEBUG(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); print_asc(5, (unsigned char*)str->buffer, 2*len); DEBUG(5, ("\n")); } diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index e7a73183f5..6337c53fc1 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1018,7 +1018,7 @@ static bool srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_ default: DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + tab_depth(5,depth), ctr->switch_value)); break; } @@ -1267,7 +1267,7 @@ static bool srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, S return False; default: DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(depth), r_n->switch_value)); + tab_depth(5,depth), r_n->switch_value)); break; } } @@ -1796,7 +1796,7 @@ static bool srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, pr break; default: DEBUG(5,("%s no session info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + tab_depth(5,depth), ctr->switch_value)); break; } } @@ -2216,7 +2216,7 @@ static bool srv_io_srv_conn_ctr(const char *desc, SRV_CONN_INFO_CTR **pp_ctr, pr break; default: DEBUG(5,("%s no connection info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + tab_depth(5,depth), ctr->switch_value)); break; } } @@ -2486,7 +2486,7 @@ static bool srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_st break; } default: - DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level)); + DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(5,depth), ctr->level)); break; } @@ -2839,7 +2839,7 @@ static bool srv_io_info_ctr(const char *desc, SRV_INFO_CTR *ctr, prs_struct *ps, break; default: DEBUG(5,("%s no server info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + tab_depth(5,depth), ctr->switch_value)); break; } if(!prs_align(ps)) -- cgit From a3081ba5b52fd6174b4e84f69c8116b47fab6f0c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 18 Dec 2007 01:30:52 +0100 Subject: Prevent another segfault. Michael (This used to be commit 0a9874c1c76c0ccc71caba7ee85a0ee1a91808c5) --- source3/passdb/passdb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 9311b8a74e..4228f6c32f 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -1552,7 +1552,9 @@ bool get_trust_pw_clear(const char *domain, char **ret_pwd, return false; } - *channel = SEC_CHAN_DOMAIN; + if (channel != NULL) { + *channel = SEC_CHAN_DOMAIN; + } if (account_name != NULL) { *account_name = lp_workgroup(); -- cgit From a62cc944435fb9964c765cb9495f18308823ac8f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 18 Dec 2007 01:55:48 +0100 Subject: Fix logic error in cm_connect_sam(). Don't fall back to schannel when trust creds could be obtained. This is still not complete, but I am getting closer. Michael (This used to be commit 7c9fa597d684a25822b4db6615f28336f2d64ef3) --- source3/winbindd/winbindd_cm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 6c5633c2b2..8ea815535f 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -2003,7 +2003,6 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx, goto schannel; } domain_name = domain->name; - goto schannel; } else { machine_password = SMB_STRDUP(conn_pwd); machine_account = SMB_STRDUP(conn->cli->user_name); -- cgit From 2b0a570c77b5e4afba44e670f1ebf0016f96d30a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Dec 2007 17:02:48 -0800 Subject: More static fstring removal. Jeremy. (This used to be commit dcf624aa02cf7415a4a55e6d45606e813ae6b91f) --- source3/auth/pass_check.c | 149 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 116 insertions(+), 33 deletions(-) diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c index 27915bf499..fe1f98c150 100644 --- a/source3/auth/pass_check.c +++ b/source3/auth/pass_check.c @@ -26,10 +26,61 @@ #define DBGC_CLASS DBGC_AUTH /* these are kept here to keep the string_combinations function simple */ -static fstring this_user; -#if !defined(WITH_PAM) -static fstring this_salt; -static fstring this_crypted; +static char *ths_user; + +static const char *get_this_user() +{ + if (!ths_user) { + return ""; + } + return ths_user; +} + +#if defined(WITH_PAM) || defined(OSF1_ENH_SEC) +static const char *set_this_user(const char *newuser) +{ + char *orig_user = ths_user; + ths_user = SMB_STRDUP(newuser); + SAFE_FREE(orig_user); + return ths_user; +} +#endif + +#if !defined(WITH_PAM) +static char *ths_salt; +/* This must be writable. */ +static char *get_this_salt() +{ + return ths_salt; +} + +/* We may be setting a modified version of the same + * string, so don't free before use. */ + +static const char *set_this_salt(const char *newsalt) +{ + char *orig_salt = ths_salt; + ths_salt = SMB_STRDUP(newsalt); + SAFE_FREE(orig_salt); + return ths_salt; +} + +static char *ths_crypted; +static const char *get_this_crypted() +{ + if (!ths_crypted) { + return ""; + } + return ths_crypted; +} + +static const char *set_this_crypted(const char *newcrypted) +{ + char *orig_crypted = ths_crypted; + ths_crypted = SMB_STRDUP(newcrypted); + SAFE_FREE(orig_crypted); + return ths_crypted; +} #endif #ifdef WITH_AFS @@ -113,7 +164,7 @@ static bool dfs_auth(char *user, char *password) * Assumes local passwd file is kept in sync w/ DCE RGY! */ - if (strcmp((char *)crypt(password, this_salt), this_crypted)) + if (strcmp((char *)crypt(password, get_this_salt()), get_this_crypted())) { return (False); } @@ -492,29 +543,29 @@ core of password checking routine static NTSTATUS password_check(const char *password) { #ifdef WITH_PAM - return smb_pam_passcheck(this_user, password); + return smb_pam_passcheck(get_this_user(), password); #else bool ret; #ifdef WITH_AFS - if (afs_auth(this_user, password)) + if (afs_auth(get_this_user(), password)) return NT_STATUS_OK; #endif /* WITH_AFS */ #ifdef WITH_DFS - if (dfs_auth(this_user, password)) + if (dfs_auth(get_this_user(), password)) return NT_STATUS_OK; #endif /* WITH_DFS */ #ifdef OSF1_ENH_SEC - ret = (strcmp(osf1_bigcrypt(password, this_salt), - this_crypted) == 0); + ret = (strcmp(osf1_bigcrypt(password, get_this_salt()), + get_this_crypted()) == 0); if (!ret) { DEBUG(2, ("OSF1_ENH_SEC failed. Trying normal crypt.\n")); - ret = (strcmp((char *)crypt(password, this_salt), this_crypted) == 0); + ret = (strcmp((char *)crypt(password, get_this_salt()), get_this_crypted()) == 0); } if (ret) { return NT_STATUS_OK; @@ -525,7 +576,7 @@ static NTSTATUS password_check(const char *password) #endif /* OSF1_ENH_SEC */ #ifdef ULTRIX_AUTH - ret = (strcmp((char *)crypt16(password, this_salt), this_crypted) == 0); + ret = (strcmp((char *)crypt16(password, get_this_salt()), get_this_crypted()) == 0); if (ret) { return NT_STATUS_OK; } else { @@ -535,7 +586,7 @@ static NTSTATUS password_check(const char *password) #endif /* ULTRIX_AUTH */ #ifdef LINUX_BIGCRYPT - ret = (linux_bigcrypt(password, this_salt, this_crypted)); + ret = (linux_bigcrypt(password, get_this_salt(), get_this_crypted())); if (ret) { return NT_STATUS_OK; } else { @@ -552,10 +603,10 @@ static NTSTATUS password_check(const char *password) * by crypt. */ - if (strcmp(bigcrypt(password, this_salt), this_crypted) == 0) + if (strcmp(bigcrypt(password, get_this_salt()), get_this_crypted()) == 0) return NT_STATUS_OK; else - ret = (strcmp((char *)crypt(password, this_salt), this_crypted) == 0); + ret = (strcmp((char *)crypt(password, get_this_salt()), get_this_crypted()) == 0); if (ret) { return NT_STATUS_OK; } else { @@ -564,7 +615,7 @@ static NTSTATUS password_check(const char *password) #else /* HAVE_BIGCRYPT && HAVE_CRYPT && USE_BOTH_CRYPT_CALLS */ #ifdef HAVE_BIGCRYPT - ret = (strcmp(bigcrypt(password, this_salt), this_crypted) == 0); + ret = (strcmp(bigcrypt(password, get_this_salt()), get_this_crypted()) == 0); if (ret) { return NT_STATUS_OK; } else { @@ -576,7 +627,7 @@ static NTSTATUS password_check(const char *password) DEBUG(1, ("Warning - no crypt available\n")); return NT_STATUS_LOGON_FAILURE; #else /* HAVE_CRYPT */ - ret = (strcmp((char *)crypt(password, this_salt), this_crypted) == 0); + ret = (strcmp((char *)crypt(password, get_this_salt()), get_this_crypted()) == 0); if (ret) { return NT_STATUS_OK; } else { @@ -621,7 +672,9 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas * checks below and dive straight into the PAM code. */ - fstrcpy(this_user, user); + if (set_this_user(user) == NULL) { + return NT_STATUS_NO_MEMORY; + } DEBUG(4, ("pass_check: Checking (PAM) password for user %s (l=%d)\n", user, pwlen)); @@ -638,8 +691,12 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas /* Copy into global for the convenience of looping code */ /* Also the place to keep the 'password' no matter what crazy struct it started in... */ - fstrcpy(this_crypted, pass->pw_passwd); - fstrcpy(this_salt, pass->pw_passwd); + if (set_this_crypted(pass->pw_passwd) == NULL) { + return NT_STATUS_NO_MEMORY; + } + if (set_this_salt(pass->pw_passwd) == NULL) { + return NT_STATUS_NO_MEMORY; + } #ifdef HAVE_GETSPNAM { @@ -652,8 +709,12 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas spass = getspnam(pass->pw_name); if (spass && spass->sp_pwdp) { - fstrcpy(this_crypted, spass->sp_pwdp); - fstrcpy(this_salt, spass->sp_pwdp); + if (set_this_crypted(spass->sp_pwdp) == NULL) { + return NT_STATUS_NO_MEMORY; + } + if (set_this_salt(spass->sp_pwdp) == NULL) { + return NT_STATUS_NO_MEMORY; + } } } #elif defined(IA_UINFO) @@ -671,8 +732,11 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas #ifdef HAVE_GETPRPWNAM { struct pr_passwd *pr_pw = getprpwnam(pass->pw_name); - if (pr_pw && pr_pw->ufld.fd_encrypt) - fstrcpy(this_crypted, pr_pw->ufld.fd_encrypt); + if (pr_pw && pr_pw->ufld.fd_encrypt) { + if (set_this_crypted(pr_pw->ufld.fd_encrypt) == NULL) { + return NT_STATUS_NO_MEMORY; + } + } } #endif @@ -680,8 +744,11 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas { struct passwd_adjunct *pwret; pwret = getpwanam(s); - if (pwret && pwret->pwa_passwd) - fstrcpy(this_crypted, pwret->pwa_passwd); + if (pwret && pwret->pwa_passwd) { + if (set_this_crypted(pwret->pwa_passwd) == NULL) { + return NT_STATUS_NO_MEMORY; + } + } } #endif @@ -692,8 +759,12 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas user)); mypasswd = getprpwnam(user); if (mypasswd) { - fstrcpy(this_user, mypasswd->ufld.fd_name); - fstrcpy(this_crypted, mypasswd->ufld.fd_encrypt); + if (set_this_user(mypasswd->ufld.fd_name) == NULL) { + return NT_STATUS_NO_MEMORY; + } + if (set_this_crypted(mypasswd->ufld.fd_encrypt) == NULL) { + return NT_STATUS_NO_MEMORY; + } } else { DEBUG(5, ("OSF1_ENH_SEC: No entry for user %s in protected database !\n", @@ -706,7 +777,10 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas { AUTHORIZATION *ap = getauthuid(pass->pw_uid); if (ap) { - fstrcpy(this_crypted, ap->a_password); + if (set_this_crypted(ap->a_password) == NULL) { + endauthent(); + return NT_STATUS_NO_MEMORY; + } endauthent(); } } @@ -715,19 +789,28 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas #if defined(HAVE_TRUNCATED_SALT) /* crypt on some platforms (HPUX in particular) won't work with more than 2 salt characters. */ - this_salt[2] = 0; + { + char *trunc_salt = get_this_salt(); + if (!trunc_salt || strlen(trunc_salt) < 2) { + return NT_STATUS_LOGON_FAILURE; + } + trunc_salt[2] = 0; + if (set_this_salt(trunc_salt) == NULL) { + return NT_STATUS_NO_MEMORY; + } + } #endif - if (!*this_crypted) { + if (!get_this_crypted() || !*get_this_crypted()) { if (!lp_null_passwords()) { DEBUG(2, ("Disallowing %s with null password\n", - this_user)); + get_this_user())); return NT_STATUS_LOGON_FAILURE; } if (!*password) { DEBUG(3, ("Allowing access to %s with null password\n", - this_user)); + get_this_user())); return NT_STATUS_OK; } } -- cgit From 5bfe3c49a1b5ee0fad40e83326cf8b4bc88240f5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Dec 2007 17:13:31 -0800 Subject: Correctly define prototypes for accessor functions. Jeremy. (This used to be commit 299ea5d122e173adf6edb6399fc90798747b0c97) --- source3/auth/pass_check.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c index fe1f98c150..813540d9fa 100644 --- a/source3/auth/pass_check.c +++ b/source3/auth/pass_check.c @@ -28,7 +28,7 @@ /* these are kept here to keep the string_combinations function simple */ static char *ths_user; -static const char *get_this_user() +static const char *get_this_user(void) { if (!ths_user) { return ""; @@ -49,7 +49,7 @@ static const char *set_this_user(const char *newuser) #if !defined(WITH_PAM) static char *ths_salt; /* This must be writable. */ -static char *get_this_salt() +static char *get_this_salt(void) { return ths_salt; } @@ -66,7 +66,7 @@ static const char *set_this_salt(const char *newsalt) } static char *ths_crypted; -static const char *get_this_crypted() +static const char *get_this_crypted(void) { if (!ths_crypted) { return ""; -- cgit From 192aae0564c641fa06f90a064c033fa52d8cf549 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Dec 2007 17:27:29 -0800 Subject: Remove more static fstrings (yes this little cache should be in the rbtree....). Jeremy. (This used to be commit 97cfdae4052d46a35040d4c1a4ade8bf2c41dbc7) --- source3/smbd/map_username.c | 68 ++++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/source3/smbd/map_username.c b/source3/smbd/map_username.c index c04e0f1ae2..bde755eff6 100644 --- a/source3/smbd/map_username.c +++ b/source3/smbd/map_username.c @@ -32,10 +32,45 @@ Returns True if username was changed, false otherwise. ********************************************************************/ +static char *last_from, *last_to; + +static const char *get_last_from(void) +{ + if (!last_from) { + return ""; + } + return last_from; +} + +static const char *get_last_to(void) +{ + if (!last_to) { + return ""; + } + return last_to; +} + +static bool set_last_from_to(const char *from, const char *to) +{ + char *orig_from = last_from; + char *orig_to = last_to; + + last_from = SMB_STRDUP(from); + last_to = SMB_STRDUP(to); + + SAFE_FREE(orig_from); + SAFE_FREE(orig_to); + + if (!last_from || !last_to) { + SAFE_FREE(last_from); + SAFE_FREE(last_to); + return false; + } + return true; +} + bool map_username(fstring user) { - static bool initialised=False; - static fstring last_from,last_to; XFILE *f; char *mapfile = lp_username_map(); char *s; @@ -46,12 +81,12 @@ bool map_username(fstring user) if (!*user) return false; - if (strequal(user,last_to)) + if (strequal(user,get_last_to())) return false; - if (strequal(user,last_from)) { - DEBUG(3,("Mapped user %s to %s\n",user,last_to)); - fstrcpy(user,last_to); + if (strequal(user,get_last_from())) { + DEBUG(3,("Mapped user %s to %s\n",user,get_last_to())); + fstrcpy(user,get_last_to()); return true; } @@ -98,15 +133,9 @@ bool map_username(fstring user) } /* ok. let's try the mapfile */ - if (!*mapfile) return False; - if (!initialised) { - *last_from = *last_to = 0; - initialised = True; - } - f = x_fopen(mapfile,O_RDONLY, 0); if (!f) { DEBUG(0,("can't open username map %s. Error %s\n",mapfile, strerror(errno) )); @@ -135,7 +164,7 @@ bool map_username(fstring user) while (*unixname && isspace((int)*unixname)) unixname++; } - + if (!*unixname || strchr_m("#;",*unixname)) continue; @@ -159,27 +188,28 @@ bool map_username(fstring user) user_in_list(user, (const char **)dosuserlist)) { DEBUG(3,("Mapped user %s to %s\n",user,unixname)); mapped_user = True; - fstrcpy( last_from,user ); + + set_last_from_to(user, unixname); fstrcpy( user, unixname ); - fstrcpy( last_to,user ); + if ( return_if_mapped ) { str_list_free (&dosuserlist); x_fclose(f); return True; } } - + str_list_free (&dosuserlist); } x_fclose(f); /* - * Setup the last_from and last_to as an optimization so + * Setup the last_from and last_to as an optimization so * that we don't scan the file again for the same user. */ - fstrcpy(last_from,user); - fstrcpy(last_to,user); + + set_last_from_to(user, user); return mapped_user; } -- cgit From e3efe7cd7e11be5a78ddce9a49316b516ab81ba3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Dec 2007 18:00:43 -0800 Subject: More static fstring elimination. Jeremy. (This used to be commit b4dfec09e89428cac9b21a94ce4d24e60d4a54f4) --- source3/rpc_server/srv_svcctl_nt.c | 28 +++++++++++----------- source3/services/services_db.c | 48 ++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c index 7d81033264..5316d399b9 100644 --- a/source3/rpc_server/srv_svcctl_nt.c +++ b/source3/rpc_server/srv_svcctl_nt.c @@ -346,8 +346,8 @@ WERROR _svcctl_get_display_name(pipes_struct *p, SVCCTL_Q_GET_DISPLAY_NAME *q_u, rpcstr_pull(service, q_u->servicename.buffer, sizeof(service), q_u->servicename.uni_str_len*2, 0); - display_name = svcctl_lookup_dispname( service, p->pipe_user.nt_user_token ); - init_svcctl_r_get_display_name( r_u, display_name ); + display_name = svcctl_lookup_dispname(p->mem_ctx, service, p->pipe_user.nt_user_token ); + init_svcctl_r_get_display_name( r_u, display_name ? display_name : ""); return WERR_OK; } @@ -394,8 +394,8 @@ static int enumerate_status( TALLOC_CTX *ctx, ENUM_SERVICES_STATUS **status, NT_ for ( i=0; iservice_status( svcctl_ops[i].name, &st[i].status ); } @@ -688,16 +688,16 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO { SERVICE_INFO *info = find_service_info_by_hnd( p, &q_u->handle ); uint32 buffer_size; - + /* perform access checks */ if ( !info || (info->type != SVC_HANDLE_IS_SERVICE) ) - return WERR_BADFID; - + return WERR_BADFID; + if ( !(info->access_granted & SC_RIGHT_SVC_QUERY_CONFIG) ) return WERR_ACCESS_DENIED; - - /* we have to set the outgoing buffer size to the same as the + + /* we have to set the outgoing buffer size to the same as the incoming buffer size (even in the case of failure */ rpcbuf_init( &r_u->buffer, q_u->buffer_size, p->mem_ctx ); @@ -708,12 +708,12 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO { SERVICE_DESCRIPTION desc_buf; const char *description; - - description = svcctl_lookup_description( info->name, p->pipe_user.nt_user_token ); - + + description = svcctl_lookup_description(p->mem_ctx, info->name, p->pipe_user.nt_user_token ); + ZERO_STRUCTP( &desc_buf ); - init_service_description_buffer( &desc_buf, description ); + init_service_description_buffer( &desc_buf, description ? description : ""); svcctl_io_service_description( "", &desc_buf, &r_u->buffer, 0 ); buffer_size = svcctl_sizeof_service_description( &desc_buf ); @@ -737,7 +737,7 @@ WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CO default: return WERR_UNKNOWN_LEVEL; } - + buffer_size += buffer_size % 4; r_u->needed = (buffer_size > q_u->buffer_size) ? buffer_size : q_u->buffer_size; diff --git a/source3/services/services_db.c b/source3/services/services_db.c index 430c58f50d..c57b29cc80 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -125,22 +125,22 @@ static SEC_DESC* construct_service_sd( TALLOC_CTX *ctx ) static char *get_common_service_dispname( const char *servicename ) { - static fstring dispname; int i; for ( i=0; common_unix_svcs[i].servicename; i++ ) { if (strequal(servicename, common_unix_svcs[i].servicename)) { - fstr_sprintf( dispname, "%s (%s)", + char *dispname; + if (asprintf(&dispname, + "%s (%s)", common_unix_svcs[i].dispname, - common_unix_svcs[i].servicename ); - + common_unix_svcs[i].servicename) < 0) { + return NULL; + } return dispname; } } - fstrcpy( dispname, servicename ); - - return dispname; + return SMB_STRDUP(servicename ); } /******************************************************************** @@ -292,6 +292,7 @@ static void fill_service_values( const char *name, REGVAL_CTR *values ) if ( builtin_svcs[i].servicename == NULL ) { char *pstr = NULL; + char *dispname = NULL; struct rcinit_file_information *init_info = NULL; if (asprintf(&pstr, "%s/%s/%s",get_dyn_LIBDIR(), @@ -303,7 +304,9 @@ static void fill_service_values( const char *name, REGVAL_CTR *values ) } /* lookup common unix display names */ - init_unistr2( &dname, get_common_service_dispname( name ), UNI_STR_TERMINATE ); + dispname = get_common_service_dispname(name); + init_unistr2( &dname, dispname ? dispname : "", UNI_STR_TERMINATE ); + SAFE_FREE(dispname); /* get info from init file itself */ if ( read_init_file( name, &init_info ) ) { @@ -602,9 +605,9 @@ bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc, /******************************************************************** ********************************************************************/ -char *svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token ) +const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token ) { - static fstring display_name; + char *display_name = NULL; REGISTRY_KEY *key = NULL; REGVAL_CTR *values; REGISTRY_VALUE *val; @@ -637,7 +640,7 @@ char *svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token ) if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) ) goto fail; - rpcstr_pull( display_name, regval_data_p(val), sizeof(display_name), regval_size(val), 0 ); + rpcstr_pull_talloc(ctx, &display_name, regval_data_p(val), regval_size(val), 0 ); TALLOC_FREE( key ); @@ -646,16 +649,15 @@ char *svcctl_lookup_dispname( const char *name, NT_USER_TOKEN *token ) fail: /* default to returning the service name */ TALLOC_FREE( key ); - fstrcpy( display_name, name ); - return display_name; + return talloc_strdup(ctx, name); } /******************************************************************** ********************************************************************/ -char *svcctl_lookup_description( const char *name, NT_USER_TOKEN *token ) +const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token ) { - static fstring description; + char *description = NULL; REGISTRY_KEY *key = NULL; REGVAL_CTR *values; REGISTRY_VALUE *val; @@ -670,7 +672,7 @@ char *svcctl_lookup_description( const char *name, NT_USER_TOKEN *token ) wresult = regkey_open_internal( NULL, &key, path, token, REG_KEY_READ ); if ( !W_ERROR_IS_OK(wresult) ) { - DEBUG(0,("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n", + DEBUG(0,("svcctl_lookup_description: key lookup failed! [%s] (%s)\n", path, dos_errstr(wresult))); SAFE_FREE(path); return NULL; @@ -678,19 +680,19 @@ char *svcctl_lookup_description( const char *name, NT_USER_TOKEN *token ) SAFE_FREE(path); if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) { - DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n")); + DEBUG(0,("svcctl_lookup_description: talloc() failed!\n")); TALLOC_FREE( key ); return NULL; } fetch_reg_values( key, values ); - if ( !(val = regval_ctr_getvalue( values, "Description" )) ) - fstrcpy( description, "Unix Service"); - else - rpcstr_pull( description, regval_data_p(val), sizeof(description), regval_size(val), 0 ); - - TALLOC_FREE( key ); + if ( !(val = regval_ctr_getvalue( values, "Description" )) ) { + TALLOC_FREE( key ); + return "Unix Service"; + } + rpcstr_pull_talloc(ctx, &description, regval_data_p(val), regval_size(val), 0 ); + TALLOC_FREE(key); return description; } -- cgit From 2d1b03d67a7218cf2cf0a0f4cf8b49819b39ce23 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Dec 2007 18:32:27 -0800 Subject: More static pstring elimination. Jeremy. (This used to be commit 92acc0115d8d4111289c2ade1db7bb060ee908db) --- source3/lib/display_sec.c | 112 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 86 insertions(+), 26 deletions(-) diff --git a/source3/lib/display_sec.c b/source3/lib/display_sec.c index f6a6bb6465..67392e4568 100644 --- a/source3/lib/display_sec.c +++ b/source3/lib/display_sec.c @@ -23,34 +23,92 @@ /**************************************************************************** convert a security permissions into a string ****************************************************************************/ -char *get_sec_mask_str(uint32 type) + +char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type) { - static fstring typestr=""; + char *typestr = talloc_strdup(ctx, ""); - typestr[0] = 0; + if (!typestr) { + return NULL; + } - if (type & GENERIC_ALL_ACCESS) - fstrcat(typestr, "Generic all access "); - if (type & GENERIC_EXECUTE_ACCESS) - fstrcat(typestr, "Generic execute access "); - if (type & GENERIC_WRITE_ACCESS) - fstrcat(typestr, "Generic write access "); - if (type & GENERIC_READ_ACCESS) - fstrcat(typestr, "Generic read access "); - if (type & MAXIMUM_ALLOWED_ACCESS) - fstrcat(typestr, "MAXIMUM_ALLOWED_ACCESS "); - if (type & SYSTEM_SECURITY_ACCESS) - fstrcat(typestr, "SYSTEM_SECURITY_ACCESS "); - if (type & SYNCHRONIZE_ACCESS) - fstrcat(typestr, "SYNCHRONIZE_ACCESS "); - if (type & WRITE_OWNER_ACCESS) - fstrcat(typestr, "WRITE_OWNER_ACCESS "); - if (type & WRITE_DAC_ACCESS) - fstrcat(typestr, "WRITE_DAC_ACCESS "); - if (type & READ_CONTROL_ACCESS) - fstrcat(typestr, "READ_CONTROL_ACCESS "); - if (type & DELETE_ACCESS) - fstrcat(typestr, "DELETE_ACCESS "); + if (type & GENERIC_ALL_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "Generic all access "); + if (!typestr) { + return NULL; + } + } + if (type & GENERIC_EXECUTE_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "Generic execute access"); + if (!typestr) { + return NULL; + } + } + if (type & GENERIC_WRITE_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "Generic write access "); + if (!typestr) { + return NULL; + } + } + if (type & GENERIC_READ_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "Generic read access "); + if (!typestr) { + return NULL; + } + } + if (type & MAXIMUM_ALLOWED_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "MAXIMUM_ALLOWED_ACCESS "); + if (!typestr) { + return NULL; + } + } + if (type & SYSTEM_SECURITY_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "SYSTEM_SECURITY_ACCESS "); + if (!typestr) { + return NULL; + } + } + if (type & SYNCHRONIZE_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "SYNCHRONIZE_ACCESS "); + if (!typestr) { + return NULL; + } + } + if (type & WRITE_OWNER_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "WRITE_OWNER_ACCESS "); + if (!typestr) { + return NULL; + } + } + if (type & WRITE_DAC_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "WRITE_DAC_ACCESS "); + if (!typestr) { + return NULL; + } + } + if (type & READ_CONTROL_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "READ_CONTROL_ACCESS "); + if (!typestr) { + return NULL; + } + } + if (type & DELETE_ACCESS) { + typestr = talloc_asprintf_append(typestr, + "DELETE_ACCESS "); + if (!typestr) { + return NULL; + } + } printf("\t\tSpecific bits: 0x%lx\n", (unsigned long)type&SPECIFIC_RIGHTS_MASK); @@ -62,7 +120,9 @@ char *get_sec_mask_str(uint32 type) ****************************************************************************/ void display_sec_access(SEC_ACCESS *info) { - printf("\t\tPermissions: 0x%x: %s\n", *info, get_sec_mask_str(*info)); + char *mask_str = get_sec_mask_str(NULL, *info); + printf("\t\tPermissions: 0x%x: %s\n", *info, mask_str ? mask_str : ""); + TALLOC_FREE(mask_str); } /**************************************************************************** -- cgit From bf2c5e2bdeaeee3f157657be701a3e3cba480e15 Mon Sep 17 00:00:00 2001 From: Rishi Srivatsavai Date: Mon, 17 Dec 2007 22:09:09 -0800 Subject: Add smbclient support for basic mDNS browsing. Patch from Rishi Srivatsavai (bugzilla #4150), with tallocification and minor syle changes by me. (This used to be commit db74b99d0ef1a60894c838b4c9d0d454db6cf620) --- source3/Makefile.in | 8 +- source3/client/client.c | 7 ++ source3/client/dnsbrowse.c | 236 +++++++++++++++++++++++++++++++++++++++++++++ source3/configure.in | 1 + 4 files changed, 250 insertions(+), 2 deletions(-) create mode 100644 source3/client/dnsbrowse.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 21fc8cebf7..eda3297d23 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -673,6 +673,7 @@ LIBBIGBALLOFMUD_OBJ = $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) \ $(GROUPDB_OBJ) $(KRBCLIENT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) CLIENT_OBJ1 = client/client.o client/clitar.o rpc_client/cli_pipe.o \ + client/dnsbrowse.o \ $(RPC_CLIENT_OBJ1) \ $(RPC_PARSE_OBJ2) @@ -1140,7 +1141,8 @@ bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @BUILD_POPT@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) \ $(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \ - $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) @POPTLIBS@ @SMBD_LIBS@ + $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) \ + @POPTLIBS@ @SMBD_LIBS@ bin/nmbd@EXEEXT@: $(BINARY_PREREQS) $(NMBD_OBJ) @BUILD_POPT@ @echo Linking $@ @@ -1159,7 +1161,9 @@ bin/rpcclient@EXEEXT@: $(BINARY_PREREQS) $(RPCCLIENT_OBJ) @BUILD_POPT@ bin/smbclient@EXEEXT@: $(BINARY_PREREQS) $(CLIENT_OBJ) @BUILD_POPT@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) + @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(DYNEXP) \ + $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \ + $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(DNSSD_LIBS) bin/net@EXEEXT@: $(BINARY_PREREQS) $(NET_OBJ) @BUILD_POPT@ @echo Linking $@ diff --git a/source3/client/client.c b/source3/client/client.c index d59af9e6cf..97d7cf0e0b 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -28,10 +28,13 @@ #define REGISTER 0 #endif +extern int do_smb_browse(void); /* mDNS browsing */ + extern bool AllowDebugChange; extern bool override_logfile; extern char tar_type; extern bool in_client; + static int port = 0; static char *service; static char *desthost; @@ -4512,6 +4515,7 @@ static int do_message_op(void) { "send-buffer", 'b', POPT_ARG_INT, &io_bufsize, 'b', "Changes the transmit/send buffer", "BYTES" }, { "port", 'p', POPT_ARG_INT, &port, 'p', "Port to connect to", "PORT" }, { "grepable", 'g', POPT_ARG_NONE, NULL, 'g', "Produce grepable output" }, + { "browse", 'B', POPT_ARG_NONE, NULL, 'B', "Browse SMB servers using DNS" }, POPT_COMMON_SAMBA POPT_COMMON_CONNECTION POPT_COMMON_CREDENTIALS @@ -4654,6 +4658,9 @@ static int do_message_op(void) case 'g': grepable=true; break; + case 'B': + return(do_smb_browse()); + } } diff --git a/source3/client/dnsbrowse.c b/source3/client/dnsbrowse.c new file mode 100644 index 0000000000..c4819cebfa --- /dev/null +++ b/source3/client/dnsbrowse.c @@ -0,0 +1,236 @@ +/* + Unix SMB/CIFS implementation. + DNS-SD browse client + Copyright (C) Rishi Srivatsavai 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" + +#ifdef WITH_DNSSD_SUPPORT + +#include + +/* Holds service instances found during DNS browse */ +struct mdns_smbsrv_result +{ + char *serviceName; + char *regType; + char *domain; + uint32_t ifIndex; + struct mdns_smbsrv_result *nextResult; +}; + +/* Maintains state during DNS browse */ +struct mdns_browse_state +{ + struct mdns_smbsrv_result *listhead; /* Browse result list head */ + int browseDone; + +}; + + +static void +do_smb_resolve_reply (DNSServiceRef sdRef, DNSServiceFlags flags, + uint32_t interfaceIndex, DNSServiceErrorType errorCode, + const char *fullname, const char *hosttarget, uint16_t port, + uint16_t txtLen, const unsigned char *txtRecord, void *context) +{ + printf("SMB service available on %s port %u\n", + hosttarget, ntohs(port)); +} + + +static void do_smb_resolve(struct mdns_smbsrv_result *browsesrv) +{ + DNSServiceRef mdns_conn_sdref = NULL; + int mdnsfd; + int fdsetsz; + int ret; + fd_set *fdset = NULL; + struct timeval tv; + DNSServiceErrorType err; + + TALLOC_CTX * ctx = talloc_tos(); + + err = DNSServiceResolve(&mdns_conn_sdref, 0 /* flags */, + browsesrv->ifIndex, + browsesrv->serviceName, browsesrv->regType, browsesrv->domain, + do_smb_resolve_reply, NULL); + + if (err != kDNSServiceErr_NoError) { + return; + } + + mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref); + for (;;) { + if (fdset != NULL) { + TALLOC_FREE(fdset); + } + + fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask); + fdset = TALLOC_ZERO(ctx, fdsetsz); + FD_SET(mdnsfd, fdset); + + tv.tv_sec = 1; + tv.tv_usec = 0; + + /* Wait until response received from mDNS daemon */ + ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv); + if (ret <= 0 && errno != EINTR) { + break; + } + + if (FD_ISSET(mdnsfd, fdset)) { + /* Invoke callback function */ + DNSServiceProcessResult(mdns_conn_sdref); + break; + } + } + + TALLOC_FREE(fdset); + DNSServiceRefDeallocate(mdns_conn_sdref); +} + + +static void +do_smb_browse_reply(DNSServiceRef sdRef, DNSServiceFlags flags, + uint32_t interfaceIndex, DNSServiceErrorType errorCode, + const char *serviceName, const char *regtype, + const char *replyDomain, void *context) +{ + struct mdns_browse_state *bstatep = (struct mdns_browse_state *)context; + struct mdns_smbsrv_result *bresult; + + if (bstatep == NULL) { + return; + } + + if (errorCode != kDNSServiceErr_NoError) { + bstatep->browseDone = 1; + return; + } + + if (flags & kDNSServiceFlagsMoreComing) { + bstatep->browseDone = 0; + } else { + bstatep->browseDone = 1; + } + + if (!(flags & kDNSServiceFlagsAdd)) { + return; + } + + bresult = TALLOC_ARRAY(talloc_tos(), struct mdns_smbsrv_result, 1); + if (bresult == NULL) { + return; + } + + if (bstatep->listhead != NULL) { + bresult->nextResult = bstatep->listhead; + } + + bresult->serviceName = talloc_strdup(talloc_tos(), serviceName); + bresult->regType = talloc_strdup(talloc_tos(), regtype); + bresult->domain = talloc_strdup(talloc_tos(), replyDomain); + bresult->ifIndex = interfaceIndex; + bstatep->listhead = bresult; +} + +int do_smb_browse(void) +{ + int mdnsfd; + int fdsetsz; + int ret; + fd_set *fdset = NULL; + struct mdns_browse_state bstate; + struct mdns_smbsrv_result *resptr; + struct timeval tv; + DNSServiceRef mdns_conn_sdref = NULL; + DNSServiceErrorType err; + + TALLOC_CTX * ctx = talloc_stackframe(); + + ZERO_STRUCT(bstate); + + err = DNSServiceBrowse(&mdns_conn_sdref, 0, 0, "_smb._tcp", "", + do_smb_browse_reply, &bstate); + + if (err != kDNSServiceErr_NoError) { + d_printf("Error connecting to the Multicast DNS daemon\n"); + TALLOC_FREE(ctx); + return 1; + } + + mdnsfd = DNSServiceRefSockFD(mdns_conn_sdref); + for (;;) { + if (fdset != NULL) { + TALLOC_FREE(fdset); + } + + fdsetsz = howmany(mdnsfd + 1, NFDBITS) * sizeof(fd_mask); + fdset = TALLOC_ZERO(ctx, fdsetsz); + FD_SET(mdnsfd, fdset); + + tv.tv_sec = 1; + tv.tv_usec = 0; + + /* Wait until response received from mDNS daemon */ + ret = sys_select(mdnsfd + 1, fdset, NULL, NULL, &tv); + if (ret <= 0 && errno != EINTR) { + break; + } + + if (FD_ISSET(mdnsfd, fdset)) { + /* Invoke callback function */ + if (DNSServiceProcessResult(mdns_conn_sdref)) { + break; + } + if (bstate.browseDone) { + break; + } + } + } + + DNSServiceRefDeallocate(mdns_conn_sdref); + + if (bstate.listhead != NULL) { + resptr = bstate.listhead; + while (resptr != NULL) { + struct mdns_smbsrv_result *oldresptr; + oldresptr = resptr; + + /* Resolve smb service instance */ + do_smb_resolve(resptr); + + resptr = resptr->nextResult; + } + } + + TALLOC_FREE(ctx); + return 0; +} + +#else /* WITH_DNSSD_SUPPORT */ + +int do_smb_browse(void) +{ + d_printf("DNS-SD browsing is not supported on this platform\n"); + return 1; +} + +#endif /* WITH_DNSSD_SUPPORT */ + + diff --git a/source3/configure.in b/source3/configure.in index ac60b6f645..6015837a2e 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -6191,6 +6191,7 @@ AC_SUBST(FLAGS1) AC_ARG_ENABLE(dnssd, [ --enable-dnssd Enable DNS service discovery support (default=auto)]) +AC_SUBST(DNSSD_LIBS) if test x"$enable_dnssd" != x"no"; then have_dnssd_support=yes -- cgit From 68e65b29815f1f9bbe7384e07fc341f6c8f2f605 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 18 Dec 2007 07:58:22 +0100 Subject: Fix a debug message: add missing space. Michael (This used to be commit 6a7f2a59fc370e226ddacb195059155f28c6c157) --- source3/rpc_client/cli_pipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 5a4ccf4f02..f4cb424527 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -2364,8 +2364,8 @@ static struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp_internal(struct cli_sta goto err; } - DEBUG(10,("cli_rpc_pipe_open_ntlmssp_internal: opened pipe %s to machine %s and" - "bound NTLMSSP as user %s\\%s.\n", + DEBUG(10,("cli_rpc_pipe_open_ntlmssp_internal: opened pipe %s to " + "machine %s and bound NTLMSSP as user %s\\%s.\n", result->pipe_name, cli->desthost, domain, username )); -- cgit From f427d4ce65659419c8989d87acd97d00b4db41e6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 18 Dec 2007 09:41:03 +0100 Subject: Add a in-memory cache This is a more general API that caches data with a LRU scheme. See include/cache.h. No comments yet, I'm still working on it. But Jeremy has given me a hint in one of his checkins that he would like to make use of this now. The idea is that we get rid of all our silly little caches and merge them all into one cache that we can then very easily trim, for example even with a smbcontrol message if someone decides memory is tight. The main user is the stat cache, this patch also converts the getwd cache. More caches to come. (This used to be commit 7a911b35713538d82001a3c9f34152e293fe1943) --- source3/Makefile.in | 2 +- source3/include/includes.h | 1 + source3/lib/cache.c | 298 ++++++++++++++++++++++++++++++++++++++++++++ source3/param/loadparm.c | 7 +- source3/smbd/mangle_hash2.c | 67 +++------- source3/smbd/server.c | 13 ++ source3/smbd/statcache.c | 64 ++++------ source3/smbd/vfs.c | 168 +++++++++---------------- source3/torture/torture.c | 76 +++++++++++ source3/torture/vfstest.c | 13 ++ 10 files changed, 505 insertions(+), 204 deletions(-) create mode 100644 source3/lib/cache.c diff --git a/source3/Makefile.in b/source3/Makefile.in index eda3297d23..81c8330216 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -284,7 +284,7 @@ TALLOC_OBJ = lib/talloc/talloc.o LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(NSS_WRAPPER_OBJ) $(TALLOC_OBJ) \ lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \ lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \ - lib/interfaces.o lib/rbtree.o + lib/interfaces.o lib/rbtree.o lib/cache.o LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/interface.o lib/md4.o \ diff --git a/source3/include/includes.h b/source3/include/includes.h index 22451741a1..a45176aba3 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -719,6 +719,7 @@ typedef char fstring[FSTRING_LEN]; #include "packet.h" #include "ctdbd_conn.h" #include "talloc_stack.h" +#include "cache.h" /* used in net.c */ struct functable { diff --git a/source3/lib/cache.c b/source3/lib/cache.c new file mode 100644 index 0000000000..baf2fe3984 --- /dev/null +++ b/source3/lib/cache.c @@ -0,0 +1,298 @@ +/* + Unix SMB/CIFS implementation. + In-memory cache + Copyright (C) Volker Lendecke 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "cache.h" +#include "rbtree.h" + +struct memcache_element { + struct rb_node rb_node; + struct memcache_element *prev, *next; + size_t keylength, valuelength; + uint8 n; /* This is really an enum, but save memory */ + char data[1]; /* placeholder for offsetof */ +}; + +struct memcache { + struct memcache_element *mru, *lru; + struct rb_root tree; + size_t size; + size_t max_size; +}; + +static int memcache_destructor(struct memcache *cache) { + struct memcache_element *e, *next; + + for (e = cache->mru; e != NULL; e = next) { + next = e->next; + SAFE_FREE(e); + } + return 0; +} + +struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size) +{ + struct memcache *result; + + result = TALLOC_ZERO_P(mem_ctx, struct memcache); + if (result == NULL) { + return NULL; + } + result->max_size = max_size; + talloc_set_destructor(result, memcache_destructor); + return result; +} + +static struct memcache_element *memcache_node2elem(struct rb_node *node) +{ + return (struct memcache_element *) + ((char *)node - offsetof(struct memcache_element, rb_node)); +} + +static void memcache_element_parse(struct memcache_element *e, + DATA_BLOB *key, DATA_BLOB *value) +{ + key->data = ((uint8 *)e) + offsetof(struct memcache_element, data); + key->length = e->keylength; + value->data = key->data + e->keylength; + value->length = e->valuelength; +} + +static size_t memcache_element_size(size_t key_length, size_t value_length) +{ + return sizeof(struct memcache_element) - 1 + key_length + value_length; +} + +static int memcache_compare(struct memcache_element *e, enum memcache_number n, + DATA_BLOB key) +{ + DATA_BLOB this_key, this_value; + + if ((int)e->n < (int)n) return -1; + if ((int)e->n > (int)n) return 1; + + if (e->keylength < key.length) return -1; + if (e->keylength > key.length) return 1; + + memcache_element_parse(e, &this_key, &this_value); + return memcmp(this_key.data, key.data, key.length); +} + +static struct memcache_element *memcache_find( + struct memcache *cache, enum memcache_number n, DATA_BLOB key) +{ + struct rb_node *node; + + node = cache->tree.rb_node; + + while (node != NULL) { + struct memcache_element *elem = memcache_node2elem(node); + int cmp; + + cmp = memcache_compare(elem, n, key); + if (cmp == 0) { + return elem; + } + node = (cmp < 0) ? node->rb_left : node->rb_right; + } + + return NULL; +} + +bool memcache_lookup(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB *value) +{ + struct memcache_element *e; + + e = memcache_find(cache, n, key); + if (e == NULL) { + return false; + } + + if (cache->size != 0) { + /* + * Do LRU promotion only when we will ever shrink + */ + if (e == cache->lru) { + cache->lru = e->prev; + } + DLIST_PROMOTE(cache->mru, e); + if (cache->mru == NULL) { + cache->mru = e; + } + } + + memcache_element_parse(e, &key, value); + return true; +} + +static void memcache_delete_element(struct memcache *cache, + struct memcache_element *e) +{ + rb_erase(&e->rb_node, &cache->tree); + + if (e == cache->lru) { + cache->lru = e->prev; + } + DLIST_REMOVE(cache->mru, e); + + cache->size -= memcache_element_size(e->keylength, e->valuelength); + + SAFE_FREE(e); +} + +static void memcache_trim(struct memcache *cache) +{ + if (cache->max_size == 0) { + return; + } + + while ((cache->size > cache->max_size) && (cache->lru != NULL)) { + memcache_delete_element(cache, cache->lru); + } +} + +void memcache_delete(struct memcache *cache, enum memcache_number n, + DATA_BLOB key) +{ + struct memcache_element *e; + + e = memcache_find(cache, n, key); + if (e == NULL) { + return; + } + + memcache_delete_element(cache, e); +} + +void memcache_add(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB value) +{ + struct memcache_element *e; + struct rb_node **p; + struct rb_node *parent; + DATA_BLOB cache_key, cache_value; + size_t element_size; + + if (key.length == 0) { + return; + } + + e = memcache_find(cache, n, key); + + if (e != NULL) { + memcache_element_parse(e, &cache_key, &cache_value); + + if (value.length <= cache_value.length) { + /* + * We can reuse the existing record + */ + memcpy(cache_value.data, value.data, value.length); + e->valuelength = value.length; + return; + } + + memcache_delete_element(cache, e); + } + + element_size = memcache_element_size(key.length, value.length); + + + e = (struct memcache_element *)SMB_MALLOC(element_size); + + if (e == NULL) { + DEBUG(0, ("malloc failed\n")); + return; + } + + e->n = n; + e->keylength = key.length; + e->valuelength = value.length; + + memcache_element_parse(e, &cache_key, &cache_value); + memcpy(cache_key.data, key.data, key.length); + memcpy(cache_value.data, value.data, value.length); + + parent = NULL; + p = &cache->tree.rb_node; + + while (*p) { + struct memcache_element *elem = memcache_node2elem(*p); + int cmp; + + parent = (*p); + + cmp = memcache_compare(elem, n, key); + + p = (cmp < 0) ? &(*p)->rb_left : &(*p)->rb_right; + } + + rb_link_node(&e->rb_node, parent, p); + rb_insert_color(&e->rb_node, &cache->tree); + + DLIST_ADD(cache->mru, e); + if (cache->lru == NULL) { + cache->lru = e; + } + + cache->size += element_size; + memcache_trim(cache); +} + +void memcache_flush(struct memcache *cache, enum memcache_number n) +{ + struct rb_node *node; + + /* + * Find the smallest element of number n + */ + + node = cache->tree.rb_node; + if (node == NULL) { + return; + } + + while (true) { + struct memcache_element *elem = memcache_node2elem(node); + struct rb_node *next; + + if ((int)elem->n < (int)n) { + next = node->rb_right; + } + else { + next = node->rb_left; + } + if (next == NULL) { + break; + } + node = next; + } + + node = rb_next(node); + if (node == NULL) { + return; + } + + while (node != NULL) { + struct memcache_element *e = memcache_node2elem(node); + struct rb_node *next = rb_next(node); + + memcache_delete_element(cache, e); + node = next; + } +} diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 881bcece7c..eea3ecec2b 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -88,8 +88,6 @@ static bool include_registry_globals = False; #define USERSHARE_VALID 1 #define USERSHARE_PENDING_DELETE 2 -bool use_getwd_cache = True; - extern int extra_time_offset; static bool defaults_saved = False; @@ -215,6 +213,7 @@ typedef struct { int pwordlevel; int unamelevel; int deadtime; + bool getwd_cache; int maxprotocol; int minprotocol; int security; @@ -1037,7 +1036,7 @@ static struct parm_struct parm_table[] = { {"block size", P_INTEGER, P_LOCAL, &sDefault.iBlock_size, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL}, {"deadtime", P_INTEGER, P_GLOBAL, &Globals.deadtime, NULL, NULL, FLAG_ADVANCED}, - {"getwd cache", P_BOOL, P_GLOBAL, &use_getwd_cache, NULL, NULL, FLAG_ADVANCED}, + {"getwd cache", P_BOOL, P_GLOBAL, &Globals.getwd_cache, NULL, NULL, FLAG_ADVANCED}, {"keepalive", P_INTEGER, P_GLOBAL, &Globals.iKeepalive, NULL, NULL, FLAG_ADVANCED}, {"change notify", P_BOOL, P_LOCAL, &sDefault.bChangeNotify, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE }, {"directory name cache size", P_INTEGER, P_LOCAL, &sDefault.iDirectoryNameCacheSize, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE }, @@ -1535,6 +1534,7 @@ static void init_globals(bool first_time_only) Globals.pwordlevel = 0; Globals.unamelevel = 0; Globals.deadtime = 0; + Globals.getwd_cache = true; Globals.bLargeReadwrite = True; Globals.max_log_size = 5000; Globals.max_open_files = MAX_OPEN_FILES; @@ -2023,6 +2023,7 @@ FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux) FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel) FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel) FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime) +FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache) FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol) FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol) FN_GLOBAL_INTEGER(lp_security, &Globals.security) diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c index 7066c2a4e5..9643506aea 100644 --- a/source3/smbd/mangle_hash2.c +++ b/source3/smbd/mangle_hash2.c @@ -93,15 +93,6 @@ static unsigned char char_flags[256]; */ static unsigned mangle_prefix; -/* we will use a very simple direct mapped prefix cache. The big - advantage of this cache structure is speed and low memory usage - - The cache is indexed by the low-order bits of the hash, and confirmed by - hashing the resulting cache entry to match the known hash -*/ -static char **prefix_cache; -static unsigned int *prefix_cache_hashes; - /* these are the characters we use in the 8.3 hash. Must be 36 chars long */ static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static unsigned char base_reverse[256]; @@ -147,57 +138,39 @@ static unsigned int mangle_hash(const char *key, unsigned int length) return value & ~0x80000000; } -/* - initialise (ie. allocate) the prefix cache - */ -static bool cache_init(void) -{ - if (prefix_cache) { - return True; - } - - prefix_cache = SMB_CALLOC_ARRAY(char *,MANGLE_CACHE_SIZE); - if (!prefix_cache) { - return False; - } - - prefix_cache_hashes = SMB_CALLOC_ARRAY(unsigned int, MANGLE_CACHE_SIZE); - if (!prefix_cache_hashes) { - SAFE_FREE(prefix_cache); - return False; - } - - return True; -} - /* insert an entry into the prefix cache. The string might not be null terminated */ static void cache_insert(const char *prefix, int length, unsigned int hash) { - int i = hash % MANGLE_CACHE_SIZE; + char *str = SMB_STRNDUP(prefix, length); - if (prefix_cache[i]) { - free(prefix_cache[i]); + if (str == NULL) { + return; } - prefix_cache[i] = SMB_STRNDUP(prefix, length); - prefix_cache_hashes[i] = hash; + memcache_add(smbd_memcache(), MANGLE_HASH2_CACHE, + data_blob_const(&hash, sizeof(hash)), + data_blob_const(str, length+1)); + SAFE_FREE(str); } /* lookup an entry in the prefix cache. Return NULL if not found. */ -static const char *cache_lookup(unsigned int hash) +static char *cache_lookup(TALLOC_CTX *mem_ctx, unsigned int hash) { - int i = hash % MANGLE_CACHE_SIZE; + DATA_BLOB value; - if (!prefix_cache[i] || hash != prefix_cache_hashes[i]) { + if (!memcache_lookup(smbd_memcache(), MANGLE_HASH2_CACHE, + data_blob_const(&hash, sizeof(hash)), &value)) { return NULL; } - /* yep, it matched */ - return prefix_cache[i]; + SMB_ASSERT((value.length > 0) + && (value.data[value.length-1] == '\0')); + + return talloc_strdup(mem_ctx, (char *)value.data); } @@ -377,7 +350,7 @@ static bool lookup_name_from_8_3(TALLOC_CTX *ctx, { unsigned int hash, multiplier; unsigned int i; - const char *prefix; + char *prefix; char extension[4]; *pp_out = NULL; @@ -397,7 +370,7 @@ static bool lookup_name_from_8_3(TALLOC_CTX *ctx, } /* now look in the prefix cache for that hash */ - prefix = cache_lookup(hash); + prefix = cache_lookup(ctx, hash); if (!prefix) { M_DEBUG(10,("lookup_name_from_8_3: %s -> %08X -> not found\n", name, hash)); @@ -421,6 +394,8 @@ static bool lookup_name_from_8_3(TALLOC_CTX *ctx, *pp_out = talloc_strdup(ctx, prefix); } + TALLOC_FREE(prefix); + if (!pp_out) { M_DEBUG(0,("talloc_fail")); return False; @@ -728,10 +703,6 @@ struct mangle_fns *mangle_hash2_init(void) init_tables(); mangle_reset(); - if (!cache_init()) { - return NULL; - } - return &mangle_fns; } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 41d036a8b9..574197d711 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -86,6 +86,19 @@ struct messaging_context *smbd_messaging_context(void) return ctx; } +struct memcache *smbd_memcache(void) +{ + static struct memcache *cache; + + if (!cache + && !(cache = memcache_init(NULL, + lp_max_stat_cache_size()*1024))) { + + smb_panic("Could not init smbd memcache"); + } + return cache; +} + /******************************************************************* What to do when smb.conf is updated. ********************************************************************/ diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c index 8f1e008985..72fed008a2 100644 --- a/source3/smbd/statcache.c +++ b/source3/smbd/statcache.c @@ -26,8 +26,6 @@ Stat cache code used in unix_convert. *****************************************************************************/ -static TDB_CONTEXT *tdb_stat_cache; - /** * Add an entry into the stat cache. * @@ -45,10 +43,8 @@ void stat_cache_add( const char *full_orig_name, bool case_sensitive) { size_t translated_path_length; - TDB_DATA data_val; char *original_path; size_t original_path_length; - size_t sc_size = lp_max_stat_cache_size(); char saved_char; TALLOC_CTX *ctx = talloc_tos(); @@ -56,12 +52,6 @@ void stat_cache_add( const char *full_orig_name, return; } - if (sc_size && (tdb_map_size(tdb_stat_cache) > sc_size*1024)) { - reset_stat_cache(); - } - - ZERO_STRUCT(data_val); - /* * Don't cache trivial valid directory entries such as . and .. */ @@ -132,24 +122,20 @@ void stat_cache_add( const char *full_orig_name, saved_char = translated_path[translated_path_length]; translated_path[translated_path_length] = '\0'; - data_val.dsize = translated_path_length + 1; - data_val.dptr = (uint8 *)translated_path; - /* * New entry or replace old entry. */ - if (tdb_store_bystring(tdb_stat_cache, original_path, data_val, - TDB_REPLACE) != 0) { - DEBUG(0,("stat_cache_add: Error storing entry %s -> %s\n", - original_path, translated_path)); - } else { - DEBUG(5,("stat_cache_add: Added entry (%lx:size%x) %s -> %s\n", - (unsigned long)data_val.dptr, - (unsigned int)data_val.dsize, - original_path, - translated_path)); - } + memcache_add( + smbd_memcache(), STAT_CACHE, + data_blob_const(original_path, original_path_length), + data_blob_const(translated_path, translated_path_length + 1)); + + DEBUG(5,("stat_cache_add: Added entry (%lx:size %x) %s -> %s\n", + (unsigned long)translated_path, + (unsigned int)translated_path_length, + original_path, + translated_path)); translated_path[translated_path_length] = saved_char; TALLOC_FREE(original_path); @@ -186,7 +172,7 @@ bool stat_cache_lookup(connection_struct *conn, unsigned int num_components = 0; char *translated_path; size_t translated_path_length; - TDB_DATA data_val; + DATA_BLOB data_val; char *name; TALLOC_CTX *ctx = talloc_tos(); @@ -236,9 +222,12 @@ bool stat_cache_lookup(connection_struct *conn, while (1) { char *sp; - data_val = tdb_fetch_bystring(tdb_stat_cache, chk_name); + data_val = data_blob_null; - if (data_val.dptr != NULL && data_val.dsize != 0) { + if (memcache_lookup( + smbd_memcache(), STAT_CACHE, + data_blob_const(chk_name, strlen(chk_name)), + &data_val)) { break; } @@ -275,12 +264,11 @@ bool stat_cache_lookup(connection_struct *conn, } } - translated_path = talloc_strdup(ctx,(char *)data_val.dptr); + translated_path = talloc_strdup(ctx,(char *)data_val.data); if (!translated_path) { smb_panic("talloc failed"); } - translated_path_length = data_val.dsize - 1; - SAFE_FREE(data_val.dptr); + translated_path_length = data_val.length - 1; DEBUG(10,("stat_cache_lookup: lookup succeeded for name [%s] " "-> [%s]\n", chk_name, translated_path )); @@ -288,7 +276,8 @@ bool stat_cache_lookup(connection_struct *conn, if (SMB_VFS_STAT(conn, translated_path, pst) != 0) { /* Discard this entry - it doesn't exist in the filesystem. */ - tdb_delete_bystring(tdb_stat_cache, chk_name); + memcache_delete(smbd_memcache(), STAT_CACHE, + data_blob_const(chk_name, strlen(chk_name))); TALLOC_FREE(chk_name); TALLOC_FREE(translated_path); return False; @@ -366,7 +355,8 @@ void stat_cache_delete(const char *name) DEBUG(10,("stat_cache_delete: deleting name [%s] -> %s\n", lname, name )); - tdb_delete_bystring(tdb_stat_cache, lname); + memcache_delete(smbd_memcache(), STAT_CACHE, + data_blob_const(lname, talloc_get_size(lname)-1)); TALLOC_FREE(lname); } @@ -395,15 +385,7 @@ bool reset_stat_cache( void ) if (!lp_stat_cache()) return True; - if (tdb_stat_cache) { - tdb_close(tdb_stat_cache); - } + memcache_flush(smbd_memcache(), STAT_CACHE); - /* Create the in-memory tdb using our custom hash function. */ - tdb_stat_cache = tdb_open_ex("statcache", 1031, TDB_INTERNAL, - (O_RDWR|O_CREAT), 0644, NULL, fast_string_hash); - - if (!tdb_stat_cache) - return False; return True; } diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 628d2eec4b..45d0788117 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -731,152 +731,98 @@ int vfs_ChDir(connection_struct *conn, const char *path) return(res); } -/* number of list structures for a caching GetWd function. */ -#define MAX_GETWDCACHE (50) - -static struct { - SMB_DEV_T dev; /* These *must* be compatible with the types returned in a stat() call. */ - SMB_INO_T inode; /* These *must* be compatible with the types returned in a stat() call. */ - char *path; /* The pathname. */ - bool valid; -} ino_list[MAX_GETWDCACHE]; - -extern bool use_getwd_cache; - -/**************************************************************************** - Prompte a ptr (to make it recently used) -****************************************************************************/ - -static void array_promote(char *array,int elsize,int element) -{ - char *p; - if (element == 0) - return; - - p = (char *)SMB_MALLOC(elsize); - - if (!p) { - DEBUG(5,("array_promote: malloc fail\n")); - return; - } - - memcpy(p,array + element * elsize, elsize); - memmove(array + elsize,array,elsize*element); - memcpy(array,p,elsize); - SAFE_FREE(p); -} - /******************************************************************* Return the absolute current directory path - given a UNIX pathname. Note that this path is returned in DOS format, not UNIX format. Note this can be called with conn == NULL. ********************************************************************/ +struct getwd_cache_key { + SMB_DEV_T dev; + SMB_INO_T ino; +}; + char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn) { char s[PATH_MAX+1]; - static bool getwd_cache_init = False; SMB_STRUCT_STAT st, st2; - int i; - char *ret = NULL; + char *result; + DATA_BLOB cache_value; + struct getwd_cache_key key; *s = 0; - if (!use_getwd_cache) { - nocache: - ret = SMB_VFS_GETWD(conn,s); - if (!ret) { - DEBUG(0,("vfs_GetWd: SMB_VFS_GETWD call failed, " - "errno %s\n",strerror(errno))); - return NULL; - } - return talloc_strdup(ctx, ret); - } - - /* init the cache */ - if (!getwd_cache_init) { - getwd_cache_init = True; - for (i=0;i 0) + && (cache_value.data[cache_value.length-1] == '\0')); - /* promote it for future use */ - array_promote((char *)&ino_list[0],sizeof(ino_list[0]),i); - if (ret == NULL) { - errno = ENOMEM; - } - return ret; - } else { - /* If the inode is different then something's changed, - scrub the entry and start from scratch. */ - ino_list[i].valid = False; - } - } - } + if ((SMB_VFS_STAT(conn, (char *)cache_value.data, &st2) == 0) + && (st.st_dev == st2.st_dev) && (st.st_ino == st2.st_ino) + && (S_ISDIR(st.st_mode))) { + /* + * Ok, we're done + */ + result = talloc_strdup(ctx, (char *)cache_value.data); + if (result == NULL) { + errno = ENOMEM; } + return result; } - /* We don't have the information to hand so rely on traditional - * methods. The very slow getcwd, which spawns a process on some - * systems, or the not quite so bad getwd. */ + nocache: + + /* + * We don't have the information to hand so rely on traditional + * methods. The very slow getcwd, which spawns a process on some + * systems, or the not quite so bad getwd. + */ if (!SMB_VFS_GETWD(conn,s)) { - DEBUG(0,("vfs_GetWd: SMB_VFS_GETWD call failed, errno %s\n", - strerror(errno))); - return (NULL); + DEBUG(0, ("vfs_GetWd: SMB_VFS_GETWD call failed: %s\n", + strerror(errno))); + return NULL; } - ret = talloc_strdup(ctx,s); - - DEBUG(5,("vfs_GetWd %s, inode %.0f, dev %.0f\n", - s,(double)st.st_ino,(double)st.st_dev)); - - /* add it to the cache */ - i = MAX_GETWDCACHE - 1; - string_set(&ino_list[i].path,s); - ino_list[i].dev = st.st_dev; - ino_list[i].inode = st.st_ino; - ino_list[i].valid = True; + if (lp_getwd_cache() && VALID_STAT(st)) { + ZERO_STRUCT(key); /* unlikely, but possible padding */ + key.dev = st.st_dev; + key.ino = st.st_ino; - /* put it at the top of the list */ - array_promote((char *)&ino_list[0],sizeof(ino_list[0]),i); + memcache_add(smbd_memcache(), GETWD_CACHE, + data_blob_const(&key, sizeof(key)), + data_blob_const(s, strlen(s)+1)); + } - if (ret == NULL) { + result = talloc_strdup(ctx, s); + if (result == NULL) { errno = ENOMEM; } - return ret; + return result; } /******************************************************************* diff --git a/source3/torture/torture.c b/source3/torture/torture.c index ad57470c61..082949e0af 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -5042,6 +5042,81 @@ static bool run_local_rbtree(int dummy) return ret; } +static bool data_blob_equal(DATA_BLOB a, DATA_BLOB b) +{ + if (a.length != b.length) { + printf("a.length=%d != b.length=%d\n", + (int)a.length, (int)b.length); + return false; + } + if (memcmp(a.data, b.data, a.length) != 0) { + printf("a.data and b.data differ\n"); + return false; + } + return true; +} + +static bool run_local_memcache(int dummy) +{ + struct memcache *cache; + DATA_BLOB k1, k2; + DATA_BLOB d1, d2, d3; + DATA_BLOB v1, v2, v3; + + cache = memcache_init(NULL, 100); + + if (cache == NULL) { + printf("memcache_init failed\n"); + return false; + } + + d1 = data_blob_const("d1", 2); + d2 = data_blob_const("d2", 2); + d3 = data_blob_const("d3", 2); + + k1 = data_blob_const("d1", 2); + k2 = data_blob_const("d2", 2); + + memcache_add(cache, STAT_CACHE, k1, d1); + memcache_add(cache, GETWD_CACHE, k2, d2); + + if (!memcache_lookup(cache, STAT_CACHE, k1, &v1)) { + printf("could not find k1\n"); + return false; + } + if (!data_blob_equal(d1, v1)) { + return false; + } + + if (!memcache_lookup(cache, GETWD_CACHE, k2, &v2)) { + printf("could not find k2\n"); + return false; + } + if (!data_blob_equal(d2, v2)) { + return false; + } + + memcache_add(cache, STAT_CACHE, k1, d3); + + if (!memcache_lookup(cache, STAT_CACHE, k1, &v3)) { + printf("could not find replaced k1\n"); + return false; + } + if (!data_blob_equal(d3, v3)) { + return false; + } + + memcache_add(cache, GETWD_CACHE, k1, d1); + + if (memcache_lookup(cache, GETWD_CACHE, k2, &v2)) { + printf("Did find k2, should have been purged\n"); + return false; + } + + TALLOC_FREE(cache); + return true; +} + static double create_procs(bool (*fn)(int), bool *result) { int i, status; @@ -5196,6 +5271,7 @@ static struct { { "LOCAL-SUBSTITUTE", run_local_substitute, 0}, { "LOCAL-GENCACHE", run_local_gencache, 0}, { "LOCAL-RBTREE", run_local_rbtree, 0}, + { "LOCAL-MEMCACHE", run_local_memcache, 0}, {NULL, NULL, 0}}; diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c index 1436ecc022..7e4ee624a1 100644 --- a/source3/torture/vfstest.c +++ b/source3/torture/vfstest.c @@ -495,6 +495,19 @@ struct messaging_context *smbd_messaging_context(void) return ctx; } +struct memcache *smbd_memcache(void) +{ + static struct memcache *cache; + + if (!cache + && !(cache = memcache_init(NULL, + lp_max_stat_cache_size()*1024))) { + + smb_panic("Could not init smbd memcache"); + } + return cache; +} + /* Main function */ int main(int argc, char *argv[]) -- cgit From b940e473dd15a8d6d670d241a7c9010791b66b1e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 18 Dec 2007 10:07:08 +0100 Subject: Add forgotten cache.h (This used to be commit 0dc4d6a8de84c191e339ee08c7f06ca63f83e6f3) --- source3/include/cache.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 source3/include/cache.h diff --git a/source3/include/cache.h b/source3/include/cache.h new file mode 100644 index 0000000000..460a33b3a1 --- /dev/null +++ b/source3/include/cache.h @@ -0,0 +1,51 @@ +/* + Unix SMB/CIFS implementation. + In-memory cache + Copyright (C) Volker Lendecke 2005-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef __CACHE_H__ +#define __CACHE_H__ + +#include "includes.h" + +struct memcache; + +enum memcache_number { + STAT_CACHE, + UID_SID_CACHE, + SID_UID_CACHE, + GID_SID_CACHE, + SID_GID_CACHE, + GETWD_CACHE, + GETPWNAM_CACHE, + MANGLE_HASH2_CACHE +}; + +struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size); + +void memcache_add(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB value); + +void memcache_delete(struct memcache *cache, enum memcache_number n, + DATA_BLOB key); + +bool memcache_lookup(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB *value); + +void memcache_flush(struct memcache *cache, enum memcache_number n); + +#endif -- cgit From 1394b91888f4e2f74ebbe462e896e49079d0146d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 18 Dec 2007 16:32:57 +0100 Subject: Fix an error when accessing unallocated sid in error path. Michael (This used to be commit 2a0585d3093265a499c9fef60d500059f79b4112) --- source3/rpcclient/cmd_samr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index dae6c42bf2..601e62fe94 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -2114,11 +2114,11 @@ static NTSTATUS cmd_samr_lookup_domain(struct rpc_pipe_client *cli, result = rpccli_samr_lookup_domain( cli, mem_ctx, &connect_pol, domain_name, &sid); - sid_to_fstring(sid_string,&sid); - - if (NT_STATUS_IS_OK(result)) + if (NT_STATUS_IS_OK(result)) { + sid_to_fstring(sid_string,&sid); printf("SAMR_LOOKUP_DOMAIN: Domain Name: %s Domain SID: %s\n", domain_name,sid_string); + } rpccli_samr_close(cli, mem_ctx, &domain_pol); rpccli_samr_close(cli, mem_ctx, &connect_pol); -- cgit From 537c4cf9cdb1f76c317c8fbd12068ce1f3fbbf0b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 18 Dec 2007 16:03:57 -0800 Subject: Fix valgrind error in dbwrap_rbt where rec_priv->node was being accessed after free. VALOKER PLEASE CHECK THIS VERY CAREFULLY !!!! This is a correct fix in that it fixes the valgrind error, but it looks inelegant to me. I think if I understood this code better I could craft a more subtle fix. Still looking at it.... Jeremy. (This used to be commit 12cce3be2a24fd72106d747890caf6c7f29db43d) --- source3/lib/dbwrap_rbt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source3/lib/dbwrap_rbt.c b/source3/lib/dbwrap_rbt.c index df568a0410..15d9b67414 100644 --- a/source3/lib/dbwrap_rbt.c +++ b/source3/lib/dbwrap_rbt.c @@ -68,6 +68,8 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) TDB_DATA this_key, this_val; + bool del_old_keyval = false; + if (rec_priv->node != NULL) { /* @@ -95,7 +97,7 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) */ rb_erase(&rec_priv->node->rb_node, &rec_priv->db_ctx->tree); - SAFE_FREE(rec_priv->node); + del_old_keyval = true; } node = (struct db_rbt_node *)SMB_MALLOC( @@ -103,6 +105,9 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) + data.dsize); if (node == NULL) { + if (del_old_keyval) { + SAFE_FREE(rec_priv->node); + } return NT_STATUS_NO_MEMORY; } @@ -152,6 +157,10 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) rb_link_node(&node->rb_node, parent, p); rb_insert_color(&node->rb_node, &rec_priv->db_ctx->tree); + if (del_old_keyval) { + SAFE_FREE(rec_priv->node); + } + return NT_STATUS_OK; } -- cgit From c99dc69a453a67a38b1a1d5c5088a55d22a68651 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 18 Dec 2007 17:30:02 -0800 Subject: We've finished with the old node once we've copied the keyval. Jeremy. (This used to be commit 39f3efbcc5fbdff1db1b12e5fc7368968f240993) --- source3/lib/dbwrap_rbt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/lib/dbwrap_rbt.c b/source3/lib/dbwrap_rbt.c index 15d9b67414..468b9405ee 100644 --- a/source3/lib/dbwrap_rbt.c +++ b/source3/lib/dbwrap_rbt.c @@ -121,6 +121,10 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) memcpy(this_key.dptr, rec->key.dptr, node->keysize); memcpy(this_val.dptr, data.dptr, node->valuesize); + if (del_old_keyval) { + SAFE_FREE(rec_priv->node); + } + parent = NULL; p = &rec_priv->db_ctx->tree.rb_node; @@ -157,10 +161,6 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) rb_link_node(&node->rb_node, parent, p); rb_insert_color(&node->rb_node, &rec_priv->db_ctx->tree); - if (del_old_keyval) { - SAFE_FREE(rec_priv->node); - } - return NT_STATUS_OK; } -- cgit From 75ca69243019ae1f422bd0e7c336e9f92a0d941c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 18 Dec 2007 18:01:34 -0800 Subject: Remove another static fstring. Jeremy. (This used to be commit f9182bbe628cb5f5395a08b2e09d4a282a99d7dc) --- source3/printing/lpq_parse.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c index 56e228f219..6dcddb6f1b 100644 --- a/source3/printing/lpq_parse.c +++ b/source3/printing/lpq_parse.c @@ -444,7 +444,7 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first) { /* must read two lines to process, therefore keep some values static */ static bool header_line_ok=False, base_prio_reset=False; - static fstring jobuser; + static char *jobuser; static int jobid; static int jobprio; static time_t jobtime; @@ -511,7 +511,11 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first) buf->job = jobid; buf->status = jobstat; buf->priority = jobprio; - fstrcpy(buf->fs_user,jobuser); + if (jobuser) { + fstrcpy(buf->fs_user,jobuser); + } else { + buf->fs_user[0] = '\0'; + } TALLOC_FREE(frame); return True; @@ -548,7 +552,8 @@ static bool parse_lpq_hpux(char *line, print_queue_struct *buf, bool first) return False; } jobid = atoi(tok[1]); - fstrcpy(jobuser,tok[2]); + SAFE_FREE(jobuser); + jobuser = SMB_STRDUP(tok[2]); jobprio = atoi(tok[4]); /* process time */ -- cgit From a34c6cd0e7046c1127b05bf3b5d5819f1d500cbc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 18 Dec 2007 18:10:09 -0800 Subject: Remove last_message completely as it's no longer used. Jeremy. (This used to be commit c378c3edc1197d46c5d6eb2bcabbf9e774c03ffc) --- source3/smbd/process.c | 3 --- source3/smbd/server.c | 6 ------ 2 files changed, 9 deletions(-) diff --git a/source3/smbd/process.c b/source3/smbd/process.c index ffc9e106f6..ee76f90bf5 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -38,7 +38,6 @@ int max_send = BUFFER_SIZE; */ int max_recv = BUFFER_SIZE; -extern int last_message; SIG_ATOMIC_T reload_after_sighup = 0; SIG_ATOMIC_T got_sig_term = 0; extern bool global_machine_password_needs_changing; @@ -1308,8 +1307,6 @@ static void switch_message(uint8 type, struct smb_request *req, int size) errno = 0; - last_message = type; - /* Make sure this is an SMB packet. smb_size contains NetBIOS header * so subtract 4 from it. */ if ((strncmp(smb_base(req->inbuf),"\377SMB",4) != 0) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 574197d711..40037074f6 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -27,12 +27,6 @@ static_decl_rpc; static int am_parent = 1; -/* the last message the was processed */ -int last_message = -1; - -/* a useful macro to debug the last message processed */ -#define LAST_MESSAGE() smb_fn_name(last_message) - extern struct auth_context *negprot_global_auth_context; extern SIG_ATOMIC_T got_sig_term; extern SIG_ATOMIC_T reload_after_sighup; -- cgit From 7326612cfd035c5bf15965ab9a297617110a8d2c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 18 Dec 2007 18:16:40 -0800 Subject: Two more static fstrings gone. Jeremy. (This used to be commit 4056bb8645821fba95d6e9ca4d82e2d5084c1e5c) --- source3/printing/nt_printing.c | 55 +++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index ec4e8c59d5..f83f898cc0 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -3849,10 +3849,46 @@ static int unpack_values(NT_PRINTER_DATA *printer_data, const uint8 *buf, int bu /**************************************************************************** ***************************************************************************/ +static char *last_from; +static char *last_to; + +static const char *get_last_from(void) +{ + if (!last_from) { + return ""; + } + return last_from; +} + +static const char *get_last_to(void) +{ + if (!last_to) { + return ""; + } + return last_to; +} + +static bool set_last_from_to(const char *from, const char *to) +{ + char *orig_from = last_from; + char *orig_to = last_to; + + last_from = SMB_STRDUP(from); + last_to = SMB_STRDUP(to); + + SAFE_FREE(orig_from); + SAFE_FREE(orig_to); + + if (!last_from || !last_to) { + SAFE_FREE(last_from); + SAFE_FREE(last_to); + return false; + } + return true; +} + static void map_to_os2_driver(fstring drivername) { - static bool initialised=False; - static fstring last_from,last_to; char *mapfile = lp_os2_driver_map(); char **lines = NULL; int numlines = 0; @@ -3864,14 +3900,10 @@ static void map_to_os2_driver(fstring drivername) if (!*mapfile) return; - if (!initialised) { - *last_from = *last_to = 0; - initialised = True; - } - - if (strequal(drivername,last_from)) { - DEBUG(3,("Mapped Windows driver %s to OS/2 driver %s\n",drivername,last_to)); - fstrcpy(drivername,last_to); + if (strequal(drivername,get_last_from())) { + DEBUG(3,("Mapped Windows driver %s to OS/2 driver %s\n", + drivername,get_last_to())); + fstrcpy(drivername,get_last_to()); return; } @@ -3920,8 +3952,7 @@ static void map_to_os2_driver(fstring drivername) if (strequal(nt_name,drivername)) { DEBUG(3,("Mapped windows driver %s to os2 driver%s\n",drivername,os2_name)); - fstrcpy(last_from,drivername); - fstrcpy(last_to,os2_name); + set_last_from_to(drivername,os2_name); fstrcpy(drivername,os2_name); file_lines_free(lines); return; -- cgit From 5eca35e0ca0537908f8e5068d36b0a5d744d937e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 11:08:27 +0100 Subject: Add cmd_wkssvc_enumeratecomputernames to rpcclient. Guenther (This used to be commit 289151393a43c7f0c2baafdd79d1163fc80aad6a) --- source3/rpcclient/cmd_wkssvc.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c index d136cd0d45..68f408cf48 100644 --- a/source3/rpcclient/cmd_wkssvc.c +++ b/source3/rpcclient/cmd_wkssvc.c @@ -124,11 +124,48 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli, return werr; } +static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, + const char **argv) +{ + const char *server_name; + enum wkssvc_ComputerNameType name_type = NetAllComputerNames; + NTSTATUS status; + struct wkssvc_ComputerNamesCtr *ctr = NULL; + WERROR werr; + + server_name = cli->cli->desthost; + + if (argc >= 2) { + name_type = atoi(argv[1]); + } + + status = rpccli_wkssvc_NetrEnumerateComputerNames(cli, mem_ctx, + server_name, + name_type, 0, + &ctr, + &werr); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + if (W_ERROR_IS_OK(werr)) { + int i=0; + for (i = 0; i < ctr->count; i++) { + printf("name: %d %s\n", i, ctr->computer_name->string); + } + } + + return werr; +} + struct cmd_set wkssvc_commands[] = { { "WKSSVC" }, { "wkssvc_wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, PI_WKSSVC, NULL, "Query WKSSVC Workstation Information", "" }, { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, PI_WKSSVC, NULL, "Query WKSSVC Join Information", "" }, { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, PI_WKSSVC, NULL, "Send WKSSVC message", "" }, + { "wkssvc_enumeratecomputernames", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_enumeratecomputernames, PI_WKSSVC, NULL, "Enumerate WKSSVC computer names", "" }, { NULL } }; -- cgit From d0cd32e2c8630faead556f0efa9e348ae67f3b4d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 10:58:58 +0100 Subject: Add and use some keystr functions using talloc_tos() in secrets api. Guenther (This used to be commit 6ccbf67a0c6f117978df55d4e2565d34fddf9317) --- source3/passdb/secrets.c | 167 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 123 insertions(+), 44 deletions(-) diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 0ea3887378..8e0afe7c32 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -132,14 +132,31 @@ bool secrets_delete(const char *key) return tdb_trans_delete(tdb, string_tdb_data(key)) == 0; } +/** + * Form a key for fetching the domain sid + * + * @param domain domain name + * + * @return keystring + **/ +static const char *domain_sid_keystr(const char *domain) +{ + char *keystr; + + keystr = talloc_asprintf(talloc_tos(), "%s/%s", + SECRETS_DOMAIN_SID, domain); + SMB_ASSERT(keystr != NULL); + + strupper_m(keystr); + + return keystr; +} + bool secrets_store_domain_sid(const char *domain, const DOM_SID *sid) { - fstring key; bool ret; - slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_SID, domain); - strupper_m(key); - ret = secrets_store(key, sid, sizeof(DOM_SID)); + ret = secrets_store(domain_sid_keystr(domain), sid, sizeof(DOM_SID)); /* Force a re-query, in case we modified our domain */ if (ret) @@ -150,12 +167,9 @@ bool secrets_store_domain_sid(const char *domain, const DOM_SID *sid) bool secrets_fetch_domain_sid(const char *domain, DOM_SID *sid) { DOM_SID *dyn_sid; - fstring key; size_t size = 0; - slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_SID, domain); - strupper_m(key); - dyn_sid = (DOM_SID *)secrets_fetch(key, &size); + dyn_sid = (DOM_SID *)secrets_fetch(domain_sid_keystr(domain), &size); if (dyn_sid == NULL) return False; @@ -213,6 +227,67 @@ bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid) return True; } +/** + * Form a key for fetching the machine trust account sec channel type + * + * @param domain domain name + * + * @return keystring + **/ +static const char *machine_sec_channel_type_keystr(const char *domain) +{ + char *keystr; + + keystr = talloc_asprintf(talloc_tos(), "%s/%s", + SECRETS_MACHINE_SEC_CHANNEL_TYPE, domain); + SMB_ASSERT(keystr != NULL); + + strupper_m(keystr); + + return keystr; +} + +/** + * Form a key for fetching the machine trust account last change time + * + * @param domain domain name + * + * @return keystring + **/ +static const char *machine_last_change_time_keystr(const char *domain) +{ + char *keystr; + + keystr = talloc_asprintf(talloc_tos(), "%s/%s", + SECRETS_MACHINE_LAST_CHANGE_TIME, domain); + SMB_ASSERT(keystr != NULL); + + strupper_m(keystr); + + return keystr; +} + + +/** + * Form a key for fetching the machine trust account password + * + * @param domain domain name + * + * @return keystring + **/ +static const char *machine_password_keystr(const char *domain) +{ + char *keystr; + + keystr = talloc_asprintf(talloc_tos(), "%s/%s", + SECRETS_MACHINE_PASSWORD, domain); + SMB_ASSERT(keystr != NULL); + + strupper_m(keystr); + + return keystr; +} + /** * Form a key for fetching the machine trust account password * @@ -632,6 +707,40 @@ bool secrets_store_trusted_domain_password(const char* domain, const char* pwd, return ret; } +/************************************************************************ + Routine to delete the plaintext machine account password +************************************************************************/ + +bool secrets_delete_machine_password(const char *domain) +{ + return secrets_delete(machine_password_keystr(domain)); +} + +/************************************************************************ + Routine to delete the plaintext machine account password, sec channel type and + last change time from secrets database +************************************************************************/ + +bool secrets_delete_machine_password_ex(const char *domain) +{ + if (!secrets_delete(machine_password_keystr(domain))) { + return false; + } + if (!secrets_delete(machine_sec_channel_type_keystr(domain))) { + return false; + } + return secrets_delete(machine_last_change_time_keystr(domain)); +} + +/************************************************************************ + Routine to delete the domain sid +************************************************************************/ + +bool secrets_delete_domain_sid(const char *domain) +{ + return secrets_delete(domain_sid_keystr(domain)); +} + /************************************************************************ Routine to set the plaintext machine account password for a realm the password is assumed to be a null terminated ascii string @@ -639,39 +748,19 @@ the password is assumed to be a null terminated ascii string bool secrets_store_machine_password(const char *pass, const char *domain, uint32 sec_channel) { - char *key = NULL; bool ret; uint32 last_change_time; uint32 sec_channel_type; - asprintf(&key, "%s/%s", SECRETS_MACHINE_PASSWORD, domain); - if (!key) - return False; - strupper_m(key); - - ret = secrets_store(key, pass, strlen(pass)+1); - SAFE_FREE(key); - + ret = secrets_store(machine_password_keystr(domain), pass, strlen(pass)+1); if (!ret) return ret; - asprintf(&key, "%s/%s", SECRETS_MACHINE_LAST_CHANGE_TIME, domain); - if (!key) - return False; - strupper_m(key); - SIVAL(&last_change_time, 0, time(NULL)); - ret = secrets_store(key, &last_change_time, sizeof(last_change_time)); - SAFE_FREE(key); - - asprintf(&key, "%s/%s", SECRETS_MACHINE_SEC_CHANNEL_TYPE, domain); - if (!key) - return False; - strupper_m(key); + ret = secrets_store(machine_last_change_time_keystr(domain), &last_change_time, sizeof(last_change_time)); SIVAL(&sec_channel_type, 0, sec_channel); - ret = secrets_store(key, &sec_channel_type, sizeof(sec_channel_type)); - SAFE_FREE(key); + ret = secrets_store(machine_sec_channel_type_keystr(domain), &sec_channel_type, sizeof(sec_channel_type)); return ret; } @@ -685,41 +774,31 @@ char *secrets_fetch_machine_password(const char *domain, time_t *pass_last_set_time, uint32 *channel) { - char *key = NULL; char *ret; - asprintf(&key, "%s/%s", SECRETS_MACHINE_PASSWORD, domain); - strupper_m(key); - ret = (char *)secrets_fetch(key, NULL); - SAFE_FREE(key); + ret = (char *)secrets_fetch(machine_password_keystr(domain), NULL); if (pass_last_set_time) { size_t size; uint32 *last_set_time; - asprintf(&key, "%s/%s", SECRETS_MACHINE_LAST_CHANGE_TIME, domain); - strupper_m(key); - last_set_time = (unsigned int *)secrets_fetch(key, &size); + last_set_time = (unsigned int *)secrets_fetch(machine_last_change_time_keystr(domain), &size); if (last_set_time) { *pass_last_set_time = IVAL(last_set_time,0); SAFE_FREE(last_set_time); } else { *pass_last_set_time = 0; } - SAFE_FREE(key); } if (channel) { size_t size; uint32 *channel_type; - asprintf(&key, "%s/%s", SECRETS_MACHINE_SEC_CHANNEL_TYPE, domain); - strupper_m(key); - channel_type = (unsigned int *)secrets_fetch(key, &size); + channel_type = (unsigned int *)secrets_fetch(machine_sec_channel_type_keystr(domain), &size); if (channel_type) { *channel = IVAL(channel_type,0); SAFE_FREE(channel_type); } else { *channel = get_default_sec_channel(); } - SAFE_FREE(key); } return ret; -- cgit From 713e1536fe4914e6df11cf10316d0b1c7c3685a3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 13:38:14 +0100 Subject: Merge WERR_NO_SUCH_LOGON_SESSION from Samba4. Guenther (This used to be commit 7b528647879bb55c9c85243a3e2906c09490edc9) --- source3/include/doserr.h | 1 + source3/libsmb/doserr.c | 1 + 2 files changed, 2 insertions(+) diff --git a/source3/include/doserr.h b/source3/include/doserr.h index a22eda2ab7..079a5664dd 100644 --- a/source3/include/doserr.h +++ b/source3/include/doserr.h @@ -204,6 +204,7 @@ #define WERR_SERVICE_NEVER_STARTED W_ERROR(1077) #define WERR_MACHINE_LOCKED W_ERROR(1271) #define WERR_NO_LOGON_SERVERS W_ERROR(1311) +#define WERR_NO_SUCH_LOGON_SESSION W_ERROR(1312) #define WERR_LOGON_FAILURE W_ERROR(1326) #define WERR_NO_SUCH_DOMAIN W_ERROR(1355) #define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338) diff --git a/source3/libsmb/doserr.c b/source3/libsmb/doserr.c index 84cc898187..5bdd85da1b 100644 --- a/source3/libsmb/doserr.c +++ b/source3/libsmb/doserr.c @@ -60,6 +60,7 @@ werror_code_struct dos_errs[] = { "WERR_DEST_NOT_FOUND", WERR_DEST_NOT_FOUND }, { "WERR_NOT_LOCAL_DOMAIN", WERR_NOT_LOCAL_DOMAIN }, { "WERR_NO_LOGON_SERVERS", WERR_NO_LOGON_SERVERS }, + { "WERR_NO_SUCH_LOGON_SESSION", WERR_NO_SUCH_LOGON_SESSION }, { "WERR_PRINTER_DRIVER_IN_USE", WERR_PRINTER_DRIVER_IN_USE }, { "WERR_STATUS_MORE_ENTRIES ", WERR_STATUS_MORE_ENTRIES }, { "WERR_DFS_NO_SUCH_VOL", WERR_DFS_NO_SUCH_VOL }, -- cgit From 712a28aaae6671be673f9b125cae59aec628d267 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Dec 2007 15:45:22 +0100 Subject: Rename cache.[ch] to memcache.[ch] cache.h conflicts with an XFS DMAPI include on "opi" :-( (This used to be commit b8db804e07cc19d406ba3892d6eecbe16132a89a) --- source3/include/cache.h | 51 -------- source3/include/includes.h | 2 +- source3/include/memcache.h | 51 ++++++++ source3/lib/cache.c | 298 --------------------------------------------- source3/lib/memcache.c | 298 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 350 insertions(+), 350 deletions(-) delete mode 100644 source3/include/cache.h create mode 100644 source3/include/memcache.h delete mode 100644 source3/lib/cache.c create mode 100644 source3/lib/memcache.c diff --git a/source3/include/cache.h b/source3/include/cache.h deleted file mode 100644 index 460a33b3a1..0000000000 --- a/source3/include/cache.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Unix SMB/CIFS implementation. - In-memory cache - Copyright (C) Volker Lendecke 2005-2007 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef __CACHE_H__ -#define __CACHE_H__ - -#include "includes.h" - -struct memcache; - -enum memcache_number { - STAT_CACHE, - UID_SID_CACHE, - SID_UID_CACHE, - GID_SID_CACHE, - SID_GID_CACHE, - GETWD_CACHE, - GETPWNAM_CACHE, - MANGLE_HASH2_CACHE -}; - -struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size); - -void memcache_add(struct memcache *cache, enum memcache_number n, - DATA_BLOB key, DATA_BLOB value); - -void memcache_delete(struct memcache *cache, enum memcache_number n, - DATA_BLOB key); - -bool memcache_lookup(struct memcache *cache, enum memcache_number n, - DATA_BLOB key, DATA_BLOB *value); - -void memcache_flush(struct memcache *cache, enum memcache_number n); - -#endif diff --git a/source3/include/includes.h b/source3/include/includes.h index a45176aba3..fdeff346e5 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -719,7 +719,7 @@ typedef char fstring[FSTRING_LEN]; #include "packet.h" #include "ctdbd_conn.h" #include "talloc_stack.h" -#include "cache.h" +#include "memcache.h" /* used in net.c */ struct functable { diff --git a/source3/include/memcache.h b/source3/include/memcache.h new file mode 100644 index 0000000000..f849f8ad3b --- /dev/null +++ b/source3/include/memcache.h @@ -0,0 +1,51 @@ +/* + Unix SMB/CIFS implementation. + In-memory cache + Copyright (C) Volker Lendecke 2005-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef __MEMCACHE_H__ +#define __MEMCACHE_H__ + +#include "includes.h" + +struct memcache; + +enum memcache_number { + STAT_CACHE, + UID_SID_CACHE, + SID_UID_CACHE, + GID_SID_CACHE, + SID_GID_CACHE, + GETWD_CACHE, + GETPWNAM_CACHE, + MANGLE_HASH2_CACHE +}; + +struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size); + +void memcache_add(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB value); + +void memcache_delete(struct memcache *cache, enum memcache_number n, + DATA_BLOB key); + +bool memcache_lookup(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB *value); + +void memcache_flush(struct memcache *cache, enum memcache_number n); + +#endif diff --git a/source3/lib/cache.c b/source3/lib/cache.c deleted file mode 100644 index baf2fe3984..0000000000 --- a/source3/lib/cache.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - Unix SMB/CIFS implementation. - In-memory cache - Copyright (C) Volker Lendecke 2007 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "cache.h" -#include "rbtree.h" - -struct memcache_element { - struct rb_node rb_node; - struct memcache_element *prev, *next; - size_t keylength, valuelength; - uint8 n; /* This is really an enum, but save memory */ - char data[1]; /* placeholder for offsetof */ -}; - -struct memcache { - struct memcache_element *mru, *lru; - struct rb_root tree; - size_t size; - size_t max_size; -}; - -static int memcache_destructor(struct memcache *cache) { - struct memcache_element *e, *next; - - for (e = cache->mru; e != NULL; e = next) { - next = e->next; - SAFE_FREE(e); - } - return 0; -} - -struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size) -{ - struct memcache *result; - - result = TALLOC_ZERO_P(mem_ctx, struct memcache); - if (result == NULL) { - return NULL; - } - result->max_size = max_size; - talloc_set_destructor(result, memcache_destructor); - return result; -} - -static struct memcache_element *memcache_node2elem(struct rb_node *node) -{ - return (struct memcache_element *) - ((char *)node - offsetof(struct memcache_element, rb_node)); -} - -static void memcache_element_parse(struct memcache_element *e, - DATA_BLOB *key, DATA_BLOB *value) -{ - key->data = ((uint8 *)e) + offsetof(struct memcache_element, data); - key->length = e->keylength; - value->data = key->data + e->keylength; - value->length = e->valuelength; -} - -static size_t memcache_element_size(size_t key_length, size_t value_length) -{ - return sizeof(struct memcache_element) - 1 + key_length + value_length; -} - -static int memcache_compare(struct memcache_element *e, enum memcache_number n, - DATA_BLOB key) -{ - DATA_BLOB this_key, this_value; - - if ((int)e->n < (int)n) return -1; - if ((int)e->n > (int)n) return 1; - - if (e->keylength < key.length) return -1; - if (e->keylength > key.length) return 1; - - memcache_element_parse(e, &this_key, &this_value); - return memcmp(this_key.data, key.data, key.length); -} - -static struct memcache_element *memcache_find( - struct memcache *cache, enum memcache_number n, DATA_BLOB key) -{ - struct rb_node *node; - - node = cache->tree.rb_node; - - while (node != NULL) { - struct memcache_element *elem = memcache_node2elem(node); - int cmp; - - cmp = memcache_compare(elem, n, key); - if (cmp == 0) { - return elem; - } - node = (cmp < 0) ? node->rb_left : node->rb_right; - } - - return NULL; -} - -bool memcache_lookup(struct memcache *cache, enum memcache_number n, - DATA_BLOB key, DATA_BLOB *value) -{ - struct memcache_element *e; - - e = memcache_find(cache, n, key); - if (e == NULL) { - return false; - } - - if (cache->size != 0) { - /* - * Do LRU promotion only when we will ever shrink - */ - if (e == cache->lru) { - cache->lru = e->prev; - } - DLIST_PROMOTE(cache->mru, e); - if (cache->mru == NULL) { - cache->mru = e; - } - } - - memcache_element_parse(e, &key, value); - return true; -} - -static void memcache_delete_element(struct memcache *cache, - struct memcache_element *e) -{ - rb_erase(&e->rb_node, &cache->tree); - - if (e == cache->lru) { - cache->lru = e->prev; - } - DLIST_REMOVE(cache->mru, e); - - cache->size -= memcache_element_size(e->keylength, e->valuelength); - - SAFE_FREE(e); -} - -static void memcache_trim(struct memcache *cache) -{ - if (cache->max_size == 0) { - return; - } - - while ((cache->size > cache->max_size) && (cache->lru != NULL)) { - memcache_delete_element(cache, cache->lru); - } -} - -void memcache_delete(struct memcache *cache, enum memcache_number n, - DATA_BLOB key) -{ - struct memcache_element *e; - - e = memcache_find(cache, n, key); - if (e == NULL) { - return; - } - - memcache_delete_element(cache, e); -} - -void memcache_add(struct memcache *cache, enum memcache_number n, - DATA_BLOB key, DATA_BLOB value) -{ - struct memcache_element *e; - struct rb_node **p; - struct rb_node *parent; - DATA_BLOB cache_key, cache_value; - size_t element_size; - - if (key.length == 0) { - return; - } - - e = memcache_find(cache, n, key); - - if (e != NULL) { - memcache_element_parse(e, &cache_key, &cache_value); - - if (value.length <= cache_value.length) { - /* - * We can reuse the existing record - */ - memcpy(cache_value.data, value.data, value.length); - e->valuelength = value.length; - return; - } - - memcache_delete_element(cache, e); - } - - element_size = memcache_element_size(key.length, value.length); - - - e = (struct memcache_element *)SMB_MALLOC(element_size); - - if (e == NULL) { - DEBUG(0, ("malloc failed\n")); - return; - } - - e->n = n; - e->keylength = key.length; - e->valuelength = value.length; - - memcache_element_parse(e, &cache_key, &cache_value); - memcpy(cache_key.data, key.data, key.length); - memcpy(cache_value.data, value.data, value.length); - - parent = NULL; - p = &cache->tree.rb_node; - - while (*p) { - struct memcache_element *elem = memcache_node2elem(*p); - int cmp; - - parent = (*p); - - cmp = memcache_compare(elem, n, key); - - p = (cmp < 0) ? &(*p)->rb_left : &(*p)->rb_right; - } - - rb_link_node(&e->rb_node, parent, p); - rb_insert_color(&e->rb_node, &cache->tree); - - DLIST_ADD(cache->mru, e); - if (cache->lru == NULL) { - cache->lru = e; - } - - cache->size += element_size; - memcache_trim(cache); -} - -void memcache_flush(struct memcache *cache, enum memcache_number n) -{ - struct rb_node *node; - - /* - * Find the smallest element of number n - */ - - node = cache->tree.rb_node; - if (node == NULL) { - return; - } - - while (true) { - struct memcache_element *elem = memcache_node2elem(node); - struct rb_node *next; - - if ((int)elem->n < (int)n) { - next = node->rb_right; - } - else { - next = node->rb_left; - } - if (next == NULL) { - break; - } - node = next; - } - - node = rb_next(node); - if (node == NULL) { - return; - } - - while (node != NULL) { - struct memcache_element *e = memcache_node2elem(node); - struct rb_node *next = rb_next(node); - - memcache_delete_element(cache, e); - node = next; - } -} diff --git a/source3/lib/memcache.c b/source3/lib/memcache.c new file mode 100644 index 0000000000..17630066ae --- /dev/null +++ b/source3/lib/memcache.c @@ -0,0 +1,298 @@ +/* + Unix SMB/CIFS implementation. + In-memory cache + Copyright (C) Volker Lendecke 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "memcache.h" +#include "rbtree.h" + +struct memcache_element { + struct rb_node rb_node; + struct memcache_element *prev, *next; + size_t keylength, valuelength; + uint8 n; /* This is really an enum, but save memory */ + char data[1]; /* placeholder for offsetof */ +}; + +struct memcache { + struct memcache_element *mru, *lru; + struct rb_root tree; + size_t size; + size_t max_size; +}; + +static int memcache_destructor(struct memcache *cache) { + struct memcache_element *e, *next; + + for (e = cache->mru; e != NULL; e = next) { + next = e->next; + SAFE_FREE(e); + } + return 0; +} + +struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size) +{ + struct memcache *result; + + result = TALLOC_ZERO_P(mem_ctx, struct memcache); + if (result == NULL) { + return NULL; + } + result->max_size = max_size; + talloc_set_destructor(result, memcache_destructor); + return result; +} + +static struct memcache_element *memcache_node2elem(struct rb_node *node) +{ + return (struct memcache_element *) + ((char *)node - offsetof(struct memcache_element, rb_node)); +} + +static void memcache_element_parse(struct memcache_element *e, + DATA_BLOB *key, DATA_BLOB *value) +{ + key->data = ((uint8 *)e) + offsetof(struct memcache_element, data); + key->length = e->keylength; + value->data = key->data + e->keylength; + value->length = e->valuelength; +} + +static size_t memcache_element_size(size_t key_length, size_t value_length) +{ + return sizeof(struct memcache_element) - 1 + key_length + value_length; +} + +static int memcache_compare(struct memcache_element *e, enum memcache_number n, + DATA_BLOB key) +{ + DATA_BLOB this_key, this_value; + + if ((int)e->n < (int)n) return -1; + if ((int)e->n > (int)n) return 1; + + if (e->keylength < key.length) return -1; + if (e->keylength > key.length) return 1; + + memcache_element_parse(e, &this_key, &this_value); + return memcmp(this_key.data, key.data, key.length); +} + +static struct memcache_element *memcache_find( + struct memcache *cache, enum memcache_number n, DATA_BLOB key) +{ + struct rb_node *node; + + node = cache->tree.rb_node; + + while (node != NULL) { + struct memcache_element *elem = memcache_node2elem(node); + int cmp; + + cmp = memcache_compare(elem, n, key); + if (cmp == 0) { + return elem; + } + node = (cmp < 0) ? node->rb_left : node->rb_right; + } + + return NULL; +} + +bool memcache_lookup(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB *value) +{ + struct memcache_element *e; + + e = memcache_find(cache, n, key); + if (e == NULL) { + return false; + } + + if (cache->size != 0) { + /* + * Do LRU promotion only when we will ever shrink + */ + if (e == cache->lru) { + cache->lru = e->prev; + } + DLIST_PROMOTE(cache->mru, e); + if (cache->mru == NULL) { + cache->mru = e; + } + } + + memcache_element_parse(e, &key, value); + return true; +} + +static void memcache_delete_element(struct memcache *cache, + struct memcache_element *e) +{ + rb_erase(&e->rb_node, &cache->tree); + + if (e == cache->lru) { + cache->lru = e->prev; + } + DLIST_REMOVE(cache->mru, e); + + cache->size -= memcache_element_size(e->keylength, e->valuelength); + + SAFE_FREE(e); +} + +static void memcache_trim(struct memcache *cache) +{ + if (cache->max_size == 0) { + return; + } + + while ((cache->size > cache->max_size) && (cache->lru != NULL)) { + memcache_delete_element(cache, cache->lru); + } +} + +void memcache_delete(struct memcache *cache, enum memcache_number n, + DATA_BLOB key) +{ + struct memcache_element *e; + + e = memcache_find(cache, n, key); + if (e == NULL) { + return; + } + + memcache_delete_element(cache, e); +} + +void memcache_add(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB value) +{ + struct memcache_element *e; + struct rb_node **p; + struct rb_node *parent; + DATA_BLOB cache_key, cache_value; + size_t element_size; + + if (key.length == 0) { + return; + } + + e = memcache_find(cache, n, key); + + if (e != NULL) { + memcache_element_parse(e, &cache_key, &cache_value); + + if (value.length <= cache_value.length) { + /* + * We can reuse the existing record + */ + memcpy(cache_value.data, value.data, value.length); + e->valuelength = value.length; + return; + } + + memcache_delete_element(cache, e); + } + + element_size = memcache_element_size(key.length, value.length); + + + e = (struct memcache_element *)SMB_MALLOC(element_size); + + if (e == NULL) { + DEBUG(0, ("malloc failed\n")); + return; + } + + e->n = n; + e->keylength = key.length; + e->valuelength = value.length; + + memcache_element_parse(e, &cache_key, &cache_value); + memcpy(cache_key.data, key.data, key.length); + memcpy(cache_value.data, value.data, value.length); + + parent = NULL; + p = &cache->tree.rb_node; + + while (*p) { + struct memcache_element *elem = memcache_node2elem(*p); + int cmp; + + parent = (*p); + + cmp = memcache_compare(elem, n, key); + + p = (cmp < 0) ? &(*p)->rb_left : &(*p)->rb_right; + } + + rb_link_node(&e->rb_node, parent, p); + rb_insert_color(&e->rb_node, &cache->tree); + + DLIST_ADD(cache->mru, e); + if (cache->lru == NULL) { + cache->lru = e; + } + + cache->size += element_size; + memcache_trim(cache); +} + +void memcache_flush(struct memcache *cache, enum memcache_number n) +{ + struct rb_node *node; + + /* + * Find the smallest element of number n + */ + + node = cache->tree.rb_node; + if (node == NULL) { + return; + } + + while (true) { + struct memcache_element *elem = memcache_node2elem(node); + struct rb_node *next; + + if ((int)elem->n < (int)n) { + next = node->rb_right; + } + else { + next = node->rb_left; + } + if (next == NULL) { + break; + } + node = next; + } + + node = rb_next(node); + if (node == NULL) { + return; + } + + while (node != NULL) { + struct memcache_element *e = memcache_node2elem(node); + struct rb_node *next = rb_next(node); + + memcache_delete_element(cache, e); + node = next; + } +} -- cgit From cd893dd365dfe9cb49e91f4dc4a8d35533e918c2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Dec 2007 16:30:01 +0100 Subject: Today is not my day... dmapi.c certainly did compile now... (This used to be commit 93f3a1172af2f1a20f0c4c26ec8be999546d95f8) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 81c8330216..599b0501a1 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -284,7 +284,7 @@ TALLOC_OBJ = lib/talloc/talloc.o LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(NSS_WRAPPER_OBJ) $(TALLOC_OBJ) \ lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \ lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \ - lib/interfaces.o lib/rbtree.o lib/cache.o + lib/interfaces.o lib/rbtree.o lib/memcache.o LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/interface.o lib/md4.o \ -- cgit From 2197801ef1d9a942c8f8ec8b8e81b9f25cffc02f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Dec 2007 16:48:04 +0100 Subject: Zero the tdb key, there might be padding This leads to uninitialized variable warnings if nmbd is run under valgrind. (This used to be commit 9ec4f91f35696e5a00e24fe9ae2dd06119482c80) --- source3/libsmb/unexpected.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/libsmb/unexpected.c b/source3/libsmb/unexpected.c index 92a609c42b..195668c44a 100644 --- a/source3/libsmb/unexpected.c +++ b/source3/libsmb/unexpected.c @@ -63,6 +63,8 @@ void unexpected_packet(struct packet_struct *p) len = build_packet(&buf[6], sizeof(buf)-6, p) + 6; + ZERO_STRUCT(key); /* needed for potential alignment */ + key.packet_type = p->packet_type; key.timestamp = p->timestamp; key.count = count++; -- cgit From 0743d384a634ad9c124673f52b9c2d17aab1ac89 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Dec 2007 16:48:18 +0100 Subject: Some paranoia checks (This used to be commit ff644cfa1b123e9d0f8f4817504e5b209b85dedd) --- source3/libsmb/unexpected.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/libsmb/unexpected.c b/source3/libsmb/unexpected.c index 195668c44a..5fbc33cdf5 100644 --- a/source3/libsmb/unexpected.c +++ b/source3/libsmb/unexpected.c @@ -88,6 +88,10 @@ static int traverse_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *st { struct unexpected_key key; + if (kbuf.dsize != sizeof(key)) { + tdb_delete(ttdb, kbuf); + } + memcpy(&key, kbuf.dptr, sizeof(key)); if (lastt - key.timestamp > NMBD_UNEXPECTED_TIMEOUT) { @@ -136,6 +140,10 @@ static int traverse_match(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, int port; struct packet_struct *p; + if (kbuf.dsize != sizeof(key)) { + return 0; + } + memcpy(&key, kbuf.dptr, sizeof(key)); if (key.packet_type != state->match_type) return 0; -- cgit From a37873490f2c4e89e98780203d13e2f21a6ecebf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Dec 2007 17:05:26 +0100 Subject: packet_struct is used in several places as raw memory -> Fix more uninitialized variable warnings (This used to be commit 0af02db6f2f84a8ce5d614e5baec27f20b413c26) --- source3/libsmb/nmblib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index 2ff925ef36..15a9a93ff2 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -740,6 +740,8 @@ struct packet_struct *parse_packet(char *buf,int length, if (!p) return(NULL); + ZERO_STRUCTP(p); /* initialize for possible padding */ + p->next = NULL; p->prev = NULL; p->ip = ip; -- cgit From 873b6f0f21e61be6e4f7084fc0ded768dfa077ab Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Dec 2007 13:48:49 +0100 Subject: Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-716-g12cce3b On Tue, Dec 18, 2007 at 06:04:32PM -0600, Jeremy Allison wrote: > Fix valgrind error in dbwrap_rbt where rec_priv->node was > being accessed after free. VALOKER PLEASE CHECK THIS VERY > CAREFULLY !!!! This is a correct fix in that it fixes the > valgrind error, but it looks inelegant to me. I think if > I understood this code better I could craft a more subtle > fix. Still looking at it.... Thanks a lot. Fully correct. What about the attached little simplification? Volker (This used to be commit 5b72828600fb057a7aeb5f1a6fb6c23c23f28cd8) --- source3/lib/dbwrap_rbt.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/source3/lib/dbwrap_rbt.c b/source3/lib/dbwrap_rbt.c index 468b9405ee..93d73f29d1 100644 --- a/source3/lib/dbwrap_rbt.c +++ b/source3/lib/dbwrap_rbt.c @@ -68,8 +68,6 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) TDB_DATA this_key, this_val; - bool del_old_keyval = false; - if (rec_priv->node != NULL) { /* @@ -97,7 +95,11 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) */ rb_erase(&rec_priv->node->rb_node, &rec_priv->db_ctx->tree); - del_old_keyval = true; + + /* + * Keep the existing node around for a while: If the record + * existed before, we reference the key data in there. + */ } node = (struct db_rbt_node *)SMB_MALLOC( @@ -105,9 +107,7 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) + data.dsize); if (node == NULL) { - if (del_old_keyval) { - SAFE_FREE(rec_priv->node); - } + SAFE_FREE(rec_priv->node); return NT_STATUS_NO_MEMORY; } @@ -119,11 +119,9 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) db_rbt_parse_node(node, &this_key, &this_val); memcpy(this_key.dptr, rec->key.dptr, node->keysize); - memcpy(this_val.dptr, data.dptr, node->valuesize); + SAFE_FREE(rec_priv->node); - if (del_old_keyval) { - SAFE_FREE(rec_priv->node); - } + memcpy(this_val.dptr, data.dptr, node->valuesize); parent = NULL; p = &rec_priv->db_ctx->tree.rb_node; -- cgit From 5f1d36ce9abdb33ebb4f21c66c0885ea70097f6f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Dec 2007 20:24:33 +0100 Subject: Fix debug messages When warning that "client plaintext auth" is not enabled where the server requested them we should not talk about "client use plaintext auth" (This used to be commit 7799e18994354b2705ee8c64ae8c75e062ace460) --- source3/libsmb/cliconnect.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 52ff69953e..d370808bba 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -959,8 +959,8 @@ NTSTATUS cli_session_setup(struct cli_state *cli, if ((cli->sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) == 0 && !lp_client_plaintext_auth() && (*pass)) { - DEBUG(1, ("Server requested plaintext password but 'client use plaintext auth'" - " is disabled\n")); + DEBUG(1, ("Server requested plaintext password but " + "'client plaintext auth' is disabled\n")); return NT_STATUS_ACCESS_DENIED; } @@ -986,8 +986,8 @@ NTSTATUS cli_session_setup(struct cli_state *cli, if ((cli->sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) == 0) { if (!lp_client_plaintext_auth() && (*pass)) { - DEBUG(1, ("Server requested plaintext password but 'client use plaintext auth'" - " is disabled\n")); + DEBUG(1, ("Server requested plaintext password but " + "'client plaintext auth' is disabled\n")); return NT_STATUS_ACCESS_DENIED; } return cli_session_setup_plaintext(cli, user, pass, workgroup); @@ -1086,8 +1086,9 @@ bool cli_send_tconX(struct cli_state *cli, } else { if((cli->sec_mode & (NEGOTIATE_SECURITY_USER_LEVEL|NEGOTIATE_SECURITY_CHALLENGE_RESPONSE)) == 0) { if (!lp_client_plaintext_auth() && (*pass)) { - DEBUG(1, ("Server requested plaintext password but 'client use plaintext auth'" - " is disabled\n")); + DEBUG(1, ("Server requested plaintext " + "password but 'client plaintext " + "auth' is disabled\n")); return False; } @@ -1798,8 +1799,8 @@ NTSTATUS cli_raw_tcon(struct cli_state *cli, char *p; if (!lp_client_plaintext_auth() && (*pass)) { - DEBUG(1, ("Server requested plaintext password but 'client use plaintext auth'" - " is disabled\n")); + DEBUG(1, ("Server requested plaintext password but 'client " + "plaintext auth' is disabled\n")); return NT_STATUS_ACCESS_DENIED; } -- cgit From 042201bcc1b7ffc88cdc22b64c70c653b2433703 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Dec 2007 20:27:47 +0100 Subject: Fix a "no prototype" warning (This used to be commit e5bd32812dd1e864e51c2199fd90d71813517f68) --- source3/client/dnsbrowse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/client/dnsbrowse.c b/source3/client/dnsbrowse.c index c4819cebfa..5e3a4de9cf 100644 --- a/source3/client/dnsbrowse.c +++ b/source3/client/dnsbrowse.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "client/client_proto.h" #ifdef WITH_DNSSD_SUPPORT -- cgit From e518e19bc0000019f131354f55e9f5b55f6a2c5e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 19 Dec 2007 15:02:59 +0100 Subject: Remove Get_Pwnam and its associated static variable All callers are replaced by Get_Pwnam_alloc (This used to be commit 735f59315497113aebadcf9ad387e3dbfffa284a) --- source3/auth/auth_unix.c | 3 ++- source3/lib/substitute.c | 26 +++++++++++++-------- source3/lib/username.c | 49 ++++++++-------------------------------- source3/param/loadparm.c | 6 ++++- source3/passdb/pdb_interface.c | 3 ++- source3/rpc_server/srv_samr_nt.c | 8 +++++-- source3/smbd/chgpasswd.c | 6 ++++- source3/smbd/map_username.c | 2 +- source3/smbd/password.c | 5 +++- source3/smbd/service.c | 11 ++++++--- source3/utils/net_rpc_samsync.c | 4 ++-- source3/winbindd/idmap_nss.c | 10 ++++---- 12 files changed, 67 insertions(+), 66 deletions(-) diff --git a/source3/auth/auth_unix.c b/source3/auth/auth_unix.c index 4fca5bcbe4..58c765226d 100644 --- a/source3/auth/auth_unix.c +++ b/source3/auth/auth_unix.c @@ -92,7 +92,7 @@ static NTSTATUS check_unix_security(const struct auth_context *auth_context, struct passwd *pass = NULL; become_root(); - pass = Get_Pwnam(user_info->internal_username); + pass = Get_Pwnam_alloc(talloc_tos(), user_info->internal_username); /** @todo This call assumes a ASCII password, no charset transformation is @@ -123,6 +123,7 @@ static NTSTATUS check_unix_security(const struct auth_context *auth_context, } } + TALLOC_FREE(pass); return nt_status; } diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index e06917c8fb..80feee9579 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -408,7 +408,7 @@ static const char *automount_path(const char *user_name) /* use the passwd entry as the default */ /* this will be the default if WITH_AUTOMOUNT is not used or fails */ - server_path = talloc_strdup(ctx, get_user_home_dir(user_name)); + server_path = talloc_strdup(ctx, get_user_home_dir(ctx, user_name)); if (!server_path) { return ""; } @@ -541,7 +541,6 @@ char *alloc_sub_basic(const char *smb_name, const char *domain_name, { char *b, *p, *s, *r, *a_string; fstring pidstr, vnnstr; - struct passwd *pass; char addr[INET6_ADDRSTRLEN]; const char *local_machine_name = get_local_machine_name(); @@ -571,15 +570,21 @@ char *alloc_sub_basic(const char *smb_name, const char *domain_name, } a_string = realloc_string_sub(a_string, "%U", r); break; - case 'G' : + case 'G' : { + struct passwd *pass; r = SMB_STRDUP(smb_name); if (r == NULL) { goto error; } - if ((pass = Get_Pwnam(r))!=NULL) { - a_string = realloc_string_sub(a_string, "%G", gidtoname(pass->pw_gid)); - } + pass = Get_Pwnam_alloc(talloc_tos(), r); + if (pass != NULL) { + a_string = realloc_string_sub( + a_string, "%G", + gidtoname(pass->pw_gid)); + } + TALLOC_FREE(pass); break; + } case 'D' : r = strdup_upper(domain_name); if (r == NULL) { @@ -766,7 +771,7 @@ static char *alloc_sub_advanced(const char *servicename, const char *user, const char *str) { char *a_string, *ret_string; - char *b, *p, *s, *h; + char *b, *p, *s; a_string = SMB_STRDUP(str); if (a_string == NULL) { @@ -782,10 +787,13 @@ static char *alloc_sub_advanced(const char *servicename, const char *user, case 'N' : a_string = realloc_string_sub(a_string, "%N", automount_server(user)); break; - case 'H': - if ((h = get_user_home_dir(user))) + case 'H': { + char *h; + if ((h = get_user_home_dir(talloc_tos(), user))) a_string = realloc_string_sub(a_string, "%H", h); + TALLOC_FREE(h); break; + } case 'P': a_string = realloc_string_sub(a_string, "%P", connectpath); break; diff --git a/source3/lib/username.c b/source3/lib/username.c index 21eed9f5fc..3087bac0f4 100644 --- a/source3/lib/username.c +++ b/source3/lib/username.c @@ -32,19 +32,24 @@ static struct passwd *uname_string_combinations2(char *s, TALLOC_CTX *mem_ctx, i Get a users home directory. ****************************************************************************/ -char *get_user_home_dir(const char *user) +char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user) { - static struct passwd *pass; + struct passwd *pass; + char *result; /* Ensure the user exists. */ - pass = Get_Pwnam(user); + pass = Get_Pwnam_alloc(mem_ctx, user); if (!pass) return(NULL); + /* Return home directory from struct passwd. */ - return(pass->pw_dir); + result = talloc_move(mem_ctx, &pass->pw_dir); + + TALLOC_FREE(pass); + return result; } /**************************************************************************** @@ -55,8 +60,6 @@ char *get_user_home_dir(const char *user) * - using lp_usernamelevel() for permutations. ****************************************************************************/ -static struct passwd *Get_Pwnam_ret = NULL; - static struct passwd *Get_Pwnam_internals(TALLOC_CTX *mem_ctx, const char *user, char *user2) { @@ -134,40 +137,6 @@ struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user) return ret; } -/**************************************************************************** - Get_Pwnam wrapper without modification. - NOTE: This with NOT modify 'user'! -****************************************************************************/ - -struct passwd *Get_Pwnam(const char *user) -{ - struct passwd *ret; - - ret = Get_Pwnam_alloc(NULL, user); - - /* This call used to just return the 'passwd' static buffer. - This could then have accidental reuse implications, so - we now malloc a copy, and free it in the next use. - - This should cause the (ab)user to segfault if it - uses an old struct. - - This is better than useing the wrong data in security - critical operations. - - The real fix is to make the callers free the returned - malloc'ed data. - */ - - if (Get_Pwnam_ret) { - TALLOC_FREE(Get_Pwnam_ret); - } - - Get_Pwnam_ret = ret; - - return ret; -} - /* The functions below have been taken from password.c and slightly modified */ /**************************************************************************** Apply a function to upper/lower case combinations diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index eea3ecec2b..4eb8a1ce65 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4702,13 +4702,17 @@ static void lp_add_auto_services(char *str) homes = lp_servicenumber(HOMES_NAME); for (p = strtok(s, LIST_SEP); p; p = strtok(NULL, LIST_SEP)) { - char *home = get_user_home_dir(p); + char *home; if (lp_servicenumber(p) >= 0) continue; + home = get_user_home_dir(talloc_tos(), p); + if (home && homes >= 0) lp_add_home(p, homes, p, home); + + TALLOC_FREE(home); } SAFE_FREE(s); } diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index ed6a91cb2b..198960550b 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -1570,11 +1570,12 @@ static bool lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32 rid, return True; } - pw = Get_Pwnam(*name); + pw = Get_Pwnam_alloc(talloc_tos(), *name); if (pw == NULL) { return False; } unix_id->uid = pw->pw_uid; + TALLOC_FREE(pw); return True; } TALLOC_FREE(sam_account); diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index cc4b4f330f..1d69cb320e 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -3325,7 +3325,8 @@ static NTSTATUS set_user_info_23(TALLOC_CTX *mem_ctx, SAM_USER_INFO_23 *id23, return NT_STATUS_ACCESS_DENIED; } - if ((passwd = Get_Pwnam(pdb_get_username(pwd))) == NULL) { + passwd = Get_Pwnam_alloc(pwd, pdb_get_username(pwd)); + if (passwd == NULL) { DEBUG(1, ("chgpasswd: Username does not exist in system !?!\n")); } @@ -3333,6 +3334,7 @@ static NTSTATUS set_user_info_23(TALLOC_CTX *mem_ctx, SAM_USER_INFO_23 *id23, TALLOC_FREE(pwd); return NT_STATUS_ACCESS_DENIED; } + TALLOC_FREE(passwd); } } @@ -3406,7 +3408,8 @@ static bool set_user_info_pw(uint8 *pass, struct samu *pwd) return False; } - if ((passwd = Get_Pwnam(pdb_get_username(pwd))) == NULL) { + passwd = Get_Pwnam_alloc(pwd, pdb_get_username(pwd)); + if (passwd == NULL) { DEBUG(1, ("chgpasswd: Username does not exist in system !?!\n")); } @@ -3414,6 +3417,7 @@ static bool set_user_info_pw(uint8 *pass, struct samu *pwd) TALLOC_FREE(pwd); return False; } + TALLOC_FREE(passwd); } } diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index e478122e9b..fb228f9e2a 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -1142,7 +1142,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw return NT_STATUS_PASSWORD_RESTRICTION; } - pass = Get_Pwnam(username); + pass = Get_Pwnam_alloc(talloc_tos(), username); if (!pass) { DEBUG(1, ("change_oem_password: Username %s does not exist in system !?!\n", username)); return NT_STATUS_ACCESS_DENIED; @@ -1160,6 +1160,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw if (samr_reject_reason) { *samr_reject_reason = REJECT_REASON_NOT_COMPLEX; } + TALLOC_FREE(pass); return NT_STATUS_PASSWORD_RESTRICTION; } } @@ -1178,9 +1179,12 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw if(lp_unix_password_sync() && !chgpasswd(username, pass, old_passwd, new_passwd, as_root)) { + TALLOC_FREE(pass); return NT_STATUS_ACCESS_DENIED; } + TALLOC_FREE(pass); + if (!pdb_set_plaintext_passwd (hnd, new_passwd)) { return NT_STATUS_ACCESS_DENIED; } diff --git a/source3/smbd/map_username.c b/source3/smbd/map_username.c index bde755eff6..7290f70547 100644 --- a/source3/smbd/map_username.c +++ b/source3/smbd/map_username.c @@ -28,7 +28,7 @@ any incoming or new username - in order to canonicalize the name. This is being done to de-couple the case conversions from the user mapping function. Previously, the map_username was being called - every time Get_Pwnam was called. + every time Get_Pwnam_alloc was called. Returns True if username was changed, false otherwise. ********************************************************************/ diff --git a/source3/smbd/password.c b/source3/smbd/password.c index b3005ba082..6b517c3d86 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -837,9 +837,11 @@ bool authorise_login(int snum, fstring user, DATA_BLOB password, /* check for a normal guest connection */ if (!ok && GUEST_OK(snum)) { + struct passwd *guest_pw; fstring guestname; fstrcpy(guestname,lp_guestaccount()); - if (Get_Pwnam(guestname)) { + guest_pw = Get_Pwnam_alloc(talloc_tos(), guestname); + if (guest_pw != NULL) { fstrcpy(user,guestname); ok = True; DEBUG(3,("authorise_login: ACCEPTED: guest account " @@ -848,6 +850,7 @@ bool authorise_login(int snum, fstring user, DATA_BLOB password, DEBUG(0,("authorise_login: Invalid guest account " "%s??\n",guestname)); } + TALLOC_FREE(guest_pw); *guest = True; } diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 88ab9f0048..ed43528c76 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -357,6 +357,7 @@ void load_registry_shares(void) int find_service(fstring service) { int iService; + TALLOC_CTX *frame = talloc_stackframe(); all_string_sub(service,"\\","/",0); @@ -364,7 +365,7 @@ int find_service(fstring service) /* now handle the special case of a home directory */ if (iService < 0) { - char *phome_dir = get_user_home_dir(service); + char *phome_dir = get_user_home_dir(talloc_tos(), service); if(!phome_dir) { /* @@ -372,7 +373,8 @@ int find_service(fstring service) * be a Windows to unix mapped user name. */ if(map_username(service)) - phome_dir = get_user_home_dir(service); + phome_dir = get_user_home_dir( + talloc_tos(), service); } DEBUG(3,("checking for home directory %s gave %s\n",service, @@ -461,6 +463,8 @@ int find_service(fstring service) if (iService < 0) DEBUG(3,("find_service() failed to find service %s\n", service)); + TALLOC_FREE(frame); + return (iService); } @@ -744,11 +748,12 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, *status = NT_STATUS_WRONG_PASSWORD; return NULL; } - pass = Get_Pwnam(user); + pass = Get_Pwnam_alloc(talloc_tos(), user); status2 = create_token_from_username(conn->mem_ctx, pass->pw_name, True, &conn->uid, &conn->gid, &found_username, &conn->nt_user_token); + TALLOC_FREE(pass); if (!NT_STATUS_IS_OK(status2)) { conn_free(conn); *status = status2; diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c index ca3279ee3a..779006884d 100644 --- a/source3/utils/net_rpc_samsync.c +++ b/source3/utils/net_rpc_samsync.c @@ -486,7 +486,7 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta) return NT_STATUS_NO_MEMORY; } - if (!(passwd = Get_Pwnam(account))) { + if (!(passwd = Get_Pwnam_alloc(sam_account, account))) { /* Create appropriate user */ if (delta->acb_info & ACB_NORMAL) { add_script = talloc_strdup(sam_account, @@ -525,7 +525,7 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta) } /* try and find the possible unix account again */ - if ( !(passwd = Get_Pwnam(account)) ) { + if ( !(passwd = Get_Pwnam_alloc(sam_account, account)) ) { d_fprintf(stderr, "Could not create posix account info for '%s'\n", account); nt_ret = NT_STATUS_NO_SUCH_USER; goto done; diff --git a/source3/winbindd/idmap_nss.c b/source3/winbindd/idmap_nss.c index fa9f2c9681..46c24d7fcb 100644 --- a/source3/winbindd/idmap_nss.c +++ b/source3/winbindd/idmap_nss.c @@ -145,7 +145,6 @@ static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_ma } for (i = 0; ids[i]; i++) { - struct passwd *pw; struct group *gr; enum lsa_SidType type; const char *dom_name = NULL; @@ -166,17 +165,20 @@ static NTSTATUS idmap_nss_sids_to_unixids(struct idmap_domain *dom, struct id_ma } switch (type) { - case SID_NAME_USER: + case SID_NAME_USER: { + struct passwd *pw; /* this will find also all lower case name and use username level */ - - pw = Get_Pwnam(name); + + pw = Get_Pwnam_alloc(talloc_tos(), name); if (pw) { ids[i]->xid.id = pw->pw_uid; ids[i]->xid.type = ID_TYPE_UID; ids[i]->status = ID_MAPPED; } + TALLOC_FREE(pw); break; + } case SID_NAME_DOM_GRP: case SID_NAME_ALIAS: -- cgit From bb89f8cb94802bb2f9b43c1c63fd55ee2de9b09e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 28 Oct 2007 01:14:51 +0200 Subject: Change apply_default_perms() to not take an fsp. This is a first change in a series: Pass what is needed instead of files_struct pointers to some functions. This is in preparation of introducing two variants of get_nt_acl - one for fname (which does not need an fsp), one for file descriptor. This changes apply_default_perms to take share_params (rather thatn snum) and an is_directory flag instead of an fsp. Michael (This used to be commit d7e2e93758f6598a0459db3255300558618f066e) --- source3/smbd/posix_acls.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index ccfed69721..ca83d85399 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -999,20 +999,21 @@ NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp, uint32 security_i Ensure the enforced permissions for this share apply. ****************************************************************************/ -static void apply_default_perms(const files_struct *fsp, canon_ace *pace, mode_t type) +static void apply_default_perms(const struct share_params *params, + const bool is_directory, canon_ace *pace, + mode_t type) { - int snum = SNUM(fsp->conn); mode_t and_bits = (mode_t)0; mode_t or_bits = (mode_t)0; /* Get the initial bits to apply. */ - if (fsp->is_directory) { - and_bits = lp_dir_security_mask(snum); - or_bits = lp_force_dir_security_mode(snum); + if (is_directory) { + and_bits = lp_dir_security_mask(params->service); + or_bits = lp_force_dir_security_mode(params->service); } else { - and_bits = lp_security_mask(snum); - or_bits = lp_force_security_mode(snum); + and_bits = lp_security_mask(params->service); + or_bits = lp_force_security_mode(params->service); } /* Now bounce them into the S_USR space. */ @@ -1020,7 +1021,7 @@ static void apply_default_perms(const files_struct *fsp, canon_ace *pace, mode_t case S_IRUSR: /* Ensure owner has read access. */ pace->perms |= S_IRUSR; - if (fsp->is_directory) + if (is_directory) pace->perms |= (S_IWUSR|S_IXUSR); and_bits = unix_perms_to_acl_perms(and_bits, S_IRUSR, S_IWUSR, S_IXUSR); or_bits = unix_perms_to_acl_perms(or_bits, S_IRUSR, S_IWUSR, S_IXUSR); @@ -1092,7 +1093,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, if (pace->type == SMB_ACL_USER_OBJ) { if (setting_acl) - apply_default_perms(fsp, pace, S_IRUSR); + apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IRUSR); got_user = True; } else if (pace->type == SMB_ACL_GROUP_OBJ) { @@ -1102,7 +1103,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, */ if (setting_acl) - apply_default_perms(fsp, pace, S_IRGRP); + apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IRGRP); got_grp = True; } else if (pace->type == SMB_ACL_OTHER) { @@ -1112,7 +1113,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, */ if (setting_acl) - apply_default_perms(fsp, pace, S_IROTH); + apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IROTH); got_other = True; pace_other = pace; } @@ -1155,7 +1156,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, pace->perms = 0; } - apply_default_perms(fsp, pace, S_IRUSR); + apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IRUSR); } else { pace->perms = unix_perms_to_acl_perms(pst->st_mode, S_IRUSR, S_IWUSR, S_IXUSR); } @@ -1181,7 +1182,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, pace->perms = pace_other->perms; else pace->perms = 0; - apply_default_perms(fsp, pace, S_IRGRP); + apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IRGRP); } else { pace->perms = unix_perms_to_acl_perms(pst->st_mode, S_IRGRP, S_IWGRP, S_IXGRP); } @@ -1203,7 +1204,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, pace->attr = ALLOW_ACE; if (setting_acl) { pace->perms = 0; - apply_default_perms(fsp, pace, S_IROTH); + apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IROTH); } else pace->perms = unix_perms_to_acl_perms(pst->st_mode, S_IROTH, S_IWOTH, S_IXOTH); -- cgit From c5d21d1a651aa02c7b3e2fbaa89b8364bdfbfa68 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 28 Oct 2007 01:24:41 +0200 Subject: Change ensure_canon_entry_valid() to not take and fsp. Convert ensure_canon_entry_valid() to take share_params and an is_directory flag instead of an files_struct pointer. Michael (This used to be commit bdb208124bd703edee03ac4d2a4ec45ecdfc135e) --- source3/smbd/posix_acls.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index ca83d85399..7be4ee1c80 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -1077,7 +1077,8 @@ static bool uid_entry_in_group( canon_ace *uid_ace, canon_ace *group_ace ) ****************************************************************************/ static bool ensure_canon_entry_valid(canon_ace **pp_ace, - const files_struct *fsp, + const struct share_params *params, + const bool is_directory, const DOM_SID *pfile_owner_sid, const DOM_SID *pfile_grp_sid, const SMB_STRUCT_STAT *pst, @@ -1093,7 +1094,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, if (pace->type == SMB_ACL_USER_OBJ) { if (setting_acl) - apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IRUSR); + apply_default_perms(params, is_directory, pace, S_IRUSR); got_user = True; } else if (pace->type == SMB_ACL_GROUP_OBJ) { @@ -1103,7 +1104,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, */ if (setting_acl) - apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IRGRP); + apply_default_perms(params, is_directory, pace, S_IRGRP); got_grp = True; } else if (pace->type == SMB_ACL_OTHER) { @@ -1113,7 +1114,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, */ if (setting_acl) - apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IROTH); + apply_default_perms(params, is_directory, pace, S_IROTH); got_other = True; pace_other = pace; } @@ -1156,7 +1157,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, pace->perms = 0; } - apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IRUSR); + apply_default_perms(params, is_directory, pace, S_IRUSR); } else { pace->perms = unix_perms_to_acl_perms(pst->st_mode, S_IRUSR, S_IWUSR, S_IXUSR); } @@ -1182,7 +1183,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, pace->perms = pace_other->perms; else pace->perms = 0; - apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IRGRP); + apply_default_perms(params, is_directory, pace, S_IRGRP); } else { pace->perms = unix_perms_to_acl_perms(pst->st_mode, S_IRGRP, S_IWGRP, S_IXGRP); } @@ -1204,7 +1205,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace, pace->attr = ALLOW_ACE; if (setting_acl) { pace->perms = 0; - apply_default_perms(fsp->conn->params, fsp->is_directory, pace, S_IROTH); + apply_default_perms(params, is_directory, pace, S_IROTH); } else pace->perms = unix_perms_to_acl_perms(pst->st_mode, S_IROTH, S_IWOTH, S_IXOTH); @@ -2015,7 +2016,7 @@ static bool unpack_canon_ace(files_struct *fsp, pst->st_mode = create_default_mode(fsp, False); - if (!ensure_canon_entry_valid(&file_ace, fsp, pfile_owner_sid, pfile_grp_sid, pst, True)) { + if (!ensure_canon_entry_valid(&file_ace, fsp->conn->params, fsp->is_directory, pfile_owner_sid, pfile_grp_sid, pst, True)) { free_canon_ace_list(file_ace); free_canon_ace_list(dir_ace); return False; @@ -2031,7 +2032,7 @@ static bool unpack_canon_ace(files_struct *fsp, pst->st_mode = create_default_mode(fsp, True); - if (dir_ace && !ensure_canon_entry_valid(&dir_ace, fsp, pfile_owner_sid, pfile_grp_sid, pst, True)) { + if (dir_ace && !ensure_canon_entry_valid(&dir_ace, fsp->conn->params, fsp->is_directory, pfile_owner_sid, pfile_grp_sid, pst, True)) { free_canon_ace_list(file_ace); free_canon_ace_list(dir_ace); return False; @@ -2227,7 +2228,7 @@ static canon_ace *canonicalise_acl( const files_struct *fsp, SMB_ACL_T posix_acl * This next call will ensure we have at least a user/group/world set. */ - if (!ensure_canon_entry_valid(&list_head, fsp, powner, pgroup, psbuf, False)) + if (!ensure_canon_entry_valid(&list_head, fsp->conn->params, fsp->is_directory, powner, pgroup, psbuf, False)) goto fail; /* -- cgit From 13e0788714c1a5a3ce62597d04d3034ca14d031e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 28 Oct 2007 01:38:59 +0200 Subject: Change canonicalise_acl() to not take an fsp. Convert canonicalise_acl() to take connection_struct, is_directory and file name instead of files_struct pointer. Michael (This used to be commit d579a7f84fd47a3f00215725cecd65b21a5ff2e0) --- source3/smbd/posix_acls.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 7be4ee1c80..1b91823ea2 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -2110,10 +2110,11 @@ static void arrange_posix_perms(const char *filename, canon_ace **pp_list_head) Create a linked list of canonical ACE entries. ****************************************************************************/ -static canon_ace *canonicalise_acl( const files_struct *fsp, SMB_ACL_T posix_acl, SMB_STRUCT_STAT *psbuf, +static canon_ace *canonicalise_acl(const struct connection_struct *conn, + const bool is_directory, const char *fname, + SMB_ACL_T posix_acl, SMB_STRUCT_STAT *psbuf, const DOM_SID *powner, const DOM_SID *pgroup, struct pai_val *pal, SMB_ACL_TYPE_T the_acl_type) { - connection_struct *conn = fsp->conn; mode_t acl_mask = (S_IRUSR|S_IWUSR|S_IXUSR); canon_ace *list_head = NULL; canon_ace *ace = NULL; @@ -2228,7 +2229,7 @@ static canon_ace *canonicalise_acl( const files_struct *fsp, SMB_ACL_T posix_acl * This next call will ensure we have at least a user/group/world set. */ - if (!ensure_canon_entry_valid(&list_head, fsp->conn->params, fsp->is_directory, powner, pgroup, psbuf, False)) + if (!ensure_canon_entry_valid(&list_head, conn->params, is_directory, powner, pgroup, psbuf, False)) goto fail; /* @@ -2254,7 +2255,7 @@ static canon_ace *canonicalise_acl( const files_struct *fsp, SMB_ACL_T posix_acl } } - arrange_posix_perms(fsp->fsp_name,&list_head ); + arrange_posix_perms(fname,&list_head ); print_canon_ace_list( "canonicalise_acl: ace entries after arrange", list_head ); @@ -2816,7 +2817,10 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) */ /* Create the canon_ace lists. */ - file_ace = canonicalise_acl( fsp, posix_acl, &sbuf, &owner_sid, &group_sid, pal, SMB_ACL_TYPE_ACCESS ); + file_ace = canonicalise_acl(fsp->conn, fsp->is_directory, + fsp->fsp_name, posix_acl, &sbuf, + &owner_sid, &group_sid, pal, + SMB_ACL_TYPE_ACCESS); /* We must have *some* ACLS. */ @@ -2826,9 +2830,12 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) } if (fsp->is_directory && def_acl) { - dir_ace = canonicalise_acl(fsp, def_acl, &sbuf, - &global_sid_Creator_Owner, - &global_sid_Creator_Group, pal, SMB_ACL_TYPE_DEFAULT ); + dir_ace = canonicalise_acl(fsp->conn, fsp->is_directory, + fsp->fsp_name, def_acl, + &sbuf, + &global_sid_Creator_Owner, + &global_sid_Creator_Group, + pal, SMB_ACL_TYPE_DEFAULT); } /* -- cgit From a7e15d41c66e811777e52fbfa19df817d8617d5a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 6 Nov 2007 06:20:51 +0100 Subject: Remove the "is_directory" parameter from canonicalise_acl(): It can be retrieved from the stat buffer. Michael (This used to be commit b0ae830bf57dcaec00b2a2eabfec7221a3b7f791) --- source3/smbd/posix_acls.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 1b91823ea2..57a3ff9766 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -2110,10 +2110,10 @@ static void arrange_posix_perms(const char *filename, canon_ace **pp_list_head) Create a linked list of canonical ACE entries. ****************************************************************************/ -static canon_ace *canonicalise_acl(const struct connection_struct *conn, - const bool is_directory, const char *fname, - SMB_ACL_T posix_acl, SMB_STRUCT_STAT *psbuf, - const DOM_SID *powner, const DOM_SID *pgroup, struct pai_val *pal, SMB_ACL_TYPE_T the_acl_type) +static canon_ace *canonicalise_acl(struct connection_struct *conn, + const char *fname, SMB_ACL_T posix_acl, + const SMB_STRUCT_STAT *psbuf, + const DOM_SID *powner, const DOM_SID *pgroup, struct pai_val *pal, SMB_ACL_TYPE_T the_acl_type) { mode_t acl_mask = (S_IRUSR|S_IWUSR|S_IXUSR); canon_ace *list_head = NULL; @@ -2229,7 +2229,9 @@ static canon_ace *canonicalise_acl(const struct connection_struct *conn, * This next call will ensure we have at least a user/group/world set. */ - if (!ensure_canon_entry_valid(&list_head, conn->params, is_directory, powner, pgroup, psbuf, False)) + if (!ensure_canon_entry_valid(&list_head, conn->params, + S_ISDIR(psbuf->st_mode), powner, pgroup, + psbuf, False)) goto fail; /* @@ -2817,7 +2819,7 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) */ /* Create the canon_ace lists. */ - file_ace = canonicalise_acl(fsp->conn, fsp->is_directory, + file_ace = canonicalise_acl(fsp->conn, fsp->fsp_name, posix_acl, &sbuf, &owner_sid, &group_sid, pal, SMB_ACL_TYPE_ACCESS); @@ -2830,7 +2832,7 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) } if (fsp->is_directory && def_acl) { - dir_ace = canonicalise_acl(fsp->conn, fsp->is_directory, + dir_ace = canonicalise_acl(fsp->conn, fsp->fsp_name, def_acl, &sbuf, &global_sid_Creator_Owner, -- cgit From 8e2323e391e312e0f0284c918e2bb8567c035e20 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 6 Nov 2007 08:01:31 +0100 Subject: Split get_nt_acl() into two functions: fsp- and non-fsp variant. Replace smbd/posix_acls.c:get_nt_acl() by two funcions: posix_get_nt_acl() and posix_fget_nt_acl(). The first takes a connection struct and a file name instead of a files_struct pointer. This is in preparation of changing the vfs api for SMB_VFS_GET_NT_ACL. Michael (This used to be commit 50c82cc1456736fa634fb656e63555319742f725) --- source3/modules/vfs_aixacl2.c | 2 +- source3/modules/vfs_default.c | 4 +- source3/modules/vfs_gpfs.c | 2 +- source3/smbd/posix_acls.c | 211 +++++++++++++++++++++++++++++------------- 4 files changed, 152 insertions(+), 67 deletions(-) diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index 756977df4f..ab7c75691c 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -170,7 +170,7 @@ static NTSTATUS aixjfs2_get_nt_acl_common(files_struct *fsp, if (retryPosix) { DEBUG(10, ("retrying with posix acl...\n")); - return get_nt_acl(fsp, security_info, ppdesc); + return posix_fget_nt_acl(fsp, security_info, ppdesc); } if (result==False) return NT_STATUS_ACCESS_DENIED; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index cce5430493..3dd3727340 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -950,7 +950,7 @@ static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle, NTSTATUS result; START_PROFILE(fget_nt_acl); - result = get_nt_acl(fsp, security_info, ppdesc); + result = posix_fget_nt_acl(fsp, security_info, ppdesc); END_PROFILE(fget_nt_acl); return result; } @@ -962,7 +962,7 @@ static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle, NTSTATUS result; START_PROFILE(get_nt_acl); - result = get_nt_acl(fsp, security_info, ppdesc); + result = posix_get_nt_acl(fsp->conn, fsp->fsp_name, security_info, ppdesc); END_PROFILE(get_nt_acl); return result; } diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index c207bbfe2d..91d38874b9 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -240,7 +240,7 @@ static NTSTATUS gpfsacl_get_nt_acl_common(files_struct *fsp, if (result > 0) { DEBUG(10, ("retrying with posix acl...\n")); - return get_nt_acl(fsp, security_info, ppdesc); + return posix_fget_nt_acl(fsp, security_info, ppdesc); } /* GPFS ACL was not read, something wrong happened, error code is set in errno */ diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 57a3ff9766..d9782cfdb8 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -430,7 +430,7 @@ static struct pai_val *create_pai_val(char *buf, size_t size) Load the user.SAMBA_PAI attribute. ************************************************************************/ -static struct pai_val *load_inherited_info(files_struct *fsp) +static struct pai_val *fload_inherited_info(files_struct *fsp) { char *pai_buf; size_t pai_buf_size = 1024; @@ -490,6 +490,71 @@ static struct pai_val *load_inherited_info(files_struct *fsp) return paiv; } +/************************************************************************ + Load the user.SAMBA_PAI attribute. +************************************************************************/ + +static struct pai_val *load_inherited_info(const struct connection_struct *conn, + const char *fname) +{ + char *pai_buf; + size_t pai_buf_size = 1024; + struct pai_val *paiv = NULL; + ssize_t ret; + + if (!lp_map_acl_inherit(SNUM(conn))) { + return NULL; + } + + if ((pai_buf = (char *)SMB_MALLOC(pai_buf_size)) == NULL) { + return NULL; + } + + do { + ret = SMB_VFS_GETXATTR(conn, fname, + SAMBA_POSIX_INHERITANCE_EA_NAME, + pai_buf, pai_buf_size); + + if (ret == -1) { + if (errno != ERANGE) { + break; + } + /* Buffer too small - enlarge it. */ + pai_buf_size *= 2; + SAFE_FREE(pai_buf); + if (pai_buf_size > 1024*1024) { + return NULL; /* Limit malloc to 1mb. */ + } + if ((pai_buf = (char *)SMB_MALLOC(pai_buf_size)) == NULL) + return NULL; + } + } while (ret == -1); + + DEBUG(10,("load_inherited_info: ret = %lu for file %s\n", (unsigned long)ret, fname)); + + if (ret == -1) { + /* No attribute or not supported. */ +#if defined(ENOATTR) + if (errno != ENOATTR) + DEBUG(10,("load_inherited_info: Error %s\n", strerror(errno) )); +#else + if (errno != ENOSYS) + DEBUG(10,("load_inherited_info: Error %s\n", strerror(errno) )); +#endif + SAFE_FREE(pai_buf); + return NULL; + } + + paiv = create_pai_val(pai_buf, ret); + + if (paiv && paiv->pai_protected) { + DEBUG(10,("load_inherited_info: ACL is protected for file %s\n", fname)); + } + + SAFE_FREE(pai_buf); + return paiv; +} + /**************************************************************************** Functions to manipulate the internal ACE format. ****************************************************************************/ @@ -2724,6 +2789,7 @@ static size_t merge_default_aces( SEC_ACE *nt_ace_list, size_t num_aces) return num_aces; } + /**************************************************************************** Reply to query a security descriptor from an fsp. If it succeeds it allocates the space for the return elements and returns the size needed to return the @@ -2731,11 +2797,15 @@ static size_t merge_default_aces( SEC_ACE *nt_ace_list, size_t num_aces) the UNIX style get ACL. ****************************************************************************/ -NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) +static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn, + const char *name, + const SMB_STRUCT_STAT *sbuf, + struct pai_val *pal, + SMB_ACL_T posix_acl, + SMB_ACL_T def_acl, + uint32_t security_info, + SEC_DESC **ppdesc) { - connection_struct *conn = fsp->conn; - SMB_STRUCT_STAT sbuf; - SEC_ACE *nt_ace_list = NULL; DOM_SID owner_sid; DOM_SID group_sid; size_t sd_size = 0; @@ -2743,57 +2813,12 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) size_t num_acls = 0; size_t num_def_acls = 0; size_t num_aces = 0; - SMB_ACL_T posix_acl = NULL; - SMB_ACL_T def_acl = NULL; canon_ace *file_ace = NULL; canon_ace *dir_ace = NULL; + SEC_ACE *nt_ace_list = NULL; size_t num_profile_acls = 0; - struct pai_val *pal = NULL; SEC_DESC *psd = NULL; - *ppdesc = NULL; - - DEBUG(10,("get_nt_acl: called for file %s\n", fsp->fsp_name )); - - if(fsp->is_directory || fsp->fh->fd == -1) { - - /* Get the stat struct for the owner info. */ - if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0) { - return map_nt_error_from_unix(errno); - } - /* - * Get the ACL from the path. - */ - - posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fsp->fsp_name, SMB_ACL_TYPE_ACCESS); - - /* - * If it's a directory get the default POSIX ACL. - */ - - if(fsp->is_directory) { - def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fsp->fsp_name, SMB_ACL_TYPE_DEFAULT); - def_acl = free_empty_sys_acl(conn, def_acl); - } - - } else { - - /* Get the stat struct for the owner info. */ - if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) { - return map_nt_error_from_unix(errno); - } - /* - * Get the ACL from the fd. - */ - posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd); - } - - DEBUG(5,("get_nt_acl : file ACL %s, directory ACL %s\n", - posix_acl ? "present" : "absent", - def_acl ? "present" : "absent" )); - - pal = load_inherited_info(fsp); - /* * Get the owner, group and world SIDs. */ @@ -2804,7 +2829,7 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) sid_copy(&group_sid, &global_sid_Builtin_Users); num_profile_acls = 2; } else { - create_file_sids(&sbuf, &owner_sid, &group_sid); + create_file_sids(sbuf, &owner_sid, &group_sid); } if ((security_info & DACL_SECURITY_INFORMATION) && !(security_info & PROTECTED_DACL_SECURITY_INFORMATION)) { @@ -2819,22 +2844,20 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) */ /* Create the canon_ace lists. */ - file_ace = canonicalise_acl(fsp->conn, - fsp->fsp_name, posix_acl, &sbuf, + file_ace = canonicalise_acl(conn, name, posix_acl, sbuf, &owner_sid, &group_sid, pal, SMB_ACL_TYPE_ACCESS); /* We must have *some* ACLS. */ if (count_canon_ace_list(file_ace) == 0) { - DEBUG(0,("get_nt_acl : No ACLs on file (%s) !\n", fsp->fsp_name )); + DEBUG(0,("get_nt_acl : No ACLs on file (%s) !\n", name)); goto done; } - if (fsp->is_directory && def_acl) { - dir_ace = canonicalise_acl(fsp->conn, - fsp->fsp_name, def_acl, - &sbuf, + if (S_ISDIR(sbuf->st_mode) && def_acl) { + dir_ace = canonicalise_acl(conn, name, def_acl, + sbuf, &global_sid_Creator_Owner, &global_sid_Creator_Group, pal, SMB_ACL_TYPE_DEFAULT); @@ -2921,7 +2944,7 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) acc = map_canon_ace_perms(SNUM(conn), &nt_acl_type, ace->perms, - fsp->is_directory); + S_ISDIR(sbuf->st_mode)); init_sec_ace(&nt_ace_list[num_aces++], &ace->trustee, nt_acl_type, @@ -2950,7 +2973,7 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) acc = map_canon_ace_perms(SNUM(conn), &nt_acl_type, ace->perms, - fsp->is_directory); + S_ISDIR(sbuf->st_mode)); init_sec_ace(&nt_ace_list[num_aces++], &ace->trustee, nt_acl_type, @@ -3039,6 +3062,69 @@ NTSTATUS get_nt_acl(files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) return NT_STATUS_OK; } +NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info, + SEC_DESC **ppdesc) +{ + SMB_STRUCT_STAT sbuf; + SMB_ACL_T posix_acl = NULL; + struct pai_val *pal; + + *ppdesc = NULL; + + DEBUG(10,("posix_fget_nt_acl: called for file %s\n", fsp->fsp_name )); + + /* can it happen that fsp_name == NULL ? */ + if (fsp->is_directory || fsp->fh->fd == -1) { + return posix_get_nt_acl(fsp->conn, fsp->fsp_name, + security_info, ppdesc); + } + + /* Get the stat struct for the owner info. */ + if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) { + return map_nt_error_from_unix(errno); + } + + /* Get the ACL from the fd. */ + posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd); + + pal = fload_inherited_info(fsp); + + return posix_get_nt_acl_common(fsp->conn, fsp->fsp_name, &sbuf, pal, + posix_acl, NULL, security_info, ppdesc); +} + +NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name, + uint32_t security_info, SEC_DESC **ppdesc) +{ + SMB_STRUCT_STAT sbuf; + SMB_ACL_T posix_acl = NULL; + SMB_ACL_T def_acl = NULL; + struct pai_val *pal; + + *ppdesc = NULL; + + DEBUG(10,("posix_get_nt_acl: called for file %s\n", name )); + + /* Get the stat struct for the owner info. */ + if(SMB_VFS_STAT(conn, name, &sbuf) != 0) { + return map_nt_error_from_unix(errno); + } + + /* Get the ACL from the path. */ + posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_ACCESS); + + /* If it's a directory get the default POSIX ACL. */ + if(S_ISDIR(sbuf.st_mode)) { + def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_DEFAULT); + def_acl = free_empty_sys_acl(conn, def_acl); + } + + pal = load_inherited_info(conn, name); + + return posix_get_nt_acl_common(conn, name, &sbuf, pal, posix_acl, + def_acl, security_info, ppdesc); +} + /**************************************************************************** Try to chown a file. We will be able to chown it under the following conditions. @@ -4182,8 +4268,7 @@ SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname) finfo.fh->fd = -1; finfo.fsp_name = CONST_DISCARD(char *,fname); - if (!NT_STATUS_IS_OK(get_nt_acl( &finfo, DACL_SECURITY_INFORMATION, - &psd ))) { + if (!NT_STATUS_IS_OK(posix_fget_nt_acl( &finfo, DACL_SECURITY_INFORMATION, &psd))) { DEBUG(0,("get_nt_acl_no_snum: get_nt_acl returned zero.\n")); conn_free_internal( &conn ); return NULL; -- cgit From cb69a78505854342013f67630bfd38a3c5cd7857 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 9 Nov 2007 01:01:55 +0100 Subject: Split smbacl4_GetFileOwner into two (f- and non-f-variant). This is in preparation of a get_nt_acl prototype change. (This used to be commit e0672a46a2e5e655da32499ca7f52a9156e9b7f0) --- source3/modules/nfs4_acls.c | 48 +++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index edcc52261c..94666ba00d 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -161,24 +161,35 @@ uint32 smb_get_naces(SMB4ACL_T *acl) return aclint->naces; } -static int smbacl4_GetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf) +static int smbacl4_GetFileOwner(struct connection_struct *conn, + const char *filename, + SMB_STRUCT_STAT *psbuf) { memset(psbuf, 0, sizeof(SMB_STRUCT_STAT)); + + /* Get the stat struct for the owner info. */ + if (SMB_VFS_STAT(conn, filename, psbuf) != 0) + { + DEBUG(8, ("SMB_VFS_STAT failed with error %s\n", + strerror(errno))); + return -1; + } + + return 0; +} + +static int smbacl4_fGetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf) +{ + memset(psbuf, 0, sizeof(SMB_STRUCT_STAT)); + if (fsp->is_directory || fsp->fh->fd == -1) { - /* Get the stat struct for the owner info. */ - if (SMB_VFS_STAT(fsp->conn,fsp->fsp_name, psbuf) != 0) - { - DEBUG(8, ("SMB_VFS_STAT failed with error %s\n", - strerror(errno))); - return -1; - } - } else { - if (SMB_VFS_FSTAT(fsp,fsp->fh->fd, psbuf) != 0) - { - DEBUG(8, ("SMB_VFS_FSTAT failed with error %s\n", - strerror(errno))); - return -1; - } + return smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, psbuf); + } + if (SMB_VFS_FSTAT(fsp,fsp->fh->fd, psbuf) != 0) + { + DEBUG(8, ("SMB_VFS_FSTAT failed with error %s\n", + strerror(errno))); + return -1; } return 0; @@ -276,9 +287,8 @@ NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp, * shouldn't alloc 0 for * win */ - if (smbacl4_GetFileOwner(fsp, &sbuf)) + if (smbacl4_fGetFileOwner(fsp, &sbuf)) return map_nt_error_from_unix(errno); - uid_to_sid(&sid_owner, sbuf.st_uid); gid_to_sid(&sid_group, sbuf.st_gid); @@ -588,7 +598,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, if (smbacl4_get_vfs_params(SMBACL4_PARAM_TYPE_NAME, fsp, ¶ms)) return NT_STATUS_NO_MEMORY; - if (smbacl4_GetFileOwner(fsp, &sbuf)) + if (smbacl4_fGetFileOwner(fsp, &sbuf)) return map_nt_error_from_unix(errno); if (params.do_chown) { @@ -610,7 +620,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, } DEBUG(10,("chown %s, %u, %u succeeded.\n", fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); - if (smbacl4_GetFileOwner(fsp, &sbuf)) + if (smbacl4_fGetFileOwner(fsp, &sbuf)) return map_nt_error_from_unix(errno); } } -- cgit From c650857fac826697cb1d9441b9ea869b85190d25 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 15 Nov 2007 00:46:20 +0100 Subject: Split smb_get_nt_acl_nfs4 into two (f- and non-f-variant). This is the next step in preparation of a get_nt_acl prototype change. Michael (This used to be commit 7afeb1c6cb1bdb58d1e61c54ae215d947d8dc3ea) --- source3/modules/nfs4_acls.c | 44 ++++++++++++++++++++++++++++++++++--------- source3/modules/nfs4_acls.h | 7 ++++++- source3/modules/vfs_aixacl2.c | 2 +- source3/modules/vfs_gpfs.c | 2 +- source3/modules/vfs_zfsacl.c | 2 +- 5 files changed, 44 insertions(+), 13 deletions(-) diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index 94666ba00d..70bb6a02e8 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -268,29 +268,24 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */ return True; } -NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp, +static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf, uint32 security_info, SEC_DESC **ppdesc, SMB4ACL_T *acl) { int good_aces = 0; - SMB_STRUCT_STAT sbuf; DOM_SID sid_owner, sid_group; size_t sd_size = 0; SEC_ACE *nt_ace_list = NULL; SEC_ACL *psa = NULL; TALLOC_CTX *mem_ctx = talloc_tos(); - DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name)); - if (acl==NULL || smb_get_naces(acl)==0) return NT_STATUS_ACCESS_DENIED; /* special because we * shouldn't alloc 0 for * win */ - if (smbacl4_fGetFileOwner(fsp, &sbuf)) - return map_nt_error_from_unix(errno); - uid_to_sid(&sid_owner, sbuf.st_uid); - gid_to_sid(&sid_group, sbuf.st_gid); + uid_to_sid(&sid_owner, sbuf->st_uid); + gid_to_sid(&sid_group, sbuf->st_gid); if (smbacl4_nfs42win(mem_ctx, acl, &sid_owner, &sid_group, &nt_ace_list, &good_aces)==False) { DEBUG(8,("smbacl4_nfs42win failed\n")); @@ -313,12 +308,43 @@ NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp, return NT_STATUS_NO_MEMORY; } - DEBUG(10, ("smb_get_nt_acl_nfs4 successfully exited with sd_size %d\n", + DEBUG(10, ("smb_get_nt_acl_nfs4_common successfully exited with sd_size %d\n", sec_desc_size(*ppdesc))); return NT_STATUS_OK; } +NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp, + uint32 security_info, + SEC_DESC **ppdesc, SMB4ACL_T *acl) +{ + SMB_STRUCT_STAT sbuf; + + DEBUG(10, ("smb_fget_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name)); + + if (smbacl4_fGetFileOwner(fsp, &sbuf)) { + return map_nt_error_from_unix(errno); + } + + return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl); +} + +NTSTATUS smb_get_nt_acl_nfs4(struct connection_struct *conn, + const char *name, + uint32 security_info, + SEC_DESC **ppdesc, SMB4ACL_T *acl) +{ + SMB_STRUCT_STAT sbuf; + + DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n", name)); + + if (smbacl4_GetFileOwner(conn, name, &sbuf)) { + return map_nt_error_from_unix(errno); + } + + return smb_get_nt_acl_nfs4_common(&sbuf, security_info, ppdesc, acl); +} + enum smbacl4_mode_enum {e_simple=0, e_special=1}; enum smbacl4_acedup_enum {e_dontcare=0, e_reject=1, e_ignore=2, e_merge=3}; diff --git a/source3/modules/nfs4_acls.h b/source3/modules/nfs4_acls.h index ceb66ec094..0f783aa977 100644 --- a/source3/modules/nfs4_acls.h +++ b/source3/modules/nfs4_acls.h @@ -129,7 +129,12 @@ SMB4ACE_T *smb_next_ace4(SMB4ACE_T *ace); uint32 smb_get_naces(SMB4ACL_T *acl); -NTSTATUS smb_get_nt_acl_nfs4(files_struct *fsp, +NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp, + uint32 security_info, + SEC_DESC **ppdesc, SMB4ACL_T *acl); + +NTSTATUS smb_get_nt_acl_nfs4(connection_struct *conn, + const char *name, uint32 security_info, SEC_DESC **ppdesc, SMB4ACL_T *acl); diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index ab7c75691c..0cb40a2214 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -175,7 +175,7 @@ static NTSTATUS aixjfs2_get_nt_acl_common(files_struct *fsp, if (result==False) return NT_STATUS_ACCESS_DENIED; - return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl); + return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl); } NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle, diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 91d38874b9..418a81ffb4 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -236,7 +236,7 @@ static NTSTATUS gpfsacl_get_nt_acl_common(files_struct *fsp, result = gpfs_get_nfs4_acl(fsp->fsp_name, &pacl); if (result == 0) - return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl); + return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl); if (result > 0) { DEBUG(10, ("retrying with posix acl...\n")); diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 0fe21b2909..88cd0879cf 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -92,7 +92,7 @@ static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info, return NT_STATUS_NO_MEMORY; } - return smb_get_nt_acl_nfs4(fsp, security_info, ppdesc, pacl); + return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl); } /* call-back function processing the NT acl -> ZFS acl using NFSv4 conv. */ -- cgit From 010056a5e6c8b94d858575210b5544e5bbcd32b3 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 16 Nov 2007 18:33:39 +0100 Subject: Prepare the gpfs acl module for the api change in get_nt_acl(). This moves functionality from gpfsacl_get_nt_acl_common() back to gpfsacl_get_nt_acl() and gpfsacl_fget_nt_acl(), making both these functions more specific (calling the corresponding fsp- and non-fsp functions). gpfsacl_get_nt_acl_common(). is removed. Michael (This used to be commit d6043c1066322d2c567aedc5eae1a9d46c8fc396) --- source3/modules/vfs_gpfs.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 418a81ffb4..e7331bef29 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -226,8 +226,9 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl) return 0; } -static NTSTATUS gpfsacl_get_nt_acl_common(files_struct *fsp, - uint32 security_info, SEC_DESC **ppdesc) +static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle, + files_struct *fsp, int fd, uint32 security_info, + SEC_DESC **ppdesc) { SMB4ACL_T *pacl = NULL; int result; @@ -242,23 +243,31 @@ static NTSTATUS gpfsacl_get_nt_acl_common(files_struct *fsp, DEBUG(10, ("retrying with posix acl...\n")); return posix_fget_nt_acl(fsp, security_info, ppdesc); } - + /* GPFS ACL was not read, something wrong happened, error code is set in errno */ return map_nt_error_from_unix(errno); } -NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle, - files_struct *fsp, int fd, uint32 security_info, - SEC_DESC **ppdesc) -{ - return gpfsacl_get_nt_acl_common(fsp, security_info, ppdesc); -} - -NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle, +static NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, SEC_DESC **ppdesc) { - return gpfsacl_get_nt_acl_common(fsp, security_info, ppdesc); + SMB4ACL_T *pacl = NULL; + int result; + + *ppdesc = NULL; + result = gpfs_get_nfs4_acl(fsp->fsp_name, &pacl); + + if (result == 0) + return smb_get_nt_acl_nfs4(handle->conn, name, security_info, ppdesc, pacl); + + if (result > 0) { + DEBUG(10, ("retrying with posix acl...\n")); + return posix_get_nt_acl(handle->conn, name, security_info, ppdesc); + } + + /* GPFS ACL was not read, something wrong happened, error code is set in errno */ + return map_nt_error_from_unix(errno); } static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) -- cgit From c8fc49ff1b18606577c12fd0d89b94378c25f0be Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 16 Nov 2007 18:33:39 +0100 Subject: Prepare the zfs acl module for the api change in get_nt_acl(). Michael (This used to be commit 04258231dc654df077638edb7cb08542e39b7547) --- source3/modules/vfs_zfsacl.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 88cd0879cf..e4b38f88ab 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -34,8 +34,9 @@ * read the local file's acls and return it in NT form * using the NFSv4 format conversion */ -static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info, - struct security_descriptor **ppdesc) +static NTSTATUS zfs_get_nt_acl_common(const char *name, + uint32 security_info, + SMB4ACL_T **ppacl) { int naces, i; ace_t *acebuf; @@ -43,11 +44,11 @@ static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info, TALLOC_CTX *mem_ctx; /* read the number of file aces */ - if((naces = acl(fsp->fsp_name, ACE_GETACLCNT, 0, NULL)) == -1) { + if((naces = acl(name, ACE_GETACLCNT, 0, NULL)) == -1) { if(errno == ENOSYS) { DEBUG(9, ("acl(ACE_GETACLCNT, %s): Operation is not supported on the filesystem where the file reside")); } else { - DEBUG(9, ("acl(ACE_GETACLCNT, %s): %s ", fsp->fsp_name, + DEBUG(9, ("acl(ACE_GETACLCNT, %s): %s ", name, strerror(errno))); } return map_nt_error_from_unix(errno); @@ -59,8 +60,8 @@ static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info, return NT_STATUS_NO_MEMORY; } /* read the aces into the field */ - if(acl(fsp->fsp_name, ACE_GETACL, naces, acebuf) < 0) { - DEBUG(9, ("acl(ACE_GETACL, %s): %s ", fsp->fsp_name, + if(acl(name, ACE_GETACL, naces, acebuf) < 0) { + DEBUG(9, ("acl(ACE_GETACL, %s): %s ", name, strerror(errno))); return map_nt_error_from_unix(errno); } @@ -92,7 +93,8 @@ static NTSTATUS zfs_get_nt_acl(struct files_struct *fsp, uint32 security_info, return NT_STATUS_NO_MEMORY; } - return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl); + *ppacl = pacl; + return NT_STATUS_OK; } /* call-back function processing the NT acl -> ZFS acl using NFSv4 conv. */ @@ -171,7 +173,15 @@ static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle, int fd, uint32 security_info, struct security_descriptor **ppdesc) { - return zfs_get_nt_acl(fsp, security_info, ppdesc); + SMB4ACL_T *pacl; + NTSTATUS status; + + status = zfs_get_nt_acl_common(fsp->fsp_name, security_info, &pacl); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl); } static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle, @@ -179,7 +189,16 @@ static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle, const char *name, uint32 security_info, struct security_descriptor **ppdesc) { - return zfs_get_nt_acl(fsp, security_info, ppdesc); + SMB4ACL_T *pacl; + NTSTATUS status; + + status = zfs_get_nt_acl_common(name, security_info, &pacl); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return smb_get_nt_acl_nfs4(handle->conn, name, security_info, ppdesc, + pacl); } static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle, -- cgit From 35f13ae58958e00aeb81bfe6cb5cf3c9dec3f62f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 4 Dec 2007 08:19:40 +0100 Subject: Reformatting: wrap long lines and remove trailing spaces. Michael (This used to be commit f6db5a0d0571130f765d8a0fb4e20e61cc8b2487) --- source3/modules/vfs_zfsacl.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index e4b38f88ab..307fa9977f 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -46,7 +46,9 @@ static NTSTATUS zfs_get_nt_acl_common(const char *name, /* read the number of file aces */ if((naces = acl(name, ACE_GETACLCNT, 0, NULL)) == -1) { if(errno == ENOSYS) { - DEBUG(9, ("acl(ACE_GETACLCNT, %s): Operation is not supported on the filesystem where the file reside")); + DEBUG(9, ("acl(ACE_GETACLCNT, %s): Operation is not " + "supported on the filesystem where the file " + "reside")); } else { DEBUG(9, ("acl(ACE_GETACLCNT, %s): %s ", name, strerror(errno))); @@ -145,7 +147,9 @@ static bool zfs_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) /* store acl */ if(acl(fsp->fsp_name, ACE_SETACL, naces, acebuf)) { if(errno == ENOSYS) { - DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not supported on the filesystem where the file reside")); + DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not " + "supported on the filesystem where the file " + "reside")); } else { DEBUG(9, ("acl(ACE_SETACL, %s): %s ", fsp->fsp_name, strerror(errno))); @@ -219,7 +223,7 @@ static NTSTATUS zfsacl_set_nt_acl(vfs_handle_struct *handle, /* VFS operations structure */ -static vfs_op_tuple zfsacl_ops[] = { +static vfs_op_tuple zfsacl_ops[] = { {SMB_VFS_OP(zfsacl_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(zfsacl_get_nt_acl), SMB_VFS_OP_GET_NT_ACL, -- cgit From 65b3065a4b31102e332de7d6008941847d5f97b3 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 4 Dec 2007 08:25:21 +0100 Subject: Fix two debug statements: Add missing printf parameter. Michael (This used to be commit 1c4f74551f48429ee3af2022101a97679e25cdea) --- source3/modules/vfs_zfsacl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 307fa9977f..83893c7aea 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -48,7 +48,7 @@ static NTSTATUS zfs_get_nt_acl_common(const char *name, if(errno == ENOSYS) { DEBUG(9, ("acl(ACE_GETACLCNT, %s): Operation is not " "supported on the filesystem where the file " - "reside")); + "reside", name)); } else { DEBUG(9, ("acl(ACE_GETACLCNT, %s): %s ", name, strerror(errno))); @@ -149,7 +149,7 @@ static bool zfs_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) if(errno == ENOSYS) { DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not " "supported on the filesystem where the file " - "reside")); + "reside", fsp->fsp_name)); } else { DEBUG(9, ("acl(ACE_SETACL, %s): %s ", fsp->fsp_name, strerror(errno))); -- cgit From fcee8ccdcdec341f758fb8aa30d5eb432430005d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 3 Dec 2007 18:24:56 +0100 Subject: Change aixjfs2_get_nfs4_acl() to take file name instead of fsp. In preparation of the api change in api change in get_nt_acl(). Michael (This used to be commit 40a1438e17c462990e6b71b544c39f093236d5be) --- source3/modules/vfs_aixacl2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index 0cb40a2214..289f4af9e6 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -98,7 +98,7 @@ static AIXJFS2_ACL_T *aixjfs2_getacl_alloc(const char *fname, acl_type_t *type) return acl; } -static bool aixjfs2_get_nfs4_acl(files_struct *fsp, +static bool aixjfs2_get_nfs4_acl(const char *name, SMB4ACL_T **ppacl, bool *pretryPosix) { int32_t i; @@ -108,15 +108,15 @@ static bool aixjfs2_get_nfs4_acl(files_struct *fsp, nfs4_ace_int_t *jfs2_ace = NULL; acl_type_t type; - DEBUG(10,("jfs2 get_nt_acl invoked for %s\n", fsp->fsp_name)); + DEBUG(10,("jfs2 get_nt_acl invoked for %s\n", name)); memset(&type, 0, sizeof(acl_type_t)); type.u64 = ACL_NFS4; - pacl = aixjfs2_getacl_alloc(fsp->fsp_name, &type); + pacl = aixjfs2_getacl_alloc(name, &type); if (pacl == NULL) { DEBUG(9, ("aixjfs2_getacl_alloc failed for %s with %s\n", - fsp->fsp_name, strerror(errno))); + name, strerror(errno))); if (errno==ENOSYS) *pretryPosix = True; return False; @@ -166,7 +166,7 @@ static NTSTATUS aixjfs2_get_nt_acl_common(files_struct *fsp, bool retryPosix = False; *ppdesc = NULL; - result = aixjfs2_get_nfs4_acl(fsp, &pacl, &retryPosix); + result = aixjfs2_get_nfs4_acl(fsp->fsp_name, &pacl, &retryPosix); if (retryPosix) { DEBUG(10, ("retrying with posix acl...\n")); -- cgit From aca40f29d5aa96c980fbe010e91be4c0dc608f5f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 3 Dec 2007 18:31:03 +0100 Subject: Prepare the aix2 acl module for the api change in get_nt_acl(). This makes both of aixjfs2_[f]get_nt_acl() more specific, eliminating the need for aixjfs2_get_nt_acl_common(). Michael (This used to be commit 36e2a814ba50feefa34c76353c0f5dec1d7cfff4) --- source3/modules/vfs_aixacl2.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index 289f4af9e6..d28efa55c6 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -158,8 +158,9 @@ static bool aixjfs2_get_nfs4_acl(const char *name, return True; } -static NTSTATUS aixjfs2_get_nt_acl_common(files_struct *fsp, - uint32 security_info, SEC_DESC **ppdesc) +static NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle, + files_struct *fsp, int fd, uint32 security_info, + SEC_DESC **ppdesc) { SMB4ACL_T *pacl = NULL; bool result; @@ -178,18 +179,27 @@ static NTSTATUS aixjfs2_get_nt_acl_common(files_struct *fsp, return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl); } -NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle, - files_struct *fsp, int fd, uint32 security_info, - SEC_DESC **ppdesc) -{ - return aixjfs2_get_nt_acl_common(fsp, security_info, ppdesc); -} - -NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle, +static NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, SEC_DESC **ppdesc) { - return aixjfs2_get_nt_acl_common(fsp, security_info, ppdesc); + SMB4ACL_T *pacl = NULL; + bool result; + bool retryPosix = False; + + *ppdesc = NULL; + result = aixjfs2_get_nfs4_acl(name, &pacl, &retryPosix); + if (retryPosix) + { + DEBUG(10, ("retrying with posix acl...\n")); + return posix_get_nt_acl(handle->conn, name security_info, + ppdesc); + } + if (result==False) + return NT_STATUS_ACCESS_DENIED; + + return smb_get_nt_acl_nfs4(handle->conn, name, security_info, ppdesc, + pacl); } static SMB_ACL_T aixjfs2_get_posix_acl(const char *path, acl_type_t type) -- cgit From 9460dfc93343f395f6a3867f9f8ec4dfb47bfbc7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 4 Dec 2007 09:45:14 +0100 Subject: Prepare the afs acl module for the api change in get_nt_acl(). This makes both of afsacl_[f]get_nt_acl() more specific, eliminating the need for afs_get_nt_acl(). Instead, split afs_to_nt_acl. Michael (This used to be commit 15caf58c81ce6b68eefa03c8f8510c2ecb5fdeb3) --- source3/modules/vfs_afsacl.c | 120 +++++++++++++++++++++++++++---------------- 1 file changed, 77 insertions(+), 43 deletions(-) diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index a923ce188f..9dd4d7ec93 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -585,15 +585,14 @@ static uint32 nt_to_afs_file_rights(const char *filename, const SEC_ACE *ace) return result; } -static size_t afs_to_nt_acl(struct afs_acl *afs_acl, - struct files_struct *fsp, - uint32 security_info, - struct security_descriptor **ppdesc) +static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl, + SMB_STRUCT_STAT *psbuf, + uint32 security_info, + struct security_descriptor **ppdesc) { SEC_ACE *nt_ace_list; DOM_SID owner_sid, group_sid; SEC_ACCESS mask; - SMB_STRUCT_STAT sbuf; SEC_ACL *psa = NULL; int good_aces; size_t sd_size; @@ -601,19 +600,8 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl, struct afs_ace *afs_ace; - if (fsp->is_directory || fsp->fh->fd == -1) { - /* Get the stat struct for the owner info. */ - if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0) { - return 0; - } - } else { - if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) { - return 0; - } - } - - uid_to_sid(&owner_sid, sbuf.st_uid); - gid_to_sid(&group_sid, sbuf.st_gid); + uid_to_sid(&owner_sid, psbuf->st_uid); + gid_to_sid(&group_sid, psbuf->st_gid); if (afs_acl->num_aces) { nt_ace_list = TALLOC_ARRAY(mem_ctx, SEC_ACE, afs_acl->num_aces); @@ -639,7 +627,7 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl, continue; } - if (fsp->is_directory) + if (S_ISDIR(psbuf->st_mode)) afs_to_nt_dir_rights(afs_ace->rights, &nt_rights, &flag); else @@ -656,7 +644,6 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl, if (psa == NULL) return 0; - *ppdesc = make_sec_desc(mem_ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, (security_info & OWNER_SECURITY_INFORMATION) @@ -668,6 +655,42 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl, return sd_size; } +static size_t afs_to_nt_acl(struct afs_acl *afs_acl, + struct connection_struct *conn, + const char *name, + uint32 security_info, + struct security_descriptor **ppdesc) +{ + SMB_STRUCT_STAT sbuf; + + /* Get the stat struct for the owner info. */ + if(SMB_VFS_STAT(conn, name, &sbuf) != 0) { + return 0; + } + + return afs_to_nt_acl_common(afs_acl, &sbuf, security_info, ppdesc); +} + +static size_t afs_fto_nt_acl(struct afs_acl *afs_acl, + struct files_struct *fsp, + uint32 security_info, + struct security_descriptor **ppdesc) +{ + SMB_STRUCT_STAT sbuf; + + if (fsp->is_directory || fsp->fh->fd == -1) { + /* Get the stat struct for the owner info. */ + return afs_to_nt_acl(afs_acl, fsp->conn, fsp->fsp_name, + security_info, ppdesc); + } + + if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) { + return 0; + } + + return afs_to_nt_acl_common(afs_acl, &sbuf, security_info, ppdesc); +} + static bool mappable_sid(const DOM_SID *sid) { DOM_SID domain_sid; @@ -830,27 +853,6 @@ static bool afs_get_afs_acl(char *filename, struct afs_acl *acl) return True; } -static NTSTATUS afs_get_nt_acl(struct files_struct *fsp, uint32 security_info, - struct security_descriptor **ppdesc) -{ - struct afs_acl acl; - size_t sd_size; - - DEBUG(5, ("afs_get_nt_acl: %s\n", fsp->fsp_name)); - - sidpts = lp_parm_bool(SNUM(fsp->conn), "afsacl", "sidpts", False); - - if (!afs_get_afs_acl(fsp->fsp_name, &acl)) { - return NT_STATUS_ACCESS_DENIED; - } - - sd_size = afs_to_nt_acl(&acl, fsp, security_info, ppdesc); - - free_afs_acl(&acl); - - return (sd_size != 0) ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED; -} - /* For setting an AFS ACL we have to take care of the ACEs we could * not properly map to SIDs. Merge all of them into the new ACL. */ @@ -994,14 +996,46 @@ static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle, int fd, uint32 security_info, struct security_descriptor **ppdesc) { - return afs_get_nt_acl(fsp, security_info, ppdesc); + struct afs_acl acl; + size_t sd_size; + + DEBUG(5, ("afsacl_fget_nt_acl: %s\n", fsp->fsp_name)); + + sidpts = lp_parm_bool(SNUM(fsp->conn), "afsacl", "sidpts", False); + + if (!afs_get_afs_acl(fsp->fsp_name, &acl)) { + return NT_STATUS_ACCESS_DENIED; + } + + sd_size = afs_fto_nt_acl(&acl, fsp, security_info, ppdesc); + + free_afs_acl(&acl); + + return (sd_size != 0) ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED; } + static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor **ppdesc) { - return afs_get_nt_acl(fsp, security_info, ppdesc); + struct afs_acl acl; + size_t sd_size; + + DEBUG(5, ("afsacl_get_nt_acl: %s\n", name)); + + sidpts = lp_parm_bool(SNUM(handle->conn), "afsacl", "sidpts", False); + + if (!afs_get_afs_acl(name, &acl)) { + return NT_STATUS_ACCESS_DENIED; + } + + sd_size = afs_to_nt_acl(&acl, handle->conn, name, security_info, + ppdesc); + + free_afs_acl(&acl); + + return (sd_size != 0) ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED; } NTSTATUS afsacl_fset_nt_acl(vfs_handle_struct *handle, -- cgit From 233eb0e560acb26f8706fd3ab96d4c6379458414 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 5 Dec 2007 09:53:10 +0100 Subject: Change the prototype of the vfs function get_nt_acl(). Up to now, get_nt_acl() took a files_struct pointer (fsp) and a file name. All the underlying functions should need and now do need (after the previous preparatory work), is a connection_struct and a file name. The connection_struct is already there in the vfs_handle passed to the vfs functions. So the files_struct argument can be eliminated. This eliminates the need of calling open_file_stat in a couple of places to produce the fsp needed. Michael (This used to be commit b5f600fab53c9d159a958c59795db3ba4a8acc63) --- source3/include/vfs.h | 4 ++- source3/include/vfs_macros.h | 6 ++-- source3/modules/vfs_afsacl.c | 1 - source3/modules/vfs_catia.c | 3 +- source3/modules/vfs_default.c | 4 +-- source3/modules/vfs_full_audit.c | 3 +- source3/modules/vfs_gpfs.c | 2 +- source3/modules/vfs_zfsacl.c | 1 - source3/rpc_server/srv_srvsvc_nt.c | 26 +-------------- source3/smbd/file_access.c | 67 +++----------------------------------- source3/smbd/nttrans.c | 2 +- source3/smbd/posix_acls.c | 2 +- 12 files changed, 19 insertions(+), 102 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index b45320dd87..e1669a271c 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -75,6 +75,9 @@ /* Leave at 22 - not yet released. Change all BOOL parameters (int) to bool. jra. */ /* Leave at 22 - not yet released. Added recvfile. */ /* Leave at 22 - not yet released. Change get_nt_acl to return NTSTATUS - vl */ +/* Leave at 22 - not yet released. Change get_nt_acl to *not* take a + * files_struct. - obnox.*/ + #define SMB_VFS_INTERFACE_VERSION 22 @@ -311,7 +314,6 @@ struct vfs_ops { uint32 security_info, struct security_descriptor **ppdesc); NTSTATUS (*get_nt_acl)(struct vfs_handle_struct *handle, - struct files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor **ppdesc); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index cc7780f354..c31d6cfc67 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -85,7 +85,7 @@ /* NT ACL operations. */ #define SMB_VFS_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc))) -#define SMB_VFS_GET_NT_ACL(fsp, name, security_info, ppdesc) ((fsp)->conn->vfs.ops.get_nt_acl((fsp)->conn->vfs.handles.get_nt_acl, (fsp), (name), (security_info), (ppdesc))) +#define SMB_VFS_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs.ops.get_nt_acl((conn)->vfs.handles.get_nt_acl, (name), (security_info), (ppdesc))) #define SMB_VFS_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) #define SMB_VFS_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs.ops.set_nt_acl((fsp)->conn->vfs.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) @@ -204,7 +204,7 @@ /* NT ACL operations. */ #define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc))) -#define SMB_VFS_OPAQUE_GET_NT_ACL(fsp, name, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.get_nt_acl((fsp)->conn->vfs_opaque.handles.get_nt_acl, (fsp), (name), (security_info), (ppdesc))) +#define SMB_VFS_OPAQUE_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs_opaque.ops.get_nt_acl((conn)->vfs_opaque.handles.get_nt_acl, (name), (security_info), (ppdesc))) #define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) #define SMB_VFS_OPAQUE_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.set_nt_acl((fsp)->conn->vfs_opaque.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) @@ -324,7 +324,7 @@ /* NT ACL operations. */ #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc))) -#define SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, ppdesc) ((handle)->vfs_next.ops.get_nt_acl((handle)->vfs_next.handles.get_nt_acl, (fsp), (name), (security_info), (ppdesc))) +#define SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc) ((handle)->vfs_next.ops.get_nt_acl((handle)->vfs_next.handles.get_nt_acl, (name), (security_info), (ppdesc))) #define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) #define SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd) ((handle)->vfs_next.ops.set_nt_acl((handle)->vfs_next.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index 9dd4d7ec93..a14a117229 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -1015,7 +1015,6 @@ static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle, } static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle, - struct files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor **ppdesc) { diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 71f478a8a9..ab48c963ec 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -290,8 +290,7 @@ static NTSTATUS catia_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor **ppdesc) { - return SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, - ppdesc); + return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc); } static NTSTATUS catia_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 3dd3727340..17b183600a 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -956,13 +956,13 @@ static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle, } static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle, - files_struct *fsp, const char *name, + const char *name, uint32 security_info, SEC_DESC **ppdesc) { NTSTATUS result; START_PROFILE(get_nt_acl); - result = posix_get_nt_acl(fsp->conn, fsp->fsp_name, security_info, ppdesc); + result = posix_get_nt_acl(handle->conn, name, security_info, ppdesc); END_PROFILE(get_nt_acl); return result; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index f4aeefbbf0..f6b6e85837 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1547,8 +1547,7 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle, { NTSTATUS result; - result = SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, - ppdesc); + result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc); do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index e7331bef29..24ca3d5e42 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -249,7 +249,7 @@ static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle, } static NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle, - files_struct *fsp, const char *name, + const char *name, uint32 security_info, SEC_DESC **ppdesc) { SMB4ACL_T *pacl = NULL; diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 83893c7aea..060d64cffb 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -189,7 +189,6 @@ static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle, } static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle, - struct files_struct *fsp, const char *name, uint32 security_info, struct security_descriptor **ppdesc) { diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 125ccb4752..43f57a0109 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -2089,7 +2089,6 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC char *filename_in = NULL; char *filename = NULL; char *qualname = NULL; - files_struct *fsp = NULL; SMB_STRUCT_STAT st; NTSTATUS nt_status; struct current_user user; @@ -2149,25 +2148,7 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC goto error_exit; } - nt_status = open_file_stat(conn, NULL, filename, &st, &fsp); - /* Perhaps it is a directory */ - if (NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_IS_A_DIRECTORY)) { - nt_status = open_directory(conn, NULL, filename, &st, - READ_CONTROL_ACCESS, - FILE_SHARE_READ|FILE_SHARE_WRITE, - FILE_OPEN, - 0, - FILE_ATTRIBUTE_DIRECTORY, - NULL, &fsp); - } - - if (!NT_STATUS_IS_OK(nt_status)) { - DEBUG(3,("_srv_net_file_query_secdesc: Unable to open file %s\n", filename)); - r_u->status = ntstatus_to_werror(nt_status); - goto error_exit; - } - - nt_status = SMB_VFS_GET_NT_ACL(fsp, fsp->fsp_name, + nt_status = SMB_VFS_GET_NT_ACL(conn, filename, (OWNER_SECURITY_INFORMATION |GROUP_SECURITY_INFORMATION |DACL_SECURITY_INFORMATION), &psd); @@ -2188,17 +2169,12 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC psd->dacl->revision = (uint16) NT4_ACL_REVISION; - close_file(fsp, NORMAL_CLOSE); unbecome_user(); close_cnum(conn, user.vuid); return r_u->status; error_exit: - if(fsp) { - close_file(fsp, NORMAL_CLOSE); - } - if (became_user) unbecome_user(); diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c index a58bcdd891..964d1af258 100644 --- a/source3/smbd/file_access.c +++ b/source3/smbd/file_access.c @@ -25,67 +25,6 @@ extern struct current_user current_user; #undef DBGC_CLASS #define DBGC_CLASS DBGC_ACLS -/**************************************************************************** - Helper function that gets a security descriptor by connection and - file name. - NOTE: This is transitional, in the sense that SMB_VFS_GET_NT_ACL really - should *not* get a files_struct pointer but a connection_struct ptr - (automatic by the vfs handle) and the file name and _use_ that! -****************************************************************************/ -static NTSTATUS conn_get_nt_acl(TALLOC_CTX *mem_ctx, - struct connection_struct *conn, - const char *fname, - SMB_STRUCT_STAT *psbuf, - struct security_descriptor **psd) -{ - NTSTATUS status; - struct files_struct *fsp = NULL; - struct security_descriptor *secdesc = NULL; - - if (!VALID_STAT(*psbuf)) { - if (SMB_VFS_STAT(conn, fname, psbuf) != 0) { - return map_nt_error_from_unix(errno); - } - } - - /* fake a files_struct ptr: */ - - if (S_ISDIR(psbuf->st_mode)) { - status = open_directory(conn, NULL, fname, psbuf, - READ_CONTROL_ACCESS, - FILE_SHARE_READ|FILE_SHARE_WRITE, - FILE_OPEN, - 0, - FILE_ATTRIBUTE_DIRECTORY, - NULL, &fsp); - } - else { - status = open_file_stat(conn, NULL, fname, psbuf, &fsp); - } - - if (!NT_STATUS_IS_OK(status)) { - DEBUG(3, ("Unable to open file %s: %s\n", fname, - nt_errstr(status))); - return status; - } - - status = SMB_VFS_GET_NT_ACL(fsp, fname, - (OWNER_SECURITY_INFORMATION | - GROUP_SECURITY_INFORMATION | - DACL_SECURITY_INFORMATION), - &secdesc); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(5, ("Unable to get NT ACL for file %s\n", fname)); - goto done; - } - - *psd = talloc_move(mem_ctx, &secdesc); - -done: - close_file(fsp, NORMAL_CLOSE); - return status; -} - static bool can_access_file_acl(struct connection_struct *conn, const char * fname, SMB_STRUCT_STAT *psbuf, uint32_t access_mask) @@ -95,7 +34,11 @@ static bool can_access_file_acl(struct connection_struct *conn, uint32_t access_granted; struct security_descriptor *secdesc = NULL; - status = conn_get_nt_acl(talloc_tos(), conn, fname, psbuf, &secdesc); + status = SMB_VFS_GET_NT_ACL(conn, fname, + (OWNER_SECURITY_INFORMATION | + GROUP_SECURITY_INFORMATION | + DACL_SECURITY_INFORMATION), + &secdesc); if (!NT_STATUS_IS_OK(status)) { DEBUG(5, ("Could not get acl: %s\n", nt_errstr(status))); return false; diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 1fbb681c72..cb98a8139c 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -1640,7 +1640,7 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, } else { status = SMB_VFS_GET_NT_ACL( - fsp, fsp->fsp_name, security_info_wanted, &psd); + conn, fsp->fsp_name, security_info_wanted, &psd); } } diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index d9782cfdb8..d8794e2114 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -3307,7 +3307,7 @@ static NTSTATUS append_parent_acl(files_struct *fsp, return status; } - status = SMB_VFS_GET_NT_ACL(parent_fsp, parent_fsp->fsp_name, + status = SMB_VFS_GET_NT_ACL(parent_fsp->conn, parent_fsp->fsp_name, DACL_SECURITY_INFORMATION, &parent_sd ); close_file(parent_fsp, NORMAL_CLOSE); -- cgit From e3bb148b941e67b5caea3db2c8ef9efc984598fa Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 19 Dec 2007 17:53:14 +0100 Subject: Only retrieve password policies in pam_auth when WBFLAG_PAM_GET_PWD_POLICY is set. This essentially re-establishes r14496 (2155bb0535656f294bd054d6a0a7d16a9a71c31b) which was undone in r17723 (43bd8c00abb38eb23a1497a255d194fb1bbffffb) for reasons that are unclear to me. Maybe I am being too naive. Now we do again only retrieve the password policy when called from the pam_winbind module. This fixes logons delegated to AD trusted domain controllers: We need to connect to the sam to retrieve the password policy. But auhtenticated session setup is not possible when contacting the trusted domain dc and afterwards, SamrConnect also fails with whatever credentials and method used. Michael (This used to be commit 6d765e0de523211a2d0b43a2c4c4117f5f0c662f) --- source3/nsswitch/pam_winbind.c | 1 + source3/nsswitch/winbind_struct_protocol.h | 2 +- source3/winbindd/winbindd_pam.c | 15 +++++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/source3/nsswitch/pam_winbind.c b/source3/nsswitch/pam_winbind.c index f00db39b45..4d019072ac 100644 --- a/source3/nsswitch/pam_winbind.c +++ b/source3/nsswitch/pam_winbind.c @@ -1201,6 +1201,7 @@ static int winbind_auth_request(pam_handle_t * pamh, request.data.auth.uid = -1; request.flags = WBFLAG_PAM_INFO3_TEXT | + WBFLAG_PAM_GET_PWD_POLICY | WBFLAG_PAM_CONTACT_TRUSTDOM; if (ctrl & (WINBIND_KRB5_AUTH|WINBIND_CACHED_LOGIN)) { diff --git a/source3/nsswitch/winbind_struct_protocol.h b/source3/nsswitch/winbind_struct_protocol.h index 5b663c63f7..12ca1e55c8 100644 --- a/source3/nsswitch/winbind_struct_protocol.h +++ b/source3/nsswitch/winbind_struct_protocol.h @@ -194,7 +194,7 @@ typedef struct winbindd_gr { #define WBFLAG_PAM_KRB5 0x00001000 #define WBFLAG_PAM_FALLBACK_AFTER_KRB5 0x00002000 #define WBFLAG_PAM_CACHED_LOGIN 0x00004000 -#define WBFLAG_PAM_GET_PWD_POLICY 0x00008000 /* not used */ +#define WBFLAG_PAM_GET_PWD_POLICY 0x00008000 /* generic request flags */ #define WBFLAG_QUERY_ONLY 0x00000020 /* not used */ diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index 5133239258..7a9014a82f 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -1593,13 +1593,16 @@ process_result: } } - result = fillup_password_policy(domain, state); - if (!NT_STATUS_IS_OK(result) - && !NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED) ) - { - DEBUG(10,("Failed to get password policies: %s\n", nt_errstr(result))); - goto done; + if (state->request.flags & WBFLAG_PAM_GET_PWD_POLICY) { + result = fillup_password_policy(domain, state); + + if (!NT_STATUS_IS_OK(result) + && !NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED) ) + { + DEBUG(10,("Failed to get password policies: %s\n", nt_errstr(result))); + goto done; + } } result = NT_STATUS_OK; -- cgit From d2a9630a8b239118e7fc4b9dcedd860e6b7574f1 Mon Sep 17 00:00:00 2001 From: James Peach Date: Mon, 15 Oct 2007 13:59:37 -0700 Subject: Release per-fsp data on file closure. (This used to be commit 9fead46b54519b3df78a869dbc99207046587d6a) --- source3/smbd/files.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 179963dae9..95f01b88ce 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -460,6 +460,11 @@ void file_free(files_struct *fsp) ZERO_STRUCT(fsp_fi_cache); } + /* Drop all remaining extensions. */ + while (fsp->vfs_extension) { + vfs_remove_fsp_extension(fsp->vfs_extension->owner, fsp); + } + SAFE_FREE(fsp); } -- cgit From 26b75f2d833d7a4ba588e66b5cf6cf3ed8e0b236 Mon Sep 17 00:00:00 2001 From: James Peach Date: Mon, 15 Oct 2007 14:01:12 -0700 Subject: Expose per-fsp extension talloc context. This patch supplements the fsp extension API with an operation to retrieve the malloc zone pointer for that fsp. (This used to be commit d5d9e4084cfb3db3bebff0334b93f376022ef5d3) --- source3/include/vfs.h | 9 +++++++++ source3/smbd/vfs.c | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index e1669a271c..276f820fbc 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -579,12 +579,21 @@ typedef struct vfs_statvfs_struct { /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */ } vfs_statvfs_struct; +/* Add a new FSP extension of the given type. Returns a pointer to the + * extenstion data. + */ #define VFS_ADD_FSP_EXTENSION(handle, fsp, type) \ vfs_add_fsp_extension_notype(handle, (fsp), sizeof(type)) +/* Return a pointer to the existing FSP extension data. */ #define VFS_FETCH_FSP_EXTENSION(handle, fsp) \ vfs_fetch_fsp_extension(handle, (fsp)) +/* Return the talloc context associated with an FSP extension. */ +#define VFS_MEMCTX_FSP_EXTENSION(handle, fsp) \ + vfs_memctx_fsp_extension(handle, (fsp)) + +/* Remove and destroy an FSP extension. */ #define VFS_REMOVE_FSP_EXTENSION(handle, fsp) \ vfs_remove_fsp_extension((handle), (fsp)) diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 45d0788117..96d71da8d9 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -263,19 +263,31 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) } } -void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) +void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) { struct vfs_fsp_data *head; for (head = fsp->vfs_extension; head; head = head->next) { if (head->owner == handle) { - return EXT_DATA_AREA(head); + return head; } } return NULL; } +void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) +{ + struct vfs_fsp_data *head; + + head = vfs_memctx_fsp_extension(handle, fsp); + if (head != NULL) { + return EXT_DATA_AREA(head); + } + + return NULL; +} + #undef EXT_DATA_AREA /***************************************************************** -- cgit From 2403b319a76c3b425d618a3ff937e7ff05d211b4 Mon Sep 17 00:00:00 2001 From: James Peach Date: Mon, 15 Oct 2007 14:03:40 -0700 Subject: Add filesystem capabilities bitmask to statfs info. This patch adds Darwin support for the Samba statfs VFS call. It also adds a filesystem capabilities bitmask to the information returned by the call. (This used to be commit 555173eb3f6511e88798d6ef3d1fed0c219a9921) --- source3/include/vfs.h | 2 ++ source3/smbd/statvfs.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 276f820fbc..5a3ec58b7a 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -577,6 +577,8 @@ typedef struct vfs_statvfs_struct { SMB_BIG_UINT FsIdentifier; /* fsid */ /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */ /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */ + + int FsCapabilities; } vfs_statvfs_struct; /* Add a new FSP extension of the given type. Returns a pointer to the diff --git a/source3/smbd/statvfs.c b/source3/smbd/statvfs.c index f6663208ea..5fc0afdd79 100644 --- a/source3/smbd/statvfs.c +++ b/source3/smbd/statvfs.c @@ -3,6 +3,7 @@ VFS API's statvfs abstraction Copyright (C) Alexander Bokovoy 2005 Copyright (C) Steve French 2005 + Copyright (C) James Peach 2006 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,11 +38,93 @@ static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf) statbuf->TotalFileNodes = statvfs_buf.f_files; statbuf->FreeFileNodes = statvfs_buf.f_ffree; statbuf->FsIdentifier = statvfs_buf.f_fsid; + + /* Good defaults for Linux filesystems are case sensitive + * and case preserving. + */ + statbuf->FsCapabilities = + FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVING_NAMES; } return result; } #endif +#if defined(DARWINOS) + +#include + +static int darwin_fs_capabilities(const char * path) +{ + int caps = 0; + vol_capabilities_attr_t *vcaps; + struct attrlist attrlist; + char attrbuf[sizeof(u_int32_t) + sizeof(vol_capabilities_attr_t)]; + +#define FORMAT_CAP(vinfo, cap) \ + ( ((vinfo)->valid[VOL_CAPABILITIES_FORMAT] & (cap)) && \ + ((vinfo)->capabilities[VOL_CAPABILITIES_FORMAT] & (cap)) ) + +#define INTERFACE_CAP(vinfo, cap) \ + ( ((vinfo)->valid[VOL_CAPABILITIES_INTERFACES] & (cap)) && \ + ((vinfo)->capabilities[VOL_CAPABILITIES_INTERFACES] & (cap)) ) + + ZERO_STRUCT(attrlist); + attrlist.bitmapcount = ATTR_BIT_MAP_COUNT; + attrlist.volattr = ATTR_VOL_CAPABILITIES; + + if (getattrlist(path, &attrlist, attrbuf, sizeof(attrbuf), 0) != 0) { + DEBUG(0, ("getattrlist for %s capabilities failed: %s\n", + path, strerror(errno))); + /* Return no capabilities on failure. */ + return 0; + } + + vcaps = + (vol_capabilities_attr_t *)(attrbuf + sizeof(u_int32_t)); + + if (FORMAT_CAP(vcaps, VOL_CAP_FMT_SPARSE_FILES)) { + caps |= FILE_SUPPORTS_SPARSE_FILES; + } + + if (FORMAT_CAP(vcaps, VOL_CAP_FMT_CASE_SENSITIVE)) { + caps |= FILE_CASE_SENSITIVE_SEARCH; + } + + if (FORMAT_CAP(vcaps, VOL_CAP_FMT_CASE_PRESERVING)) { + caps |= FILE_CASE_PRESERVED_NAMES; + } + + if (INTERFACE_CAP(vcaps, VOL_CAP_INT_EXTENDED_SECURITY)) { + caps |= FILE_PERSISTENT_ACLS; + } + + return caps; +} + +static int darwin_statvfs(const char *path, vfs_statvfs_struct *statbuf) +{ + struct statfs sbuf; + int ret; + + ret = statfs(path, &sbuf); + if (ret != 0) { + return ret; + } + + statbuf->OptimalTransferSize = sbuf.f_iosize; + statbuf->BlockSize = sbuf.f_bsize; + statbuf->TotalBlocks = sbuf.f_blocks; + statbuf->BlocksAvail = sbuf.f_bfree; + statbuf->UserBlocksAvail = sbuf.f_bavail; + statbuf->TotalFileNodes = sbuf.f_files; + statbuf->FreeFileNodes = sbuf.f_ffree; + statbuf->FsIdentifier = *(SMB_BIG_UINT *)(&sbuf.f_fsid); /* Ick. */ + statbuf->FsCapabilities = darwin_fs_capabilities(sbuf.f_mntonname); + + return 0; +} +#endif + /* sys_statvfs() is an abstraction layer over system-dependent statvfs()/statfs() for particular POSIX systems. Due to controversy of what is considered more important @@ -52,6 +135,8 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf) { #if defined(LINUX) && defined(HAVE_FSID_INT) return linux_statvfs(path, statbuf); +#elif defined(DARWINOS) + return darwin_statvfs(path, statbuf); #else /* BB change this to return invalid level */ #ifdef EOPNOTSUPP -- cgit From 2ee96c7ee30ece5eeec97b545ac0f98fc3c00060 Mon Sep 17 00:00:00 2001 From: James Peach Date: Wed, 19 Dec 2007 22:33:43 -0800 Subject: Fix a couple of warnings in mDNS registration. One of these is an actual bug where we pass a pointer instead of a pointer to a pointer. (This used to be commit 36db6755103f01cb74bf4194fc81ca6d4b5320e4) --- source3/smbd/dnsregister.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/smbd/dnsregister.c b/source3/smbd/dnsregister.c index 44bd39f64e..2319097ca5 100644 --- a/source3/smbd/dnsregister.c +++ b/source3/smbd/dnsregister.c @@ -41,7 +41,6 @@ struct dns_reg_state { void dns_register_close(struct dns_reg_state **dns_state_ptr) { - int mdnsd_conn_fd; struct dns_reg_state *dns_state = *dns_state_ptr; if (dns_state == NULL) { @@ -74,7 +73,7 @@ static void dns_register_smbd_retry(struct event_context *ctx, /* Clear previous registration state to force new * registration attempt. Clears event handler. */ - dns_register_close(dns_state); + dns_register_close(&dns_state); } static void schedule_dns_register_smbd_retry(struct dns_reg_state *dns_state, -- cgit From a32329297dbce22617960d112d94b6a5d2989e1f Mon Sep 17 00:00:00 2001 From: James Peach Date: Wed, 19 Dec 2007 22:39:40 -0800 Subject: Remove unused variable 'didmsg'. (This used to be commit 5de89dd6e0a8a56a5a0f998e3b1d3538367db7d6) --- source3/modules/vfs_readahead.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source3/modules/vfs_readahead.c b/source3/modules/vfs_readahead.c index 5b663a7b26..8fdd6168fe 100644 --- a/source3/modules/vfs_readahead.c +++ b/source3/modules/vfs_readahead.c @@ -17,10 +17,6 @@ #include "includes.h" -#if !defined(HAVE_LINUX_READAHEAD) && !defined(HAVE_POSIX_FADVISE) -static bool didmsg; -#endif - struct readahead_data { SMB_OFF_T off_bound; SMB_OFF_T len; -- cgit From 8804f5bdd7cbc0bc8166c7a4a9a09fbcb4402afd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 10:33:13 +0100 Subject: Attempt to fix the build James, at least on my Linux system neither FILE_CASE_SENSITIVE_SEARCH nor FILE_CASE_PRESERVING_NAMES seem to be defined anywhere. Is it possible that this is a MacOS/X specific thing? If so, could you add configure tests for this? Thanks, Volker (This used to be commit 465fd4385013c95f9778d710d70796feae4eb858) --- source3/smbd/statvfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/smbd/statvfs.c b/source3/smbd/statvfs.c index 5fc0afdd79..431489032c 100644 --- a/source3/smbd/statvfs.c +++ b/source3/smbd/statvfs.c @@ -39,11 +39,13 @@ static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf) statbuf->FreeFileNodes = statvfs_buf.f_ffree; statbuf->FsIdentifier = statvfs_buf.f_fsid; +#if defined(FILE_CASE_SENSITIVE_SEARCH) && defined(FILE_CASE_PRESERVING_NAMES) /* Good defaults for Linux filesystems are case sensitive * and case preserving. */ statbuf->FsCapabilities = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVING_NAMES; +#endif } return result; } -- cgit From 4c3c483fbfd870335f77ab610eb7230639d3d258 Mon Sep 17 00:00:00 2001 From: James Peach Date: Thu, 20 Dec 2007 08:31:27 -0800 Subject: Fix typo in filesystem capabilities bits. (This used to be commit 08fee0d28a20648d74c6b03d120eaf628f4de70c) --- source3/smbd/statvfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source3/smbd/statvfs.c b/source3/smbd/statvfs.c index 431489032c..0e9a2c2ebe 100644 --- a/source3/smbd/statvfs.c +++ b/source3/smbd/statvfs.c @@ -39,13 +39,11 @@ static int linux_statvfs(const char *path, vfs_statvfs_struct *statbuf) statbuf->FreeFileNodes = statvfs_buf.f_ffree; statbuf->FsIdentifier = statvfs_buf.f_fsid; -#if defined(FILE_CASE_SENSITIVE_SEARCH) && defined(FILE_CASE_PRESERVING_NAMES) /* Good defaults for Linux filesystems are case sensitive * and case preserving. */ statbuf->FsCapabilities = - FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVING_NAMES; -#endif + FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES; } return result; } -- cgit From df133758c2496a5c99441635eca6b77c9019cb8c Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Thu, 20 Dec 2007 14:57:29 -0800 Subject: fix dump printout when byte >= 0x80 (This used to be commit e18fab269c7370a6670c56eeab60fd90feecf0b2) --- source3/lib/tdb/tools/tdbtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/tdb/tools/tdbtool.c b/source3/lib/tdb/tools/tdbtool.c index 79435a3571..d104ccd7c4 100644 --- a/source3/lib/tdb/tools/tdbtool.c +++ b/source3/lib/tdb/tools/tdbtool.c @@ -135,7 +135,7 @@ static void print_data(const char *buf,int len) if (len<=0) return; printf("[%03X] ",i); for (i=0;i Date: Thu, 20 Dec 2007 10:55:45 +0100 Subject: Add a global cache It hurts, but I think this global variable is necessary for transition, and it has the potential to remove quite a few other global variables without messing with APIs too much. (This used to be commit c131d0dc52ec09c9227eff3d68877369c37aaed5) --- source3/include/memcache.h | 2 ++ source3/lib/memcache.c | 36 ++++++++++++++++++++++++++++++++++++ source3/smbd/server.c | 6 ++++++ 3 files changed, 44 insertions(+) diff --git a/source3/include/memcache.h b/source3/include/memcache.h index f849f8ad3b..0ba3bdbb00 100644 --- a/source3/include/memcache.h +++ b/source3/include/memcache.h @@ -37,6 +37,8 @@ enum memcache_number { struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size); +void memcache_set_global(struct memcache *cache); + void memcache_add(struct memcache *cache, enum memcache_number n, DATA_BLOB key, DATA_BLOB value); diff --git a/source3/lib/memcache.c b/source3/lib/memcache.c index 17630066ae..38bbd66085 100644 --- a/source3/lib/memcache.c +++ b/source3/lib/memcache.c @@ -20,6 +20,8 @@ #include "memcache.h" #include "rbtree.h" +static struct memcache *global_cache; + struct memcache_element { struct rb_node rb_node; struct memcache_element *prev, *next; @@ -58,6 +60,12 @@ struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size) return result; } +void memcache_set_global(struct memcache *cache) +{ + TALLOC_FREE(global_cache); + global_cache = cache; +} + static struct memcache_element *memcache_node2elem(struct rb_node *node) { return (struct memcache_element *) @@ -119,6 +127,13 @@ bool memcache_lookup(struct memcache *cache, enum memcache_number n, { struct memcache_element *e; + if (cache == NULL) { + cache = global_cache; + } + if (cache == NULL) { + return false; + } + e = memcache_find(cache, n, key); if (e == NULL) { return false; @@ -172,6 +187,13 @@ void memcache_delete(struct memcache *cache, enum memcache_number n, { struct memcache_element *e; + if (cache == NULL) { + cache = global_cache; + } + if (cache == NULL) { + return; + } + e = memcache_find(cache, n, key); if (e == NULL) { return; @@ -189,6 +211,13 @@ void memcache_add(struct memcache *cache, enum memcache_number n, DATA_BLOB cache_key, cache_value; size_t element_size; + if (cache == NULL) { + cache = global_cache; + } + if (cache == NULL) { + return; + } + if (key.length == 0) { return; } @@ -258,6 +287,13 @@ void memcache_flush(struct memcache *cache, enum memcache_number n) { struct rb_node *node; + if (cache == NULL) { + cache = global_cache; + } + if (cache == NULL) { + return; + } + /* * Find the smallest element of number n */ diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 40037074f6..43a6d62a28 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1191,6 +1191,12 @@ extern void build_options(bool screen); if (smbd_messaging_context() == NULL) exit(1); + if (smbd_memcache() == NULL) { + exit(1); + } + + memcache_set_global(smbd_memcache()); + /* Initialise the password backed before the global_sam_sid to ensure that we fetch from ldap before we make a domain sid up */ -- cgit From d3d870cc07447cf08a776c714a39f40f9c72da2c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 14:41:58 +0100 Subject: Add memcache_add_talloc The first memcache API only had blobs, but we have quite a few objects that are more complex talloc'ed structues. The current one I'm looking at is the getpwnam cache, but there are others around. (This used to be commit ea0e5ad9a15c848904dee8cb2d3e392b6a894705) --- source3/include/memcache.h | 8 ++++++- source3/lib/memcache.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/source3/include/memcache.h b/source3/include/memcache.h index 0ba3bdbb00..36cde98bd3 100644 --- a/source3/include/memcache.h +++ b/source3/include/memcache.h @@ -31,7 +31,7 @@ enum memcache_number { GID_SID_CACHE, SID_GID_CACHE, GETWD_CACHE, - GETPWNAM_CACHE, + GETPWNAM_CACHE, /* talloc */ MANGLE_HASH2_CACHE }; @@ -42,12 +42,18 @@ void memcache_set_global(struct memcache *cache); void memcache_add(struct memcache *cache, enum memcache_number n, DATA_BLOB key, DATA_BLOB value); +void memcache_add_talloc(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, void *ptr); + void memcache_delete(struct memcache *cache, enum memcache_number n, DATA_BLOB key); bool memcache_lookup(struct memcache *cache, enum memcache_number n, DATA_BLOB key, DATA_BLOB *value); +void *memcache_lookup_talloc(struct memcache *cache, enum memcache_number n, + DATA_BLOB key); + void memcache_flush(struct memcache *cache, enum memcache_number n); #endif diff --git a/source3/lib/memcache.c b/source3/lib/memcache.c index 38bbd66085..192a822cde 100644 --- a/source3/lib/memcache.c +++ b/source3/lib/memcache.c @@ -37,11 +37,38 @@ struct memcache { size_t max_size; }; +static void memcache_element_parse(struct memcache_element *e, + DATA_BLOB *key, DATA_BLOB *value); + +static bool memcache_is_talloc(enum memcache_number n) +{ + bool result; + + switch (n) { + case GETPWNAM_CACHE: + result = true; + break; + default: + result = false; + break; + } + + return result; +} + static int memcache_destructor(struct memcache *cache) { struct memcache_element *e, *next; for (e = cache->mru; e != NULL; e = next) { next = e->next; + if (memcache_is_talloc(e->n) + && (e->valuelength == sizeof(void *))) { + DATA_BLOB key, value; + void *ptr; + memcache_element_parse(e, &key, &value); + memcpy(&ptr, value.data, sizeof(ptr)); + TALLOC_FREE(ptr); + } SAFE_FREE(e); } return 0; @@ -156,6 +183,25 @@ bool memcache_lookup(struct memcache *cache, enum memcache_number n, return true; } +void *memcache_lookup_talloc(struct memcache *cache, enum memcache_number n, + DATA_BLOB key) +{ + DATA_BLOB value; + void *result; + + if (!memcache_lookup(cache, n, key, &value)) { + return NULL; + } + + if (value.length != sizeof(result)) { + return NULL; + } + + memcpy(&result, value.data, sizeof(result)); + + return result; +} + static void memcache_delete_element(struct memcache *cache, struct memcache_element *e) { @@ -283,6 +329,12 @@ void memcache_add(struct memcache *cache, enum memcache_number n, memcache_trim(cache); } +void memcache_add_talloc(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, void *ptr) +{ + return memcache_add(cache, n, key, data_blob_const(&ptr, sizeof(ptr))); +} + void memcache_flush(struct memcache *cache, enum memcache_number n) { struct rb_node *node; -- cgit From 44d086a15f4908a01d0c719498fde953bd4809e7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 14:54:33 +0100 Subject: Convert the pwnam cache to memcache (This used to be commit 032c5589fe7f9f2fcb0f336e72517a81a720b6ce) --- source3/lib/util_pw.c | 68 ++++++++++++--------------------------------------- 1 file changed, 15 insertions(+), 53 deletions(-) diff --git a/source3/lib/util_pw.c b/source3/lib/util_pw.c index 1973626d84..428378505f 100644 --- a/source3/lib/util_pw.c +++ b/source3/lib/util_pw.c @@ -37,74 +37,36 @@ struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) return ret; } -#define PWNAMCACHE_SIZE 4 -static struct passwd **pwnam_cache = NULL; - -static void init_pwnam_cache(void) -{ - if (pwnam_cache != NULL) - return; - - pwnam_cache = TALLOC_ZERO_ARRAY(NULL, struct passwd *, - PWNAMCACHE_SIZE); - if (pwnam_cache == NULL) { - smb_panic("Could not init pwnam_cache"); - } - - return; -} - void flush_pwnam_cache(void) { - TALLOC_FREE(pwnam_cache); - pwnam_cache = NULL; - init_pwnam_cache(); + memcache_flush(NULL, GETPWNAM_CACHE); } struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name) { - int i; - - struct passwd *temp; + struct passwd *temp, *cached; - init_pwnam_cache(); - - for (i=0; ipw_name) == 0)) { - DEBUG(10, ("Got %s from pwnam_cache\n", name)); - return tcopy_passwd(mem_ctx, pwnam_cache[i]); - } + temp = (struct passwd *)memcache_lookup_talloc( + NULL, GETPWNAM_CACHE, data_blob_string_const(name)); + if (temp != NULL) { + return tcopy_passwd(mem_ctx, temp); } temp = sys_getpwnam(name); - - if (!temp) { -#if 0 - if (errno == ENOMEM) { - /* what now? */ - } -#endif + if (temp == NULL) { return NULL; } - for (i=0; i Date: Wed, 19 Dec 2007 21:59:28 +0100 Subject: Remove next_token_nr_talloc and its associated global Only client.c and clitar.c used this, I think they should carry the static themselves. Also move the a bit funny routine toktocliplist to clitar.c, the only place where it is used. (This used to be commit 86d9412611fd99c21e15c71d30a3f95e35d8535b) --- source3/client/client.c | 139 ++++++++++++++++++++++++------------------------ source3/client/clitar.c | 60 +++++++++++++++++++-- source3/lib/util_str.c | 77 --------------------------- 3 files changed, 124 insertions(+), 152 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 97d7cf0e0b..f761d92bac 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -41,6 +41,7 @@ static char *desthost; static char *calling_name; static bool grepable = false; static char *cmdstr = NULL; +static const char *cmd_ptr = NULL; static int io_bufsize = 64512; @@ -425,7 +426,7 @@ static int cmd_cd(void) char *buf = NULL; int rc = 0; - if (next_token_nr_talloc(talloc_tos(), NULL, &buf,NULL)) { + if (next_token_talloc(talloc_tos(), &cmd_ptr, &buf,NULL)) { rc = do_cd(buf); } else { d_printf("Current directory is %s\n",client_get_cur_dir()); @@ -863,7 +864,7 @@ static int cmd_dir(void) return 1; } - if (next_token_nr_talloc(ctx, NULL,&buf,NULL)) { + if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { string_replace(buf,'/','\\'); if (*buf == CLI_DIRSEP_CHAR) { mask = talloc_strdup(ctx, buf + 1); @@ -915,7 +916,7 @@ static int cmd_du(void) } } - if (next_token_nr_talloc(ctx, NULL,&buf,NULL)) { + if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { string_replace(buf,'/','\\'); if (*buf == CLI_DIRSEP_CHAR) { mask = talloc_strdup(ctx, buf); @@ -941,8 +942,8 @@ static int cmd_echo(void) char *num; char *data; - if (!next_token_nr_talloc(ctx, NULL, &num, NULL) - || !next_token_nr_talloc(ctx, NULL, &data, NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr, &num, NULL) + || !next_token_talloc(ctx, &cmd_ptr, &data, NULL)) { d_printf("echo \n"); return 1; } @@ -1116,7 +1117,7 @@ static int cmd_get(void) return 1; } - if (!next_token_nr_talloc(ctx, NULL,&fname,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&fname,NULL)) { d_printf("get [localname]\n"); return 1; } @@ -1129,7 +1130,7 @@ static int cmd_get(void) return 1; } - next_token_nr_talloc(ctx, NULL,&lname,NULL); + next_token_talloc(ctx, &cmd_ptr,&lname,NULL); if (!lname) { lname = fname; } @@ -1277,7 +1278,7 @@ static int cmd_more(void) } close(fd); - if (!next_token_nr_talloc(ctx,NULL,&fname,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&fname,NULL)) { d_printf("more \n"); unlink(lname); return 1; @@ -1325,7 +1326,7 @@ static int cmd_mget(void) abort_mget = false; - while (next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { mget_mask = talloc_strdup(ctx, client_get_cur_dir()); if (!mget_mask) { return 1; @@ -1442,7 +1443,7 @@ static int cmd_mkdir(void) return 1; } - if (!next_token_nr_talloc(ctx, NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { if (!recurse) { d_printf("mkdir \n"); } @@ -1511,7 +1512,7 @@ static int cmd_altname(void) return 1; } - if (!next_token_nr_talloc(ctx, NULL, &buf, NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) { d_printf("altname \n"); return 1; } @@ -1677,12 +1678,12 @@ static int cmd_put(void) return 1; } - if (!next_token_nr_talloc(ctx,NULL,&lname,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&lname,NULL)) { d_printf("put \n"); return 1; } - if (next_token_nr_talloc(ctx, NULL,&buf,NULL)) { + if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { rname = talloc_asprintf_append(rname, buf); } else { rname = talloc_asprintf_append(rname, lname); @@ -1762,7 +1763,7 @@ static int cmd_select(void) { TALLOC_CTX *ctx = talloc_tos(); char *new_fs = NULL; - next_token_nr_talloc(ctx, NULL,&new_fs,NULL) + next_token_talloc(ctx, &cmd_ptr,&new_fs,NULL) ; if (new_fs) { client_set_fileselection(new_fs); @@ -1848,7 +1849,7 @@ static int cmd_mput(void) TALLOC_CTX *ctx = talloc_tos(); char *p = NULL; - while (next_token_nr_talloc(ctx, NULL,&p,NULL)) { + while (next_token_talloc(ctx, &cmd_ptr,&p,NULL)) { int ret; struct file_list *temp_list; char *quest, *lname, *rname; @@ -1959,14 +1960,14 @@ static int cmd_cancel(void) char *buf = NULL; int job; - if (!next_token_nr_talloc(ctx, NULL, &buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr, &buf,NULL)) { d_printf("cancel ...\n"); return 1; } do { job = atoi(buf); do_cancel(job); - } while (next_token_nr_talloc(ctx,NULL,&buf,NULL)); + } while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)); return 0; } @@ -1982,7 +1983,7 @@ static int cmd_print(void) char *rname = NULL; char *p = NULL; - if (!next_token_nr_talloc(ctx, NULL, &lname,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr, &lname,NULL)) { d_printf("print \n"); return 1; } @@ -2078,7 +2079,7 @@ static int cmd_del(void) if (!mask) { return 1; } - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("del \n"); return 1; } @@ -2104,14 +2105,14 @@ static int cmd_wdel(void) struct cli_state *targetcli; char *targetname = NULL; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("wdel 0x \n"); return 1; } attribute = (uint16)strtol(buf, (char **)NULL, 16); - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("wdel 0x \n"); return 1; } @@ -2146,7 +2147,7 @@ static int cmd_open(void) struct cli_state *targetcli; int fnum; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("open \n"); return 1; } @@ -2190,7 +2191,7 @@ static int cmd_posix_open(void) mode_t mode; int fnum; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("posix_open 0\n"); return 1; } @@ -2202,7 +2203,7 @@ static int cmd_posix_open(void) return 1; } - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("posix_open 0\n"); return 1; } @@ -2238,7 +2239,7 @@ static int cmd_posix_mkdir(void) mode_t mode; int fnum; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("posix_mkdir 0\n"); return 1; } @@ -2250,7 +2251,7 @@ static int cmd_posix_mkdir(void) return 1; } - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("posix_mkdir 0\n"); return 1; } @@ -2278,7 +2279,7 @@ static int cmd_posix_unlink(void) char *targetname = NULL; struct cli_state *targetcli; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("posix_unlink \n"); return 1; } @@ -2312,7 +2313,7 @@ static int cmd_posix_rmdir(void) char *targetname = NULL; struct cli_state *targetcli; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("posix_rmdir \n"); return 1; } @@ -2344,7 +2345,7 @@ static int cmd_close(void) char *buf = NULL; int fnum; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("close \n"); return 1; } @@ -2451,13 +2452,13 @@ static int cmd_lock(void) enum brl_type lock_type; int fnum; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("lock [r|w] \n"); return 1; } fnum = atoi(buf); - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("lock [r|w] \n"); return 1; } @@ -2471,14 +2472,14 @@ static int cmd_lock(void) return 1; } - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("lock [r|w] \n"); return 1; } start = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16); - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("lock [r|w] \n"); return 1; } @@ -2499,20 +2500,20 @@ static int cmd_unlock(void) SMB_BIG_UINT start, len; int fnum; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("unlock \n"); return 1; } fnum = atoi(buf); - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("unlock \n"); return 1; } start = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16); - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("unlock \n"); return 1; } @@ -2539,7 +2540,7 @@ static int cmd_rmdir(void) char *targetname = NULL; struct cli_state *targetcli; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("rmdir \n"); return 1; } @@ -2578,8 +2579,8 @@ static int cmd_link(void) char *targetname = NULL; struct cli_state *targetcli; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) || - !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) || + !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) { d_printf("link \n"); return 1; } @@ -2629,8 +2630,8 @@ static int cmd_symlink(void) char *targetname = NULL; struct cli_state *targetcli; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) || - !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) || + !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) { d_printf("symlink \n"); return 1; } @@ -2682,8 +2683,8 @@ static int cmd_chmod(void) struct cli_state *targetcli; mode_t mode; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) || - !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) || + !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) { d_printf("chmod mode file\n"); return 1; } @@ -2838,7 +2839,7 @@ static int cmd_getfacl(void) uint16 num_dir_acls = 0; uint16 i; - if (!next_token_nr_talloc(ctx,NULL,&name,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&name,NULL)) { d_printf("getfacl filename\n"); return 1; } @@ -3004,7 +3005,7 @@ static int cmd_stat(void) SMB_STRUCT_STAT sbuf; struct tm *lt; - if (!next_token_nr_talloc(ctx,NULL,&name,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&name,NULL)) { d_printf("stat file\n"); return 1; } @@ -3100,9 +3101,9 @@ static int cmd_chown(void) struct cli_state *targetcli; char *targetname = NULL; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) || - !next_token_nr_talloc(ctx,NULL,&buf2,NULL) || - !next_token_nr_talloc(ctx,NULL,&buf3,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) || + !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL) || + !next_token_talloc(ctx, &cmd_ptr,&buf3,NULL)) { d_printf("chown uid gid file\n"); return 1; } @@ -3149,8 +3150,8 @@ static int cmd_rename(void) char *targetsrc; char *targetdest; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) || - !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) || + !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) { d_printf("rename \n"); return 1; } @@ -3224,8 +3225,8 @@ static int cmd_hardlink(void) struct cli_state *targetcli; char *targetname; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) || - !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) || + !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) { d_printf("hardlink \n"); return 1; } @@ -3281,7 +3282,7 @@ static int cmd_newer(void) bool ok; SMB_STRUCT_STAT sbuf; - ok = next_token_nr_talloc(ctx,NULL,&buf,NULL); + ok = next_token_talloc(ctx, &cmd_ptr,&buf,NULL); if (ok && (sys_stat(buf,&sbuf) == 0)) { newer_than = sbuf.st_mtime; DEBUG(1,("Getting files newer than %s", @@ -3307,7 +3308,7 @@ static int cmd_archive(void) TALLOC_CTX *ctx = talloc_tos(); char *buf; - if (next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { archive_level = atoi(buf); } else { d_printf("Archive level is %d\n",archive_level); @@ -3386,7 +3387,7 @@ static int cmd_lcd(void) char *buf; char *d; - if (next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { chdir(buf); } d = TALLOC_ARRAY(ctx, char, PATH_MAX+1); @@ -3417,7 +3418,7 @@ static int cmd_reget(void) return 1; } - if (!next_token_nr_talloc(ctx, NULL, &fname, NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr, &fname, NULL)) { d_printf("reget \n"); return 1; } @@ -3431,7 +3432,7 @@ static int cmd_reget(void) } local_name = fname; - next_token_nr_talloc(ctx, NULL, &p, NULL); + next_token_talloc(ctx, &cmd_ptr, &p, NULL); if (p) { local_name = p; } @@ -3459,7 +3460,7 @@ static int cmd_reput(void) return 1; } - if (!next_token_nr_talloc(ctx, NULL, &local_name, NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr, &local_name, NULL)) { d_printf("reput \n"); return 1; } @@ -3469,7 +3470,7 @@ static int cmd_reput(void) return 1; } - if (next_token_nr_talloc(ctx, NULL, &buf, NULL)) { + if (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) { remote_name = talloc_asprintf_append(remote_name, buf); } else { @@ -3643,7 +3644,7 @@ static int cmd_vuid(void) TALLOC_CTX *ctx = talloc_tos(); char *buf; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("Current VUID is %d\n", cli->vuid); return 0; } @@ -3661,12 +3662,12 @@ static int cmd_logon(void) TALLOC_CTX *ctx = talloc_tos(); char *l_username, *l_password; - if (!next_token_nr_talloc(ctx,NULL,&l_username,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&l_username,NULL)) { d_printf("logon []\n"); return 0; } - if (!next_token_nr_talloc(ctx,NULL,&l_password,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&l_password,NULL)) { char *pass = getpass("Password: "); if (pass) { l_password = talloc_strdup(ctx,pass); @@ -3729,7 +3730,7 @@ int cmd_iosize(void) char *buf; int iosize; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { d_printf("iosize or iosize 0x. " "Minimum is 16384 (0x4000), " "max is 16776960 (0xFFFF00)\n"); @@ -3882,7 +3883,7 @@ static int cmd_help(void) int i=0,j; char *buf; - if (next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { if ((i = process_tok(buf)) >= 0) d_printf("HELP %s:\n\t%s\n\n", commands[i].name,commands[i].description); @@ -3922,7 +3923,6 @@ static int process_command_string(const char *cmd_in) while (cmd[0] != '\0') { char *line; - const char *ptr; char *p; char *tok; int i; @@ -3937,8 +3937,8 @@ static int process_command_string(const char *cmd_in) } /* and get the first part of the command */ - ptr = line; - if (!next_token_nr_talloc(ctx,&ptr,&tok,NULL)) { + cmd_ptr = line; + if (!next_token_talloc(ctx, &cmd_ptr,&tok,NULL)) { continue; } @@ -4282,7 +4282,6 @@ static void readline_callback(void) static int process_stdin(void) { - const char *ptr; int rc = 0; while (1) { @@ -4313,8 +4312,8 @@ static int process_stdin(void) } /* and get the first part of the command */ - ptr = line; - if (!next_token_nr_talloc(frame,&ptr,&tok,NULL)) { + cmd_ptr = line; + if (!next_token_talloc(frame, &cmd_ptr,&tok,NULL)) { TALLOC_FREE(frame); SAFE_FREE(line); continue; diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 0b4a8b2943..135815c3cd 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -100,6 +100,7 @@ char tar_type='\0'; static char **cliplist=NULL; static int clipn=0; static bool must_free_cliplist = False; +static const char *cmd_ptr = NULL; extern bool lowercase; extern uint16 cnum; @@ -1273,7 +1274,7 @@ int cmd_block(void) char *buf; int block; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { DEBUG(0, ("blocksize \n")); return 1; } @@ -1298,7 +1299,7 @@ int cmd_tarmode(void) TALLOC_CTX *ctx = talloc_tos(); char *buf; - while (next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { if (strequal(buf, "full")) tar_inc=False; else if (strequal(buf, "inc")) @@ -1348,7 +1349,7 @@ int cmd_setmode(void) attra[0] = attra[1] = 0; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { DEBUG(0, ("setmode <[+|-]rsha>\n")); return 1; } @@ -1361,7 +1362,7 @@ int cmd_setmode(void) return 1; } - while (next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { q=buf; while(*q) { @@ -1402,6 +1403,55 @@ int cmd_setmode(void) return 0; } +/** + Convert list of tokens to array; dependent on above routine. + Uses the global cmd_ptr from above - bit of a hack. +**/ + +static char **toktocliplist(int *ctok, const char *sep) +{ + char *s=(char *)cmd_ptr; + int ictok=0; + char **ret, **iret; + + if (!sep) + sep = " \t\n\r"; + + while(*s && strchr_m(sep,*s)) + s++; + + /* nothing left? */ + if (!*s) + return(NULL); + + do { + ictok++; + while(*s && (!strchr_m(sep,*s))) + s++; + while(*s && strchr_m(sep,*s)) + *s++=0; + } while(*s); + + *ctok=ictok; + s=(char *)cmd_ptr; + + if (!(ret=iret=SMB_MALLOC_ARRAY(char *,ictok+1))) + return NULL; + + while(ictok--) { + *iret++=s; + if (ictok > 0) { + while(*s++) + ; + while(!*s) + s++; + } + } + + ret[*ctok] = NULL; + return ret; +} + /**************************************************************************** Principal command for creating / extracting ***************************************************************************/ @@ -1414,7 +1464,7 @@ int cmd_tar(void) int argcl = 0; int ret; - if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) { + if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { DEBUG(0,("tar [IXbgan] \n")); return 1; } diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index ee76e33de8..7e21fe1195 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -136,83 +136,6 @@ bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx, return next_token_internal_talloc(ctx, ptr, pp_buff, sep, false); } -/** -This is like next_token but is not re-entrant and "remembers" the first -parameter so you can pass NULL. This is useful for user interface code -but beware the fact that it is not re-entrant! -**/ - -static const char *last_ptr=NULL; - -bool next_token_nr_talloc(TALLOC_CTX *ctx, - const char **ptr, - char **pp_buff, - const char *sep) -{ - bool ret; - if (!ptr) { - ptr = &last_ptr; - } - - ret = next_token_talloc(ctx, ptr, pp_buff, sep); - last_ptr = *ptr; - return ret; -} - -void set_first_token(char *ptr) -{ - last_ptr = ptr; -} - -/** - Convert list of tokens to array; dependent on above routine. - Uses last_ptr from above - bit of a hack. -**/ - -char **toktocliplist(int *ctok, const char *sep) -{ - char *s=(char *)last_ptr; - int ictok=0; - char **ret, **iret; - - if (!sep) - sep = " \t\n\r"; - - while(*s && strchr_m(sep,*s)) - s++; - - /* nothing left? */ - if (!*s) - return(NULL); - - do { - ictok++; - while(*s && (!strchr_m(sep,*s))) - s++; - while(*s && strchr_m(sep,*s)) - *s++=0; - } while(*s); - - *ctok=ictok; - s=(char *)last_ptr; - - if (!(ret=iret=SMB_MALLOC_ARRAY(char *,ictok+1))) - return NULL; - - while(ictok--) { - *iret++=s; - if (ictok > 0) { - while(*s++) - ; - while(!*s) - s++; - } - } - - ret[*ctok] = NULL; - return ret; -} - /** * Case insensitive string compararison. * -- cgit From 0565bc733566462bace3bf9dd17a6fe6cbe87db5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 15:16:25 +0100 Subject: Make data_blob_string_const return null terminated strings ... nobody was using it, so we're free to change it now :-) (This used to be commit 4b06c68482247d859ec30b8b1920706e43358989) --- source3/lib/data_blob.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c index e64e6a19a1..8bbbc32d7b 100644 --- a/source3/lib/data_blob.c +++ b/source3/lib/data_blob.c @@ -128,7 +128,7 @@ DATA_BLOB data_blob_string_const(const char *str) { DATA_BLOB blob; blob.data = CONST_DISCARD(uint8 *, str); - blob.length = strlen(str); + blob.length = strlen(str) + 1; blob.free = NULL; return blob; } -- cgit From 89f7883fe9b62248e8cc9e508ddef3a26330f71c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 16:05:57 +0100 Subject: Add a singleton cache First user is yp_default_domain (This used to be commit c19363eb77fcc3e1bf3341e6373d38f1e91fc08f) --- source3/include/memcache.h | 3 ++- source3/lib/access.c | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/source3/include/memcache.h b/source3/include/memcache.h index 36cde98bd3..c4a2974b62 100644 --- a/source3/include/memcache.h +++ b/source3/include/memcache.h @@ -32,7 +32,8 @@ enum memcache_number { SID_GID_CACHE, GETWD_CACHE, GETPWNAM_CACHE, /* talloc */ - MANGLE_HASH2_CACHE + MANGLE_HASH2_CACHE, + SINGLETON_CACHE }; struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size); diff --git a/source3/lib/access.c b/source3/lib/access.c index 1e4df83607..6a463446d1 100644 --- a/source3/lib/access.c +++ b/source3/lib/access.c @@ -97,13 +97,29 @@ static bool string_match(const char *tok,const char *s) } } else if (tok[0] == '@') { /* netgroup: look it up */ #ifdef HAVE_NETGROUP - static char *mydomain = NULL; + DATA_BLOB tmp; + char *mydomain = NULL; char *hostname = NULL; bool netgroup_ok = false; - if (!mydomain) + if (memcache_lookup( + NULL, SINGLETON_CACHE, + data_blob_string_const("yp_default_domain"), + &tmp)) { + + SMB_ASSERT(tmp.length > 0); + mydomain = (tmp.data[0] == '\0') + ? NULL : (char *)tmp.data; + } + else { yp_get_default_domain(&mydomain); + memcache_add( + NULL, SINGLETON_CACHE, + data_blob_string_const("yp_default_domain"), + data_blob_string_const(mydomain?mydomain:"")); + } + if (!mydomain) { DEBUG(0,("Unable to get default yp domain. " "Try without it.\n")); -- cgit From 184c927bf5a5107db38cdb3ae7b518826ecb7133 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 9 Dec 2007 18:25:34 +0100 Subject: Remove some statics from md4.c (This used to be commit 7e193c68b2a7eb16afc12379a4ceed41053d1eeb) --- source3/lib/md4.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/source3/lib/md4.c b/source3/lib/md4.c index 61d5848aae..bae0091e36 100644 --- a/source3/lib/md4.c +++ b/source3/lib/md4.c @@ -24,7 +24,14 @@ It assumes that a int is at least 32 bits long */ +#if 0 static uint32 A, B, C, D; +#else +#define A (state[0]) +#define B (state[1]) +#define C (state[2]) +#define D (state[3]) +#endif static uint32 F(uint32 X, uint32 Y, uint32 Z) { @@ -52,7 +59,7 @@ static uint32 lshift(uint32 x, int s) #define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + (uint32)0x6ED9EBA1,s) /* this applies md4 to 64 byte chunks */ -static void mdfour64(uint32 *M) +static void mdfour64(uint32_t *state, uint32 *M) { int j; uint32 AA, BB, CC, DD; @@ -121,6 +128,7 @@ void mdfour(unsigned char *out, const unsigned char *in, int n) { unsigned char buf[128]; uint32 M[16]; + uint32 state[4]; uint32 b = n * 8; int i; @@ -131,7 +139,7 @@ void mdfour(unsigned char *out, const unsigned char *in, int n) while (n > 64) { copy64(M, in); - mdfour64(M); + mdfour64(state, M); in += 64; n -= 64; } @@ -144,13 +152,13 @@ void mdfour(unsigned char *out, const unsigned char *in, int n) if (n <= 55) { copy4(buf+56, b); copy64(M, buf); - mdfour64(M); + mdfour64(state, M); } else { copy4(buf+120, b); copy64(M, buf); - mdfour64(M); + mdfour64(state, M); copy64(M, buf+64); - mdfour64(M); + mdfour64(state, M); } for (i=0;i<128;i++) @@ -161,8 +169,6 @@ void mdfour(unsigned char *out, const unsigned char *in, int n) copy4(out+4, B); copy4(out+8, C); copy4(out+12, D); - - A = B = C = D = 0; } -- cgit From 0cdf5cfdfbb6b412e1d365af4f2daf20087b37f5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 20:59:27 +0100 Subject: Fix a missing prototype warning (This used to be commit 93e5de23e7109432f554745b18c6d630a39f9c2b) --- source3/lib/netapi/joindomain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 210763174e..10f7e94835 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/netapi/joindomain.h" extern const char *opt_user_name; extern const char *opt_workgroup; -- cgit From dea7d2223d0d7e5db44cb8df7bf8d6b2ad1eb91f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 20:59:44 +0100 Subject: Fix a C++ warning (This used to be commit 7e1d9b561f6df233b8c7eaec83d1e4207b5a2fb0) --- source3/smbd/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 96d71da8d9..fefae38932 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -280,7 +280,7 @@ void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp) { struct vfs_fsp_data *head; - head = vfs_memctx_fsp_extension(handle, fsp); + head = (struct vfs_fsp_data *)vfs_memctx_fsp_extension(handle, fsp); if (head != NULL) { return EXT_DATA_AREA(head); } -- cgit From eeb92cedde4bc45603be4fdcf2f53dd2cc29f1d0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 21:25:00 +0100 Subject: Fix a C++ warning (This used to be commit c31c7e3e24875ce75bc18f0ad7529320eab8e50a) --- source3/param/loadparm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 4eb8a1ce65..5b009fc964 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -3473,7 +3473,7 @@ static bool process_registry_globals(bool (*pfunc)(const char *, const char *)) if (size && data_p) { err = registry_pull_value(reg_tdb, &value, - type, + (enum winreg_Type)type, data_p, size, size); -- cgit From addf598cde41d17ad4cf497a64b9a2b27e4028c5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 22:17:16 +0100 Subject: Some C++ warnings (This used to be commit 5ab82d4f574f2a2e2761e9e414c66a70aeffb05d) --- source3/lib/memcache.c | 2 +- source3/lib/socket_wrapper/socket_wrapper.c | 4 ++-- source3/lib/time.c | 4 ++-- source3/libsmb/clientgen.c | 4 ++-- source3/rpc_server/srv_dfs_nt.c | 2 +- source3/rpc_server/srv_srvsvc_nt.c | 2 +- source3/rpc_server/srv_winreg_nt.c | 2 +- source3/rpc_server/srv_wkssvc_nt.c | 2 +- source3/smbd/reply.c | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source3/lib/memcache.c b/source3/lib/memcache.c index 192a822cde..448b8b2f84 100644 --- a/source3/lib/memcache.c +++ b/source3/lib/memcache.c @@ -61,7 +61,7 @@ static int memcache_destructor(struct memcache *cache) { for (e = cache->mru; e != NULL; e = next) { next = e->next; - if (memcache_is_talloc(e->n) + if (memcache_is_talloc((enum memcache_number)e->n) && (e->valuelength == sizeof(void *))) { DATA_BLOB key, value; void *ptr; diff --git a/source3/lib/socket_wrapper/socket_wrapper.c b/source3/lib/socket_wrapper/socket_wrapper.c index 3a72c5a74a..a84c460114 100644 --- a/source3/lib/socket_wrapper/socket_wrapper.c +++ b/source3/lib/socket_wrapper/socket_wrapper.c @@ -571,8 +571,8 @@ static const char *socket_wrapper_pcap_file(void) { static int initialized = 0; static const char *s = NULL; - static const struct swrap_file_hdr h; - static const struct swrap_packet p; + static const struct swrap_file_hdr h = { 0, }; + static const struct swrap_packet p = { 0, }; if (initialized == 1) { return s; diff --git a/source3/lib/time.c b/source3/lib/time.c index 5301e3a55a..f98e03197f 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -1382,7 +1382,7 @@ void unix_to_nt_time_abs(NTTIME *nt, time_t t) d = (double)(t); d *= 1.0e7; - *nt = d; + *nt = (NTTIME)d; /* convert to a negative value */ *nt=~*nt; @@ -1443,7 +1443,7 @@ const char *display_time(NTTIME nttime) low = ~(nttime & 0xFFFFFFFF); low = low/(1000*1000*10); - sec=high+low; + sec=(int)(high+low); days=sec/(60*60*24); hours=(sec - (days*60*60*24)) / (60*60); diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 1a6fb8f93f..0544b3d879 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -471,7 +471,7 @@ struct cli_state *cli_initialise(void) cli->inbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN); cli->oplock_handler = cli_oplock_ack; cli->case_sensitive = False; - cli->smb_rw_error = 0; + cli->smb_rw_error = SMB_READ_OK; cli->use_spnego = lp_client_use_spnego(); @@ -606,7 +606,7 @@ void cli_shutdown(struct cli_state *cli) close(cli->fd); } cli->fd = -1; - cli->smb_rw_error = 0; + cli->smb_rw_error = SMB_READ_OK; SAFE_FREE(cli); } diff --git a/source3/rpc_server/srv_dfs_nt.c b/source3/rpc_server/srv_dfs_nt.c index 8a1cdedb4f..690ddd60d6 100644 --- a/source3/rpc_server/srv_dfs_nt.c +++ b/source3/rpc_server/srv_dfs_nt.c @@ -34,7 +34,7 @@ void _dfs_GetManagerVersion(pipes_struct *p, struct dfs_GetManagerVersion *r) if (lp_host_msdfs()) { *r->out.version = DFS_MANAGER_VERSION_NT4; } else { - *r->out.version = 0; + *r->out.version = (enum dfs_ManagerVersion)0; } } diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 43f57a0109..3cc2472116 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -2167,7 +2167,7 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC r_u->size_secdesc = sd_size; r_u->sec_desc = psd; - psd->dacl->revision = (uint16) NT4_ACL_REVISION; + psd->dacl->revision = NT4_ACL_REVISION; unbecome_user(); close_cnum(conn, user.vuid); diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c index 873224085c..7dd5268088 100644 --- a/source3/rpc_server/srv_winreg_nt.c +++ b/source3/rpc_server/srv_winreg_nt.c @@ -234,7 +234,7 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r) if ( !regkey ) return WERR_BADFID; - *r->out.value_length = *r->out.type = 0; + *r->out.value_length = *r->out.type = REG_NONE; DEBUG(7,("_reg_info: policy key name = [%s]\n", regkey->key->name)); DEBUG(7,("_reg_info: policy key type = [%08x]\n", regkey->key->type)); diff --git a/source3/rpc_server/srv_wkssvc_nt.c b/source3/rpc_server/srv_wkssvc_nt.c index 1e43b5ae99..d9d2df344a 100644 --- a/source3/rpc_server/srv_wkssvc_nt.c +++ b/source3/rpc_server/srv_wkssvc_nt.c @@ -32,7 +32,7 @@ static void create_wks_info_100(struct wkssvc_NetWkstaInfo100 *info100) { - info100->platform_id = 0x000001f4; /* unknown */ + info100->platform_id = PLATFORM_ID_NT; /* unknown */ info100->version_major = lp_major_announce_version(); info100->version_minor = lp_minor_announce_version(); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 45081808e1..575ca13ff6 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1163,8 +1163,8 @@ void reply_dskattr(connection_struct *conn, struct smb_request *req) total_space = dsize * (double)bsize; free_space = dfree * (double)bsize; - dsize = (total_space+63*512) / (64*512); - dfree = (free_space+63*512) / (64*512); + dsize = (SMB_BIG_UINT)((total_space+63*512) / (64*512)); + dfree = (SMB_BIG_UINT)((free_space+63*512) / (64*512)); if (dsize > 0xFFFF) dsize = 0xFFFF; if (dfree > 0xFFFF) dfree = 0xFFFF; -- cgit From 99b86e4a266b99634f6a65015f6df115c421d3e5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Dec 2007 22:27:01 +0100 Subject: Some C++ fixes (This used to be commit 5c392c4c6e277a24d0d477902dc7856b2b46ee53) --- source3/lib/secace.c | 5 +++-- source3/lib/secacl.c | 3 ++- source3/lib/secdesc.c | 12 ++++++++---- source3/lib/sharesec.c | 10 +++++++--- source3/lib/util_seaccess.c | 4 +++- source3/rpc_server/srv_lsa_nt.c | 4 +++- source3/rpc_server/srv_samr_nt.c | 4 +++- source3/rpc_server/srv_svcctl_nt.c | 4 +++- source3/rpc_server/srv_winreg_nt.c | 4 +++- source3/services/services_db.c | 4 +++- source3/smbd/posix_acls.c | 6 +++--- 11 files changed, 41 insertions(+), 19 deletions(-) diff --git a/source3/lib/secace.c b/source3/lib/secace.c index 9e533a5a28..90ecc342cd 100644 --- a/source3/lib/secace.c +++ b/source3/lib/secace.c @@ -54,7 +54,8 @@ void sec_ace_copy(SEC_ACE *ace_dest, SEC_ACE *ace_src) Sets up a SEC_ACE structure. ********************************************************************/ -void init_sec_ace(SEC_ACE *t, const DOM_SID *sid, uint8 type, uint32 mask, uint8 flag) +void init_sec_ace(SEC_ACE *t, const DOM_SID *sid, enum security_ace_type type, + uint32 mask, uint8 flag) { t->type = type; t->flags = flag; @@ -83,7 +84,7 @@ NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **pp_new, SEC_ACE *old, unsign for (i = 0; i < *num - 1; i ++) sec_ace_copy(&(*pp_new)[i], &old[i]); - (*pp_new)[i].type = 0; + (*pp_new)[i].type = SEC_ACE_TYPE_ACCESS_ALLOWED; (*pp_new)[i].flags = 0; (*pp_new)[i].size = SEC_ACE_HEADER_SIZE + sid_size(sid); (*pp_new)[i].access_mask = mask; diff --git a/source3/lib/secacl.c b/source3/lib/secacl.c index 328bc1b4b4..5e82242e1b 100644 --- a/source3/lib/secacl.c +++ b/source3/lib/secacl.c @@ -26,7 +26,8 @@ Create a SEC_ACL structure. ********************************************************************/ -SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, uint16 revision, int num_aces, SEC_ACE *ace_list) +SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, enum security_acl_revision revision, + int num_aces, SEC_ACE *ace_list) { SEC_ACL *dst; int i; diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c index 4a9785009b..123c3bcc9b 100644 --- a/source3/lib/secdesc.c +++ b/source3/lib/secdesc.c @@ -182,7 +182,9 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU Creates a SEC_DESC structure ********************************************************************/ -SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, uint16 revision, uint16 type, +SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, + enum security_descriptor_revision revision, + uint16 type, const DOM_SID *owner_sid, const DOM_SID *grp_sid, SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size) { @@ -329,8 +331,9 @@ NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len, SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, const DOM_SID *owner_sid, const DOM_SID *grp_sid, SEC_ACL *dacl, size_t *sd_size) { - return make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, - owner_sid, grp_sid, NULL, dacl, sd_size); + return make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, owner_sid, grp_sid, NULL, + dacl, sd_size); } /******************************************************************* @@ -557,7 +560,8 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr, correct. Perhaps the user and group should be passed in as parameters by the caller? */ - sd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, + sd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, parent_ctr->owner_sid, parent_ctr->group_sid, parent_ctr->sacl, diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index b3b000579f..0027a8813a 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -92,7 +92,9 @@ SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def init_sec_ace(&ace, &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, sa, 0); if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 1, &ace)) != NULL) { - psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, psa, psize); + psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, + psa, psize); } if (!psd) { @@ -291,7 +293,7 @@ bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd) uint32 s_access; DOM_SID sid; char *sidstr; - uint8 type = SEC_ACE_TYPE_ACCESS_ALLOWED; + enum security_ace_type type = SEC_ACE_TYPE_ACCESS_ALLOWED; if (!next_token_talloc(ctx, &pacl, &sidstr, ":")) { DEBUG(0,("parse_usershare_acl: malformed usershare acl looking " @@ -339,7 +341,9 @@ bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd) } if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, num_aces, ace_list)) != NULL) { - psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, psa, &sd_size); + psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, + psa, &sd_size); } if (!psd) { diff --git a/source3/lib/util_seaccess.c b/source3/lib/util_seaccess.c index 0481eea5f0..87e70bb95b 100644 --- a/source3/lib/util_seaccess.c +++ b/source3/lib/util_seaccess.c @@ -350,7 +350,9 @@ NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size) if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 3, ace)) == NULL) return NT_STATUS_NO_MEMORY; - if ((*psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, psa, sd_size)) == NULL) + if ((*psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, + psa, sd_size)) == NULL) return NT_STATUS_NO_MEMORY; return NT_STATUS_OK; diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index a289196f5f..1b78772a79 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -463,7 +463,9 @@ static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *s if((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 3, ace)) == NULL) return NT_STATUS_NO_MEMORY; - if((*sd = make_sec_desc(mem_ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, &adm_sid, NULL, NULL, psa, sd_size)) == NULL) + if((*sd = make_sec_desc(mem_ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, &adm_sid, NULL, NULL, + psa, sd_size)) == NULL) return NT_STATUS_NO_MEMORY; return NT_STATUS_OK; diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 1d69cb320e..01ce932afa 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -149,7 +149,9 @@ static NTSTATUS make_samr_object_sd( TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) == NULL) return NT_STATUS_NO_MEMORY; - if ((*psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, psa, sd_size)) == NULL) + if ((*psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, + psa, sd_size)) == NULL) return NT_STATUS_NO_MEMORY; return NT_STATUS_OK; diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c index 5316d399b9..3f5cf03abb 100644 --- a/source3/rpc_server/srv_svcctl_nt.c +++ b/source3/rpc_server/srv_svcctl_nt.c @@ -162,7 +162,9 @@ static SEC_DESC* construct_scm_sd( TALLOC_CTX *ctx ) if ( !(acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) ) return NULL; - if ( !(sd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, acl, &sd_size)) ) + if ( !(sd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, + acl, &sd_size)) ) return NULL; return sd; diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c index 7dd5268088..74ee94cf75 100644 --- a/source3/rpc_server/srv_winreg_nt.c +++ b/source3/rpc_server/srv_winreg_nt.c @@ -934,7 +934,9 @@ static WERROR make_default_reg_sd( TALLOC_CTX *ctx, SEC_DESC **psd ) if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 2, ace)) == NULL) return WERR_NOMEM; - if ((*psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, &owner_sid, NULL, NULL, psa, &sd_size)) == NULL) + if ((*psd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, &owner_sid, NULL, + NULL, psa, &sd_size)) == NULL) return WERR_NOMEM; return WERR_OK; diff --git a/source3/services/services_db.c b/source3/services/services_db.c index c57b29cc80..b1daae4df8 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -112,7 +112,9 @@ static SEC_DESC* construct_service_sd( TALLOC_CTX *ctx ) if ( !(acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) ) return NULL; - if ( !(sd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, acl, &sd_size)) ) + if ( !(sd = make_sec_desc(ctx, SECURITY_DESCRIPTOR_REVISION_1, + SEC_DESC_SELF_RELATIVE, NULL, NULL, NULL, + acl, &sd_size)) ) return NULL; return sd; diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index d8794e2114..2810b5e587 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -891,7 +891,7 @@ static bool nt4_compatible_acls(void) ****************************************************************************/ static SEC_ACCESS map_canon_ace_perms(int snum, - int *pacl_type, + enum security_ace_type *pacl_type, mode_t perms, bool directory_ace) { @@ -2869,7 +2869,7 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn, { canon_ace *ace; - int nt_acl_type; + enum security_ace_type nt_acl_type; int i; if (nt4_compatible_acls() && dir_ace) { @@ -3210,7 +3210,7 @@ static NTSTATUS append_ugw_ace(files_struct *fsp, { mode_t perms; SEC_ACCESS acc; - int nt_acl_type; + enum security_ace_type nt_acl_type; DOM_SID trustee; switch (ugw) { -- cgit From 4418b989e7009c63d2206cecdfaa50cc66e1d8da Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 21 Dec 2007 12:53:12 +0100 Subject: Fix the build on Solaris (This used to be commit 5f5e52ba7b3862dc72a16d84e07503e98ccbbf8a) --- source3/lib/memcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/memcache.c b/source3/lib/memcache.c index 448b8b2f84..457586bd68 100644 --- a/source3/lib/memcache.c +++ b/source3/lib/memcache.c @@ -332,7 +332,7 @@ void memcache_add(struct memcache *cache, enum memcache_number n, void memcache_add_talloc(struct memcache *cache, enum memcache_number n, DATA_BLOB key, void *ptr) { - return memcache_add(cache, n, key, data_blob_const(&ptr, sizeof(ptr))); + memcache_add(cache, n, key, data_blob_const(&ptr, sizeof(ptr))); } void memcache_flush(struct memcache *cache, enum memcache_number n) -- cgit From 574354a7ec76e85e0f5a1172de9e59ae5bc52d48 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 13:40:11 +0100 Subject: Use ADS_IGNORE_PRINCIPAL define. Guenther (This used to be commit 763e13315fc71237b14a186810bc201e725648f5) --- source3/libsmb/cliconnect.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index d370808bba..33110c803f 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -863,8 +863,7 @@ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user, /* If we get a bad principal, try to guess it if we have a valid host NetBIOS name. */ - if (strequal(principal, - "not_defined_in_RFC4178@please_ignore")) { + if (strequal(principal, ADS_IGNORE_PRINCIPAL)) { SAFE_FREE(principal); } -- cgit From 8ded1df76739363259edce0515b097510e342595 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 15:12:40 +0100 Subject: Kill fstring in getdcname & getanydcname return. Guenther (This used to be commit b7383818168863a7ba43c2456f8c44e96e76707a) --- source3/rpc_client/cli_netlogon.c | 14 ++++++++------ source3/rpcclient/cmd_netlogon.c | 8 ++++---- source3/winbindd/winbindd_cm.c | 4 ++-- source3/winbindd/winbindd_misc.c | 6 +++--- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 3cb5827e73..26d2124da0 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -383,7 +383,7 @@ NTSTATUS rpccli_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, TALLOC_CTX *me WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *mydcname, - const char *domainname, fstring newdcname) + const char *domainname, char **newdcname) { prs_struct qbuf, rbuf; NET_Q_GETANYDCNAME q; @@ -410,8 +410,9 @@ WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli, result = r.status; - if (W_ERROR_IS_OK(result)) { - rpcstr_pull_unistr2_fstring(newdcname, &r.uni_dcname); + if (W_ERROR_IS_OK(result) && newdcname) { + *newdcname = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dcname); + W_ERROR_HAVE_NO_MEMORY(*newdcname); } return result; @@ -421,7 +422,7 @@ WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli, WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *mydcname, - const char *domainname, fstring newdcname) + const char *domainname, char **newdcname) { prs_struct qbuf, rbuf; NET_Q_GETDCNAME q; @@ -448,8 +449,9 @@ WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli, result = r.status; - if (W_ERROR_IS_OK(result)) { - rpcstr_pull_unistr2_fstring(newdcname, &r.uni_dcname); + if (W_ERROR_IS_OK(result) && newdcname) { + *newdcname = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dcname); + W_ERROR_HAVE_NO_MEMORY(*newdcname); } return result; diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index e997bb5090..2c1f7e0f11 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -48,7 +48,7 @@ static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { - fstring dcname; + char *dcname = NULL; WERROR result = WERR_GENERAL_FAILURE; int old_timeout; @@ -60,7 +60,7 @@ static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli, /* Make sure to wait for our DC's reply */ old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */ - result = rpccli_netlogon_getanydcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname); + result = rpccli_netlogon_getanydcname(cli, mem_ctx, cli->cli->desthost, argv[1], &dcname); cli_set_timeout(cli->cli, old_timeout); @@ -79,7 +79,7 @@ static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { - fstring dcname; + char *dcname = NULL; WERROR result = WERR_GENERAL_FAILURE; int old_timeout; @@ -91,7 +91,7 @@ static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli, /* Make sure to wait for our DC's reply */ old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */ - result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname); + result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], &dcname); cli_set_timeout(cli->cli, old_timeout); diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 8ea815535f..7fb42a6dca 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -570,7 +570,7 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain, WERROR werr; TALLOC_CTX *mem_ctx; unsigned int orig_timeout; - fstring tmp; + char *tmp = NULL; char *p; /* Hmmmm. We can only open one connection to the NETLOGON pipe at the @@ -602,7 +602,7 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain, orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000); werr = rpccli_netlogon_getanydcname(netlogon_pipe, mem_ctx, our_domain->dcname, - domain->name, tmp); + domain->name, &tmp); /* And restore our original timeout. */ cli_set_timeout(netlogon_pipe->cli, orig_timeout); diff --git a/source3/winbindd/winbindd_misc.c b/source3/winbindd/winbindd_misc.c index 8c3ef5bb6f..76f2554122 100644 --- a/source3/winbindd/winbindd_misc.c +++ b/source3/winbindd/winbindd_misc.c @@ -231,7 +231,7 @@ void winbindd_getdcname(struct winbindd_cli_state *state) enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain, struct winbindd_cli_state *state) { - fstring dcname_slash; + char *dcname_slash = NULL; char *p; struct rpc_pipe_client *netlogon_pipe; NTSTATUS result; @@ -262,12 +262,12 @@ enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain, werr = rpccli_netlogon_getdcname(netlogon_pipe, state->mem_ctx, domain->dcname, state->request.domain_name, - dcname_slash); + &dcname_slash); } else { werr = rpccli_netlogon_getanydcname(netlogon_pipe, state->mem_ctx, domain->dcname, state->request.domain_name, - dcname_slash); + &dcname_slash); } /* And restore our original timeout. */ cli_set_timeout(netlogon_pipe->cli, orig_timeout); -- cgit From c000a166459468e0cfd5277fa717f8fc9ed8311f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 15:28:01 +0100 Subject: Add get_friendly_werror_msg(). Guenther (This used to be commit b1ad3def98911c91ed55a3b7aec7d0894b2dd8fd) --- source3/libsmb/doserr.c | 52 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/source3/libsmb/doserr.c b/source3/libsmb/doserr.c index 5bdd85da1b..dd556bba5a 100644 --- a/source3/libsmb/doserr.c +++ b/source3/libsmb/doserr.c @@ -1,18 +1,18 @@ -/* +/* * Unix SMB/CIFS implementation. * DOS error routines * Copyright (C) Tim Potter 2002. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ @@ -21,12 +21,16 @@ #include "includes.h" -typedef const struct -{ +typedef const struct { const char *dos_errstr; WERROR werror; } werror_code_struct; +typedef const struct { + WERROR werror; + const char *friendly_errstr; +} werror_str_struct; + werror_code_struct dos_errs[] = { { "WERR_OK", WERR_OK }, @@ -92,6 +96,22 @@ werror_code_struct dos_errs[] = { NULL, W_ERROR(0) } }; +werror_str_struct dos_err_strs[] = { + { WERR_OK, "Success" }, + { WERR_ACCESS_DENIED, "Access is denied" }, + { WERR_INVALID_PARAM, "Invalid parameter" }, + { WERR_NOT_SUPPORTED, "Not supported" }, + { WERR_BAD_PASSWORD, "A bad password was supplied" }, + { WERR_NOMEM, "Out of memory" }, + { WERR_NO_LOGON_SERVERS, "No logon servers found" }, + { WERR_NO_SUCH_LOGON_SESSION, "No such logon session" }, + { WERR_DOMAIN_CONTROLLER_NOT_FOUND, "A domain controller could not be found" }, + { WERR_SETUP_NOT_JOINED, "Join failed" }, + { WERR_SETUP_ALREADY_JOINED, "Machine is already joined" }, + { WERR_SETUP_DOMAIN_CONTROLLER, "Machine is a Domain Controller" }, + { WERR_LOGON_FAILURE, "Invalid logon credentials" }, +}; + /***************************************************************************** Returns a DOS error message. not amazingly helpful, but better than a number. *****************************************************************************/ @@ -102,7 +122,7 @@ const char *dos_errstr(WERROR werror) int idx = 0; while (dos_errs[idx].dos_errstr != NULL) { - if (W_ERROR_V(dos_errs[idx].werror) == + if (W_ERROR_V(dos_errs[idx].werror) == W_ERROR_V(werror)) return dos_errs[idx].dos_errstr; idx++; @@ -114,6 +134,24 @@ const char *dos_errstr(WERROR werror) return result; } +/***************************************************************************** + Get friendly error string for WERRORs + *****************************************************************************/ + +const char *get_friendly_werror_msg(WERROR werror) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(dos_err_strs); i++) { + if (W_ERROR_V(dos_err_strs[i].werror) == + W_ERROR_V(werror)) { + return dos_err_strs[i].friendly_errstr; + } + } + + return dos_errstr(werror); +} + /* compat function for samba4 */ const char *win_errstr(WERROR werror) { -- cgit From 72ffac399077ad7777f1282c94d9b661e7fa53fb Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 6 Dec 2007 19:04:49 +0100 Subject: Add NetGetJoinInformation(). Guenther (This used to be commit d341d251d6e22e9cc1c4596038fd5fe5c7c6c174) --- source3/lib/netapi/joindomain.c | 53 +++++++++++++++++++++++++++++++++++++++++ source3/lib/netapi/joindomain.h | 3 +++ 2 files changed, 56 insertions(+) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 10f7e94835..6da4548f05 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -181,3 +181,56 @@ WERROR NetUnjoinDomain(const char *server_name, return werr; } + +WERROR NetGetJoinInformation(const char *server_name, + const char **name_buffer, + uint16_t *name_type) +{ + TALLOC_CTX *mem_ctx = NULL; + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_cli = NULL; + NTSTATUS status; + WERROR werr; + + mem_ctx = talloc_init("NetGetJoinInformation"); + if (!mem_ctx) { + werr = WERR_NOMEM; + goto done; + } + + status = cli_full_connection(&cli, NULL, server_name, + NULL, 0, + "IPC$", "IPC", + opt_user_name, opt_workgroup, + opt_password, 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_WKSSVC, + &status); + if (!pipe_cli) { + werr = ntstatus_to_werror(status); + goto done; + }; + + status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, mem_ctx, + server_name, + name_buffer, + (enum wkssvc_NetJoinStatus *)name_type, + &werr); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + done: + if (cli) { + cli_shutdown(cli); + } + TALLOC_FREE(mem_ctx); + + return werr; +} diff --git a/source3/lib/netapi/joindomain.h b/source3/lib/netapi/joindomain.h index 2c71702db7..d0badd979d 100644 --- a/source3/lib/netapi/joindomain.h +++ b/source3/lib/netapi/joindomain.h @@ -27,3 +27,6 @@ WERROR NetUnjoinDomain(const char *server_name, const char *account, const char *password, uint32_t unjoin_flags); +WERROR NetGetJoinInformation(const char *server_name, + const char **name_buffer, + uint16_t *name_type); -- cgit From 8edf48bbf716c3a6b7919c74aa5ed954d9cce48d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 6 Dec 2007 19:15:30 +0100 Subject: For the fun of it, build netapi.so|.a. Guenther (This used to be commit 8cbc6bdede9e8fc423488c7632546c548234cc0c) --- source3/Makefile.in | 10 ++++++++++ source3/exports/netapi.syms | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 source3/exports/netapi.syms diff --git a/source3/Makefile.in b/source3/Makefile.in index 599b0501a1..63a83befa8 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1353,6 +1353,16 @@ bin/libaddns.a: $(BINARY_PREREQS) $(LIBADDNS_OBJ) @echo Linking non-shared library $@ @-$(AR) -rc $@ $(LIBADDNS_OBJ) +bin/netapi.@SHLIBEXT@: $(BINARY_PREREQS) $(NETAPI_OBJ) + @echo Linking shared library $@ + @$(SHLD_DSO) $(NETAPI_OBJ) $(LIBS) \ + $(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS) \ + @SONAMEFLAG@`basename $@`.$(SONAME_VER) + +bin/netapi.a: $(BINARY_PREREQS) $(NETAPI_OBJ) + @echo Linking non-shared library $@ + @-$(AR) -rc $@ $(NETAPI_OBJ) + bin/libsmbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ) @echo Linking shared library $@ @$(SHLD_DSO) $(LIBSMBCLIENT_OBJ) $(LIBS) \ diff --git a/source3/exports/netapi.syms b/source3/exports/netapi.syms new file mode 100644 index 0000000000..eb34bfc012 --- /dev/null +++ b/source3/exports/netapi.syms @@ -0,0 +1,3 @@ +{ + global: *; +}; -- cgit From 1b5c1ae7424ba2fad857adf3701a5809ba3b27fe Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 11 Dec 2007 21:21:17 +0100 Subject: Very quick conversion of net_conf functions into the libnet_conf layer. Certainly needs cleanup later. Guenther (This used to be commit 2b41ac926de76804a50681bd246b3a20e112853b) --- source3/Makefile.in | 14 +++- source3/libnet/libnet_conf.c | 149 ++++++++++++++++++++++++++++++++++++++++ source3/utils/net_conf.c | 158 +++++-------------------------------------- 3 files changed, 176 insertions(+), 145 deletions(-) create mode 100644 source3/libnet/libnet_conf.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 63a83befa8..cbd8118746 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -707,6 +707,8 @@ REG_API_OBJ = registry/reg_api.o \ NETAPI_OBJ = lib/netapi/joindomain.o +LIBNET_OBJ = libnet/libnet_conf.o + NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_domain.o utils/net_help.o \ utils/net_rap.o utils/net_rpc.o utils/net_rpc_samsync.o \ utils/net_rpc_join.o utils/net_time.o utils/net_lookup.o \ @@ -726,7 +728,7 @@ NET_OBJ = $(NET_OBJ1) $(PARAM_WITHOUT_REG_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \ $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(SERVER_MUTEX_OBJ) \ $(AFS_OBJ) $(AFS_SETTOKEN_OBJ) $(REGFIO_OBJ) $(READLINE_OBJ) \ $(LDB_OBJ) $(LIBGPO_OBJ) @BUILD_INIPARSER@ $(DISPLAY_SEC_OBJ) \ - $(REG_API_OBJ) $(DISPLAY_DSDCINFO_OBJ) $(NETAPI_OBJ) + $(REG_API_OBJ) $(DISPLAY_DSDCINFO_OBJ) $(NETAPI_OBJ) $(LIBNET_OBJ) CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) @@ -1933,7 +1935,7 @@ delheaders: winbindd/winbindd_proto.h web/swat_proto.h \ client/client_proto.h utils/net_proto.h \ smbd/build_options.c utils/ntlm_auth_proto.h \ - utils/passwd_proto.h + utils/passwd_proto.h libnet/libnet_proto.h MKPROTO_SH = $(srcdir)/script/mkproto.sh @@ -1978,6 +1980,11 @@ utils/ntlm_auth_proto.h: -h _NTLM_AUTH_PROTO_H_ $(builddir)/utils/ntlm_auth_proto.h \ $(NTLM_AUTH_OBJ1) +libnet/libnet_proto.h: + @cd $(srcdir) && $(SHELL) $(MKPROTO_SH) $(AWK) \ + -h _LIBNET_PROTO_H_ $(builddir)/libnet/libnet_proto.h \ + $(LIBNET_OBJ) + # "make headers" or "make proto" calls a subshell because we need to # make sure these commands are executed in sequence even for a # parallel make. @@ -1991,7 +1998,8 @@ headers: $(MAKE) client/client_proto.h; \ $(MAKE) utils/ntlm_auth_proto.h; \ $(MAKE) utils/net_proto.h; \ - $(MAKE) utils/passwd_proto.h; + $(MAKE) utils/passwd_proto.h; \ + $(MAKE) libnet/libnet_proto.h; proto: headers diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c new file mode 100644 index 0000000000..f394e02e20 --- /dev/null +++ b/source3/libnet/libnet_conf.c @@ -0,0 +1,149 @@ +/* + * Unix SMB/CIFS implementation. + * libnet smbconf registry Support + * Copyright (C) Michael Adam 2007 + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" + +/* + * Open a subkey of KEY_SMBCONF (i.e a service) + * - variant without error output (q = quiet)- + */ +WERROR libnet_smbconf_open_path_q(TALLOC_CTX *ctx, const char *subkeyname, + uint32 desired_access, + struct registry_key **key) +{ + WERROR werr = WERR_OK; + char *path = NULL; + NT_USER_TOKEN *token; + + if (!(token = registry_create_admin_token(ctx))) { + DEBUG(1, ("Error creating admin token\n")); + goto done; + } + + if (subkeyname == NULL) { + path = talloc_strdup(ctx, KEY_SMBCONF); + } else { + path = talloc_asprintf(ctx, "%s\\%s", KEY_SMBCONF, subkeyname); + } + + werr = reg_open_path(ctx, path, desired_access, + token, key); + +done: + TALLOC_FREE(path); + return werr; +} + +/* + * check if a subkey of KEY_SMBCONF of a given name exists + */ +bool libnet_smbconf_key_exists(TALLOC_CTX *ctx, const char *subkeyname) +{ + bool ret = False; + WERROR werr = WERR_OK; + TALLOC_CTX *mem_ctx; + struct registry_key *key; + + if (!(mem_ctx = talloc_new(ctx))) { + d_fprintf(stderr, "ERROR: Out of memory...!\n"); + goto done; + } + + werr = libnet_smbconf_open_path_q(mem_ctx, subkeyname, REG_KEY_READ, &key); + if (W_ERROR_IS_OK(werr)) { + ret = True; + } + +done: + TALLOC_FREE(mem_ctx); + return ret; +} + +/* + * Open a subkey of KEY_SMBCONF (i.e a service) + * - variant with error output - + */ +WERROR libnet_smbconf_open_path(TALLOC_CTX *ctx, const char *subkeyname, + uint32 desired_access, + struct registry_key **key) +{ + WERROR werr = WERR_OK; + + werr = libnet_smbconf_open_path_q(ctx, subkeyname, desired_access, key); + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error opening registry path '%s\\%s': %s\n", + KEY_SMBCONF, + (subkeyname == NULL) ? "" : subkeyname, + dos_errstr(werr)); + } + + return werr; +} + +/* + * open the base key KEY_SMBCONF + */ +WERROR libnet_smbconf_open_basepath(TALLOC_CTX *ctx, uint32 desired_access, + struct registry_key **key) +{ + return libnet_smbconf_open_path(ctx, NULL, desired_access, key); +} + +/* + * create a subkey of KEY_SMBCONF + */ +WERROR libnet_reg_createkey_internal(TALLOC_CTX *ctx, + const char * subkeyname, + struct registry_key **newkey) +{ + WERROR werr = WERR_OK; + struct registry_key *create_parent = NULL; + TALLOC_CTX *create_ctx; + enum winreg_CreateAction action = REG_ACTION_NONE; + + /* create a new talloc ctx for creation. it will hold + * the intermediate parent key (SMBCONF) for creation + * and will be destroyed when leaving this function... */ + if (!(create_ctx = talloc_new(ctx))) { + werr = WERR_NOMEM; + goto done; + } + + werr = libnet_smbconf_open_basepath(create_ctx, REG_KEY_WRITE, &create_parent); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + werr = reg_createkey(ctx, create_parent, subkeyname, + REG_KEY_WRITE, newkey, &action); + if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) { + d_fprintf(stderr, "Key '%s' already exists.\n", subkeyname); + werr = WERR_ALREADY_EXISTS; + } + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error creating key %s: %s\n", + subkeyname, dos_errstr(werr)); + } + +done: + TALLOC_FREE(create_ctx); + return werr; +} + diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 16b372ca72..c853a79249 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -26,6 +26,7 @@ #include "includes.h" #include "utils/net.h" +#include "libnet/libnet_proto.h" /* * usage functions @@ -213,67 +214,6 @@ done: return werr; } -/* - * Open a subkey of KEY_SMBCONF (i.e a service) - * - variant without error output (q = quiet)- - */ -static WERROR smbconf_open_path_q(TALLOC_CTX *ctx, const char *subkeyname, - uint32 desired_access, - struct registry_key **key) -{ - WERROR werr = WERR_OK; - char *path = NULL; - NT_USER_TOKEN *token; - - if (!(token = registry_create_admin_token(ctx))) { - DEBUG(1, ("Error creating admin token\n")); - goto done; - } - - if (subkeyname == NULL) { - path = talloc_strdup(ctx, KEY_SMBCONF); - } else { - path = talloc_asprintf(ctx, "%s\\%s", KEY_SMBCONF, subkeyname); - } - - werr = reg_open_path(ctx, path, desired_access, - token, key); - -done: - TALLOC_FREE(path); - return werr; -} - -/* - * Open a subkey of KEY_SMBCONF (i.e a service) - * - variant with error output - - */ -static WERROR smbconf_open_path(TALLOC_CTX *ctx, const char *subkeyname, - uint32 desired_access, - struct registry_key **key) -{ - WERROR werr = WERR_OK; - - werr = smbconf_open_path_q(ctx, subkeyname, desired_access, key); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error opening registry path '%s\\%s': %s\n", - KEY_SMBCONF, - (subkeyname == NULL) ? "" : subkeyname, - dos_errstr(werr)); - } - - return werr; -} - -/* - * open the base key KEY_SMBCONF - */ -static WERROR smbconf_open_basepath(TALLOC_CTX *ctx, uint32 desired_access, - struct registry_key **key) -{ - return smbconf_open_path(ctx, NULL, desired_access, key); -} - /* * delete a subkey of KEY_SMBCONF */ @@ -282,7 +222,7 @@ static WERROR reg_delkey_internal(TALLOC_CTX *ctx, const char *keyname) WERROR werr = WERR_OK; struct registry_key *key = NULL; - werr = smbconf_open_basepath(ctx, REG_KEY_WRITE, &key); + werr = libnet_smbconf_open_basepath(ctx, REG_KEY_WRITE, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -298,72 +238,6 @@ done: return werr; } -/* - * create a subkey of KEY_SMBCONF - */ -static WERROR reg_createkey_internal(TALLOC_CTX *ctx, - const char * subkeyname, - struct registry_key **newkey) -{ - WERROR werr = WERR_OK; - struct registry_key *create_parent = NULL; - TALLOC_CTX *create_ctx; - enum winreg_CreateAction action = REG_ACTION_NONE; - - /* create a new talloc ctx for creation. it will hold - * the intermediate parent key (SMBCONF) for creation - * and will be destroyed when leaving this function... */ - if (!(create_ctx = talloc_new(ctx))) { - werr = WERR_NOMEM; - goto done; - } - - werr = smbconf_open_basepath(create_ctx, REG_KEY_WRITE, &create_parent); - if (!W_ERROR_IS_OK(werr)) { - goto done; - } - - werr = reg_createkey(ctx, create_parent, subkeyname, - REG_KEY_WRITE, newkey, &action); - if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) { - d_fprintf(stderr, "Key '%s' already exists.\n", subkeyname); - werr = WERR_ALREADY_EXISTS; - } - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error creating key %s: %s\n", - subkeyname, dos_errstr(werr)); - } - -done: - TALLOC_FREE(create_ctx); - return werr; -} - -/* - * check if a subkey of KEY_SMBCONF of a given name exists - */ -static bool smbconf_key_exists(TALLOC_CTX *ctx, const char *subkeyname) -{ - bool ret = False; - WERROR werr = WERR_OK; - TALLOC_CTX *mem_ctx; - struct registry_key *key; - - if (!(mem_ctx = talloc_new(ctx))) { - d_fprintf(stderr, "ERROR: Out of memory...!\n"); - goto done; - } - - werr = smbconf_open_path_q(mem_ctx, subkeyname, REG_KEY_READ, &key); - if (W_ERROR_IS_OK(werr)) { - ret = True; - } - -done: - TALLOC_FREE(mem_ctx); - return ret; -} - static bool smbconf_value_exists(TALLOC_CTX *ctx, struct registry_key *key, const char *param) { @@ -553,13 +427,13 @@ static int import_process_service(TALLOC_CTX *ctx, if (opt_testmode) { d_printf("[%s]\n", servicename); } else { - if (smbconf_key_exists(tmp_ctx, servicename)) { + if (libnet_smbconf_key_exists(tmp_ctx, servicename)) { werr = reg_delkey_internal(tmp_ctx, servicename); if (!W_ERROR_IS_OK(werr)) { goto done; } } - werr = reg_createkey_internal(tmp_ctx, servicename, &key); + werr = libnet_reg_createkey_internal(tmp_ctx, servicename, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -632,12 +506,12 @@ int net_conf_list(int argc, const char **argv) goto done; } - werr = smbconf_open_basepath(ctx, REG_KEY_READ, &base_key); + werr = libnet_smbconf_open_basepath(ctx, REG_KEY_READ, &base_key); if (!W_ERROR_IS_OK(werr)) { goto done; } - if (smbconf_key_exists(ctx, GLOBAL_NAME)) { + if (libnet_smbconf_key_exists(ctx, GLOBAL_NAME)) { werr = reg_openkey(ctx, base_key, GLOBAL_NAME, REG_KEY_READ, &sub_key); if (!W_ERROR_IS_OK(werr)) { @@ -790,7 +664,7 @@ int net_conf_listshares(int argc, const char **argv) goto done; } - werr = smbconf_open_basepath(ctx, SEC_RIGHTS_ENUM_SUBKEYS, &key); + werr = libnet_smbconf_open_basepath(ctx, SEC_RIGHTS_ENUM_SUBKEYS, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -852,7 +726,7 @@ int net_conf_showshare(int argc, const char **argv) goto done; } - werr = smbconf_open_path(ctx, argv[0], REG_KEY_READ, &key); + werr = libnet_smbconf_open_path(ctx, argv[0], REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -989,7 +863,7 @@ int net_conf_addshare(int argc, const char **argv) * create the share */ - werr = reg_createkey_internal(NULL, argv[0], &newkey); + werr = libnet_reg_createkey_internal(NULL, argv[0], &newkey); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -1060,10 +934,10 @@ static int net_conf_setparm(int argc, const char **argv) param = strdup_lower(argv[1]); value_str = argv[2]; - if (!smbconf_key_exists(ctx, service)) { - werr = reg_createkey_internal(ctx, service, &key); + if (!libnet_smbconf_key_exists(ctx, service)) { + werr = libnet_reg_createkey_internal(ctx, service, &key); } else { - werr = smbconf_open_path(ctx, service, REG_KEY_READ, &key); + werr = libnet_smbconf_open_path(ctx, service, REG_KEY_WRITE, &key); } if (!W_ERROR_IS_OK(werr)) { goto done; @@ -1104,14 +978,14 @@ static int net_conf_getparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - if (!smbconf_key_exists(ctx, service)) { + if (!libnet_smbconf_key_exists(ctx, service)) { d_fprintf(stderr, "ERROR: given service '%s' does not exist.\n", service); goto done; } - werr = smbconf_open_path(ctx, service, REG_KEY_READ, &key); + werr = libnet_smbconf_open_path(ctx, service, REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -1151,14 +1025,14 @@ static int net_conf_delparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - if (!smbconf_key_exists(ctx, service)) { + if (!libnet_smbconf_key_exists(ctx, service)) { d_fprintf(stderr, "Error: given service '%s' does not exist.\n", service); goto done; } - werr = smbconf_open_path(ctx, service, REG_KEY_READ, &key); + werr = libnet_smbconf_open_path(ctx, service, REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From 67aa44e7a230cb3cf35c184692bf5249d6d424cf Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 11 Dec 2007 21:23:40 +0100 Subject: Split NetJoinDomain() into NetJoinDomainRemote() and the unsupported NetJoinDomainLocal(). Guenther (This used to be commit d2f21ce6727ec9e4df67989db07b48470d0790a4) --- source3/lib/netapi/joindomain.c | 96 +++++++++++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 23 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 6da4548f05..1b951d7a5c 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -24,14 +24,25 @@ extern const char *opt_user_name; extern const char *opt_workgroup; extern const char *opt_password; -WERROR NetJoinDomain(const char *server_name, - const char *domain_name, - const char *account_ou, - const char *Account, - const char *password, - uint32_t join_flags) +static WERROR NetJoinDomainLocal(TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *account_ou, + const char *Account, + const char *password, + uint32_t join_flags) +{ + return WERR_NOT_SUPPORTED; +} + +static WERROR NetJoinDomainRemote(TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *account_ou, + const char *Account, + const char *password, + uint32_t join_flags) { - TALLOC_CTX *mem_ctx = NULL; struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_cli = NULL; struct wkssvc_PasswordBuffer encrypted_password; @@ -41,22 +52,6 @@ WERROR NetJoinDomain(const char *server_name, ZERO_STRUCT(encrypted_password); - mem_ctx = talloc_init("NetJoinDomain"); - if (!mem_ctx) { - werr = WERR_NOMEM; - goto done; - } - - if (!server_name || is_myname_or_ipaddr(server_name)) { - werr = WERR_NOT_SUPPORTED; - goto done; - } - - if (!domain_name) { - werr = WERR_INVALID_PARAM; - goto done; - } - status = cli_full_connection(&cli, NULL, server_name, NULL, 0, "IPC$", "IPC", @@ -101,6 +96,61 @@ WERROR NetJoinDomain(const char *server_name, cli_set_timeout(cli, old_timeout); cli_shutdown(cli); } + + return werr; +} + +WERROR NetJoinDomain(const char *server_name, + const char *domain_name, + const char *account_ou, + const char *Account, + const char *password, + uint32_t join_flags) +{ + TALLOC_CTX *mem_ctx = NULL; + WERROR werr; + + mem_ctx = talloc_init("NetJoinDomain"); + if (!mem_ctx) { + werr = WERR_NOMEM; + goto done; + } + + if (!domain_name) { + werr = WERR_INVALID_PARAM; + goto done; + } + + if (!server_name || is_myname_or_ipaddr(server_name)) { + + const char *dc = NULL; + + /* FIXME: DsGetDcName */ + if (server_name == NULL) { + dc = domain_name; + } else { + dc = domain_name; + } + + werr = NetJoinDomainLocal(mem_ctx, + dc, + domain_name, + account_ou, + Account, + password, + join_flags); + + goto done; + } + + werr = NetJoinDomainRemote(mem_ctx, + server_name, + domain_name, + account_ou, + Account, + password, + join_flags); +done: TALLOC_FREE(mem_ctx); return werr; -- cgit From 913d220e0becf7359762c08e68fa433f4cc5cf44 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 11 Dec 2007 21:25:41 +0100 Subject: Add libnet_JoinCtx structure. Guenther (This used to be commit 13c46b1407117c93b8f0275cc16ea5aa49596750) --- source3/libnet/libnet_join.h | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 source3/libnet/libnet_join.h diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h new file mode 100644 index 0000000000..9596733cee --- /dev/null +++ b/source3/libnet/libnet_join.h @@ -0,0 +1,48 @@ +/* + * Unix SMB/CIFS implementation. + * libnet Join Support + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LIBNET_JOIN_H__ +#define __LIBNET_JOIN_H__ + +struct libnet_JoinCtx { + struct { + const char *server_name; + const char *domain_name; + const char *account_ou; + const char *admin_account; + const char *password; + uint32_t join_flags; + const char *os_version; + const char *os_string; + const char *upn; + bool modify_config; + } in; + + struct { + char *account_name; + char *netbios_domain_name; + char *dns_domain_name; + char *dn; + bool modified_config; + struct dom_sid *domain_sid; + WERROR result; + } out; +}; + +#endif -- cgit From 5bf7319ac49a850288f2caaa60c248450d504348 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 11 Dec 2007 21:31:44 +0100 Subject: Add libnet_Join(). Heavily based on existing code in net_ads_join(). Guenther (This used to be commit fb6315b68b16d64625457881302fd191f90defa0) --- source3/Makefile.in | 2 +- source3/libnet/libnet_join.c | 354 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 355 insertions(+), 1 deletion(-) create mode 100644 source3/libnet/libnet_join.c diff --git a/source3/Makefile.in b/source3/Makefile.in index cbd8118746..1b482c1d46 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -707,7 +707,7 @@ REG_API_OBJ = registry/reg_api.o \ NETAPI_OBJ = lib/netapi/joindomain.o -LIBNET_OBJ = libnet/libnet_conf.o +LIBNET_OBJ = libnet/libnet_conf.o libnet/libnet_join.o NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_domain.o utils/net_help.o \ utils/net_rap.o utils/net_rpc.o utils/net_rpc_samsync.o \ diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c new file mode 100644 index 0000000000..ce5b1b7b10 --- /dev/null +++ b/source3/libnet/libnet_join.c @@ -0,0 +1,354 @@ +/* + * Unix SMB/CIFS implementation. + * libnet Join Support + * Copyright (C) Gerald (Jerry) Carter 2006 + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" +#include "libnet/libnet_join.h" +#include "libnet/libnet_proto.h" + +static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_hnd = NULL; + const char *password = NULL; + POLICY_HND sam_pol, domain_pol, user_pol, lsa_pol; + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + WERROR werr; + char *acct_name; + const char *const_acct_name; + uint32 user_rid; + uint32 num_rids, *name_types, *user_rids; + uint32 flags = 0x3e8; + uint32 acb_info = ACB_WSTRUST; + uint32 fields_present; + uchar pwbuf[532]; + SAM_USERINFO_CTR ctr; + SAM_USER_INFO_25 p25; + const int infolevel = 25; + struct MD5Context md5ctx; + uchar md5buffer[16]; + DATA_BLOB digested_session_key; + uchar md4_trust_password[16]; + + password = talloc_strdup(mem_ctx, + generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH)); + W_ERROR_HAVE_NO_MEMORY(password); + + status = cli_full_connection(&cli, NULL, r->in.server_name, + NULL, 0, + "IPC$", "IPC", + r->in.admin_account, + NULL, //r->in.domain_name, + r->in.password, + 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &status); + if (!pipe_hnd) { + werr = ntstatus_to_werror(status); + goto done; + } + + status = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, + SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + status = rpccli_lsa_query_info_policy(pipe_hnd, mem_ctx, &lsa_pol, + 5, + &r->out.netbios_domain_name, + &r->out.domain_sid); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + status = rpccli_lsa_query_info_policy2(pipe_hnd, mem_ctx, &lsa_pol, + 12, + &r->out.netbios_domain_name, + &r->out.dns_domain_name, + NULL, + NULL, + &r->out.domain_sid); + + rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol); + cli_rpc_pipe_close(pipe_hnd); + + pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &status); + if (!pipe_hnd) { + werr = ntstatus_to_werror(status); + goto done; + } + + status = rpccli_samr_connect(pipe_hnd, mem_ctx, + SEC_RIGHTS_MAXIMUM_ALLOWED, &sam_pol); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + status = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &sam_pol, + SEC_RIGHTS_MAXIMUM_ALLOWED, + r->out.domain_sid, + &domain_pol); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname()); + strlower_m(acct_name); + const_acct_name = acct_name; + + status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol, + acct_name, ACB_WSTRUST, + 0xe005000b, &user_pol, &user_rid); + if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { + if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) { + werr = WERR_SETUP_ALREADY_JOINED; + goto done; + } + } + + if (NT_STATUS_IS_OK(status)) { + rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + } + + status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx, + &domain_pol, flags, 1, + &const_acct_name, + &num_rids, &user_rids, &name_types); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + if (name_types[0] != SID_NAME_USER) { + werr = ntstatus_to_werror(NT_STATUS_INVALID_WORKSTATION); + goto done; + } + + user_rid = user_rids[0]; + + status = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol, + SEC_RIGHTS_MAXIMUM_ALLOWED, user_rid, + &user_pol); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + E_md4hash(r->in.password, md4_trust_password); + encode_pw_buffer(pwbuf, r->in.password, STR_UNICODE); + + generate_random_buffer((uint8*)md5buffer, sizeof(md5buffer)); + digested_session_key = data_blob_talloc(mem_ctx, 0, 16); + + MD5Init(&md5ctx); + MD5Update(&md5ctx, md5buffer, sizeof(md5buffer)); + MD5Update(&md5ctx, cli->user_session_key.data, cli->user_session_key.length); + MD5Final(digested_session_key.data, &md5ctx); + + SamOEMhashBlob(pwbuf, sizeof(pwbuf), &digested_session_key); + memcpy(&pwbuf[516], md5buffer, sizeof(md5buffer)); + + acb_info |= ACB_PWNOEXP; +#if 0 + if ( dom_type == ND_TYPE_AD ) { +#if !defined(ENCTYPE_ARCFOUR_HMAC) + acb_info |= ACB_USE_DES_KEY_ONLY; +#endif + ;; + } +#endif + ZERO_STRUCT(ctr); + ZERO_STRUCT(p25); + + fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | ACCT_FLAGS; + init_sam_user_info25P(&p25, fields_present, acb_info, (char *)pwbuf); + + ctr.switch_value = infolevel; + ctr.info.id25 = &p25; + + status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, + infolevel, &cli->user_session_key, + &ctr); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + cli_rpc_pipe_close(pipe_hnd); + + if (!secrets_store_domain_sid(r->out.netbios_domain_name, + r->out.domain_sid)) + { + werr = WERR_GENERAL_FAILURE; + goto done; + } + + if (!secrets_store_machine_password(password, + r->out.netbios_domain_name, + SEC_CHAN_WKSTA)) + { + werr = WERR_GENERAL_FAILURE; + goto done; + } + + werr = WERR_OK; + done: + if (cli) { + cli_shutdown(cli); + } + + return werr; +} + +static WERROR do_modify_val_config(struct registry_key *key, + const char *val_name, + const char *val_data) +{ + struct registry_value val; + + ZERO_STRUCT(val); + + val.type = REG_SZ; + val.v.sz.str = CONST_DISCARD(char *, val_data); + val.v.sz.len = strlen(val_data) + 1; + + return reg_setvalue(key, val_name, &val); +} + +static WERROR do_modify_vals_config(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r, + struct registry_key *key) +{ + WERROR werr; + bool is_ad = false; + + if (r->out.dns_domain_name) { + is_ad = true; + } + + werr = do_modify_val_config(key, "security", "domain"); + W_ERROR_NOT_OK_RETURN(werr); + + werr = do_modify_val_config(key, "workgroup", + r->out.netbios_domain_name); + W_ERROR_NOT_OK_RETURN(werr); + + if (is_ad) { + werr = do_modify_val_config(key, "security", "ads"); + W_ERROR_NOT_OK_RETURN(werr); + + werr = do_modify_val_config(key, "realm", + r->out.dns_domain_name); + W_ERROR_NOT_OK_RETURN(werr); + } + + return werr; +} + +static WERROR do_DomainJoinConfig(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + WERROR werr; + struct registry_key *key = NULL; + + if (!W_ERROR_IS_OK(r->out.result)) { + return r->out.result; + } + + if (!r->in.modify_config) { + return WERR_OK; + } + + if (!registry_init_regdb()) { + return WERR_REG_IO_FAILURE; + } + + if (!libnet_smbconf_key_exists(mem_ctx, GLOBAL_NAME)) { + werr = libnet_reg_createkey_internal(mem_ctx, + GLOBAL_NAME, &key); + } else { + werr = libnet_smbconf_open_path(mem_ctx, + GLOBAL_NAME, + REG_KEY_WRITE, &key); + } + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + werr = do_modify_vals_config(mem_ctx, r, key); + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + r->out.modified_config = true; + r->out.result = werr; + + return werr; +} + +WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx **r) +{ + struct libnet_JoinCtx *ctx; + + ctx = talloc_zero(mem_ctx, struct libnet_JoinCtx); + if (!ctx) { + return WERR_NOMEM; + } + + *r = ctx; + + return WERR_OK; +} + +WERROR libnet_Join(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + WERROR werr; + + if (!r->in.domain_name) { + return WERR_INVALID_PARAM; + } + + if (r->in.modify_config && !lp_include_registry_globals()) { + return WERR_NOT_SUPPORTED; + } + + werr = do_DomainJoin(mem_ctx, r); + + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + werr = do_DomainJoinConfig(mem_ctx, r); + + return werr; +} -- cgit From 4f6e8dfa51dfef72d13efc4acd3ede37d1f69eac Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 11 Dec 2007 21:32:16 +0100 Subject: Fill in NetJoinDomainLocal(). Guenther (This used to be commit 4896f22bb50ea9ae0c4807ed9b2dd4283c254364) --- source3/lib/netapi/joindomain.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 1b951d7a5c..96983d43e3 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -32,7 +32,41 @@ static WERROR NetJoinDomainLocal(TALLOC_CTX *mem_ctx, const char *password, uint32_t join_flags) { - return WERR_NOT_SUPPORTED; + struct libnet_JoinCtx *r = NULL; + WERROR werr; + + werr = libnet_init_JoinCtx(mem_ctx, &r); + W_ERROR_NOT_OK_RETURN(werr); + + if (!server_name || !domain_name) { + return WERR_INVALID_PARAM; + } + + r->in.server_name = talloc_strdup(mem_ctx, server_name); + W_ERROR_HAVE_NO_MEMORY(r->in.server_name); + + r->in.domain_name = talloc_strdup(mem_ctx, domain_name); + W_ERROR_HAVE_NO_MEMORY(r->in.domain_name); + + if (account_ou) { + r->in.account_ou = talloc_strdup(mem_ctx, account_ou); + W_ERROR_HAVE_NO_MEMORY(r->in.account_ou); + } + + if (Account) { + r->in.admin_account = talloc_strdup(mem_ctx, Account); + W_ERROR_HAVE_NO_MEMORY(r->in.admin_account); + } + + if (password) { + r->in.password = talloc_strdup(mem_ctx, password); + W_ERROR_HAVE_NO_MEMORY(r->in.password); + } + + r->in.join_flags = join_flags; + r->in.modify_config = true; + + return libnet_Join(mem_ctx, r); } static WERROR NetJoinDomainRemote(TALLOC_CTX *mem_ctx, -- cgit From 5799dcdfed85c6e0d481b6ce5a6ddead576763e9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 12 Dec 2007 16:12:14 +0100 Subject: Add _wkssvc_NetrJoinDomain2() server. Guenther (This used to be commit 9b0423e7d918b7b3837ca4ebf997edd80d4da6de) --- source3/Makefile.in | 2 +- source3/rpc_server/srv_wkssvc_nt.c | 69 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 67 insertions(+), 4 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 1b482c1d46..765c705d86 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -558,7 +558,7 @@ SMBD_OBJ_BASE = $(PARAM_WITHOUT_REG_OBJ) $(SMBD_OBJ_SRV) $(LIBSMB_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \ $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(LIBADS_SERVER_OBJ) \ $(REGISTRY_OBJ) $(POPT_LIB_OBJ) \ - $(BUILDOPT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) + $(BUILDOPT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) $(LIBNET_OBJ) PRINTING_OBJ = printing/pcap.o printing/print_svid.o printing/print_aix.o \ printing/print_cups.o printing/print_generic.o \ diff --git a/source3/rpc_server/srv_wkssvc_nt.c b/source3/rpc_server/srv_wkssvc_nt.c index d9d2df344a..e60dca61c7 100644 --- a/source3/rpc_server/srv_wkssvc_nt.c +++ b/source3/rpc_server/srv_wkssvc_nt.c @@ -22,6 +22,8 @@ /* This is the implementation of the wks interface. */ #include "includes.h" +#include "libnet/libnet_join.h" +#include "libnet/libnet_proto.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV @@ -284,9 +286,70 @@ WERROR _wkssvc_NetrGetJoinableOus(pipes_struct *p, struct wkssvc_NetrGetJoinable WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r) { - /* FIXME: Add implementation code here */ - p->rng_fault_state = True; - return WERR_NOT_SUPPORTED; + struct libnet_JoinCtx *j = NULL; + char *pwd = NULL; + char *admin_domain = NULL; + char *admin_account = NULL; + WERROR werr; + NTSTATUS status; + struct nt_user_token *token = p->pipe_user.nt_user_token; + struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; + + if (!r->in.domain_name) { + return WERR_INVALID_PARAM; + } + + if (!user_has_privileges(token, &se_machine_account) && + !nt_token_check_domain_rid(token, DOMAIN_GROUP_RID_ADMINS) && + !nt_token_check_domain_rid(token, BUILTIN_ALIAS_RID_ADMINS)) { + return WERR_ACCESS_DENIED; + } + + werr = decode_wkssvc_join_password_buffer(p->mem_ctx, + r->in.encrypted_password, + &p->session_key, + &pwd); + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + werr = libnet_init_JoinCtx(p->mem_ctx, &j); + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + split_domain_user(p->mem_ctx, + r->in.admin_account, + &admin_domain, + &admin_account); + + status = DsGetDcName(p->mem_ctx, + NULL, + r->in.domain_name, + NULL, + NULL, + DS_DIRECTORY_SERVICE_REQUIRED | + DS_WRITABLE_REQUIRED | + DS_RETURN_DNS_NAME, + &info); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + j->in.server_name = info->domain_controller_name; + j->in.domain_name = r->in.domain_name; + j->in.account_ou = r->in.account_ou; + j->in.join_flags = r->in.join_flags; + + j->in.admin_account = admin_account; + j->in.password = pwd; + j->in.modify_config = true; + + become_root(); + werr = libnet_Join(p->mem_ctx, j); + unbecome_root(); + + return werr; } /******************************************************************** -- cgit From 749f699f871831e9ad5b2a57e498a32f959d23c6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 12 Dec 2007 18:14:54 +0100 Subject: Build fixes for libnetapi. Guenther (This used to be commit 07d33557b95106ac57fdef8c767ab86192930a6d) --- source3/Makefile.in | 19 +++++++---- source3/exports/libnetapi.syms | 3 ++ source3/lib/netapi/netapi.c | 76 ++++++++++++++++++++++++++++++++++++++++++ source3/lib/netapi/netapi.h | 26 +++++++++++++++ 4 files changed, 118 insertions(+), 6 deletions(-) create mode 100644 source3/exports/libnetapi.syms create mode 100644 source3/lib/netapi/netapi.c create mode 100644 source3/lib/netapi/netapi.h diff --git a/source3/Makefile.in b/source3/Makefile.in index 765c705d86..9cd035ae71 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -705,7 +705,14 @@ REG_API_OBJ = registry/reg_api.o \ $(UTIL_REG_API_OBJ) \ $(UTIL_REG_SMBCONF_OBJ) -NETAPI_OBJ = lib/netapi/joindomain.o + +LIBNETAPI_OBJ1 = lib/netapi/netapi.o lib/netapi/joindomain.o +LIBNETAPI_OBJ = $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) \ + $(REG_API_OBJ) \ + $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \ + $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ + $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \ + $(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) LIBNET_OBJ = libnet/libnet_conf.o libnet/libnet_join.o @@ -728,7 +735,7 @@ NET_OBJ = $(NET_OBJ1) $(PARAM_WITHOUT_REG_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \ $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(SERVER_MUTEX_OBJ) \ $(AFS_OBJ) $(AFS_SETTOKEN_OBJ) $(REGFIO_OBJ) $(READLINE_OBJ) \ $(LDB_OBJ) $(LIBGPO_OBJ) @BUILD_INIPARSER@ $(DISPLAY_SEC_OBJ) \ - $(REG_API_OBJ) $(DISPLAY_DSDCINFO_OBJ) $(NETAPI_OBJ) $(LIBNET_OBJ) + $(REG_API_OBJ) $(DISPLAY_DSDCINFO_OBJ) $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) @@ -1355,15 +1362,15 @@ bin/libaddns.a: $(BINARY_PREREQS) $(LIBADDNS_OBJ) @echo Linking non-shared library $@ @-$(AR) -rc $@ $(LIBADDNS_OBJ) -bin/netapi.@SHLIBEXT@: $(BINARY_PREREQS) $(NETAPI_OBJ) +bin/libnetapi.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBNETAPI_OBJ) @echo Linking shared library $@ - @$(SHLD_DSO) $(NETAPI_OBJ) $(LIBS) \ + @$(SHLD_DSO) $(LIBNETAPI_OBJ) $(LIBS) \ $(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS) \ @SONAMEFLAG@`basename $@`.$(SONAME_VER) -bin/netapi.a: $(BINARY_PREREQS) $(NETAPI_OBJ) +bin/libnetapi.a: $(BINARY_PREREQS) $(LIBNETAPI_OBJ) @echo Linking non-shared library $@ - @-$(AR) -rc $@ $(NETAPI_OBJ) + @-$(AR) -rc $@ $(LIBNETAPI_OBJ) bin/libsmbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ) @echo Linking shared library $@ diff --git a/source3/exports/libnetapi.syms b/source3/exports/libnetapi.syms new file mode 100644 index 0000000000..eb34bfc012 --- /dev/null +++ b/source3/exports/libnetapi.syms @@ -0,0 +1,3 @@ +{ + global: *; +}; diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c new file mode 100644 index 0000000000..3da492bbe7 --- /dev/null +++ b/source3/lib/netapi/netapi.c @@ -0,0 +1,76 @@ +/* + * Unix SMB/CIFS implementation. + * NetApi Support + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" +#include "lib/netapi/netapi.h" + +extern bool AllowDebugChange; + +static bool libnetapi_initialized = false; + +WERROR libnetapi_init(struct libnetapi_ctx **context) +{ + struct libnetapi_ctx *ctx = NULL; + TALLOC_CTX *frame = NULL; + + if (libnetapi_initialized) { + return WERR_OK; + } + + frame = talloc_stackframe(); + + ctx = talloc_zero(frame, struct libnetapi_ctx); + if (!ctx) { + TALLOC_FREE(frame); + return WERR_NOMEM; + } + + DEBUGLEVEL = 0; + DEBUGLEVEL_CLASS[DBGC_ALL] = 0; + dbf = x_stderr; + x_setbuf(x_stderr, NULL); + AllowDebugChange = false; + + load_case_tables(); + + setup_logging("libnetapi", true); + + if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) { + TALLOC_FREE(frame); + return WERR_GENERAL_FAILURE; + } + + init_names(); + load_interfaces(); + reopen_logs(); + + BlockSignals(True, SIGPIPE); + + libnetapi_initialized = true; + + *context = ctx; + + return WERR_OK; +} + +WERROR libnetapi_free(struct libnetapi_ctx *ctx) +{ + TALLOC_FREE(ctx); + return WERR_OK; +} diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h new file mode 100644 index 0000000000..ad9fbe4209 --- /dev/null +++ b/source3/lib/netapi/netapi.h @@ -0,0 +1,26 @@ +/* + * Unix SMB/CIFS implementation. + * NetApi Support + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +struct libnetapi_ctx { + int debuglevel; +}; + +WERROR libnetapi_init(struct libnetapi_ctx **ctx); + +#include "joindomain.h" -- cgit From 7482a18c83d25b2d00e1086aafb33d9a0ff98309 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 12 Dec 2007 19:00:41 +0100 Subject: More minor libnetapi fixes. Guenther (This used to be commit 9f129c069f9feb357cbe1185058cfe3390609c09) --- source3/exports/netapi.syms | 3 --- source3/lib/netapi/netapi.h | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 source3/exports/netapi.syms diff --git a/source3/exports/netapi.syms b/source3/exports/netapi.syms deleted file mode 100644 index eb34bfc012..0000000000 --- a/source3/exports/netapi.syms +++ /dev/null @@ -1,3 +0,0 @@ -{ - global: *; -}; diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index ad9fbe4209..ec629d56d9 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -22,5 +22,6 @@ struct libnetapi_ctx { }; WERROR libnetapi_init(struct libnetapi_ctx **ctx); +WERROR libnetapi_free(struct libnetapi_ctx *ctx); #include "joindomain.h" -- cgit From 5b5f75d229978d5b9fe14dca768fd8b68d2ab319 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 13 Dec 2007 16:21:27 +0100 Subject: Fill in local branch of NetGetJoinInformation(). Guenther (This used to be commit 46db8754511f915c296771e08e822ba810f804d5) --- source3/lib/netapi/joindomain.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 96983d43e3..bc26c22370 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -282,6 +282,32 @@ WERROR NetGetJoinInformation(const char *server_name, goto done; } + if (!server_name || is_myname_or_ipaddr(server_name)) { + if ((lp_security() == SEC_ADS) && lp_realm()) { + *name_buffer = SMB_STRDUP(lp_realm()); + } else { + *name_buffer = SMB_STRDUP(lp_workgroup()); + } + if (!*name_buffer) { + werr = WERR_NOMEM; + goto done; + } + switch (lp_server_role()) { + case ROLE_DOMAIN_MEMBER: + case ROLE_DOMAIN_PDC: + case ROLE_DOMAIN_BDC: + *name_type = NetSetupDomainName; + break; + case ROLE_STANDALONE: + default: + *name_type = NetSetupWorkgroupName; + break; + } + + werr = WERR_OK; + goto done; + } + status = cli_full_connection(&cli, NULL, server_name, NULL, 0, "IPC$", "IPC", -- cgit From 41410c86cc698f997dd82a143fd92277060384b0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 14 Dec 2007 12:22:20 +0100 Subject: Some libnet and netapi build fixes. Guenther (This used to be commit 1d47247283f7bc75291007be3fde72b1d3d95b99) --- source3/lib/netapi/joindomain.h | 5 +++++ source3/lib/netapi/netapi.h | 5 +++++ source3/libnet/libnet.h | 26 ++++++++++++++++++++++++++ source3/utils/net_conf.c | 2 +- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 source3/libnet/libnet.h diff --git a/source3/lib/netapi/joindomain.h b/source3/lib/netapi/joindomain.h index d0badd979d..73d2ec3d32 100644 --- a/source3/lib/netapi/joindomain.h +++ b/source3/lib/netapi/joindomain.h @@ -17,6 +17,9 @@ * along with this program; if not, see . */ +#ifndef __LIB_NETAPI_JOINDOMAIN_H__ +#define __LIB_NETAPI_JOINDOMAIN_H__ + WERROR NetJoinDomain(const char *server, const char *domain, const char *account_ou, @@ -30,3 +33,5 @@ WERROR NetUnjoinDomain(const char *server_name, WERROR NetGetJoinInformation(const char *server_name, const char **name_buffer, uint16_t *name_type); + +#endif diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index ec629d56d9..0810ecb7bc 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -17,6 +17,9 @@ * along with this program; if not, see . */ +#ifndef __LIB_NETAPI_H__ +#define __LIB_NETAPI_H__ + struct libnetapi_ctx { int debuglevel; }; @@ -25,3 +28,5 @@ WERROR libnetapi_init(struct libnetapi_ctx **ctx); WERROR libnetapi_free(struct libnetapi_ctx *ctx); #include "joindomain.h" + +#endif diff --git a/source3/libnet/libnet.h b/source3/libnet/libnet.h new file mode 100644 index 0000000000..fa24c3b40a --- /dev/null +++ b/source3/libnet/libnet.h @@ -0,0 +1,26 @@ +/* + * Unix SMB/CIFS implementation. + * libnet Support + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LIBNET_H__ +#define __LIBNET_H__ + +#include "libnet/libnet_join.h" +#include "libnet/libnet_proto.h" + +#endif diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index c853a79249..808ba8d885 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -26,7 +26,7 @@ #include "includes.h" #include "utils/net.h" -#include "libnet/libnet_proto.h" +#include "libnet/libnet.h" /* * usage functions -- cgit From c5a84374b6b2af7adff807a739fb1dc279bd4a58 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 14 Dec 2007 17:37:24 +0100 Subject: Make sure we also support non-domain join. Guenther (This used to be commit c818f5505a124a6f0bb9274a1ba4a6147d2f17b3) --- source3/libnet/libnet_join.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index ce5b1b7b10..dd3d2254d8 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -250,6 +250,16 @@ static WERROR do_modify_vals_config(TALLOC_CTX *mem_ctx, WERROR werr; bool is_ad = false; + if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) { + + werr = do_modify_val_config(key, "security", "user"); + W_ERROR_NOT_OK_RETURN(werr); + + werr = do_modify_val_config(key, "workgroup", + r->in.domain_name); + return werr; + } + if (r->out.dns_domain_name) { is_ad = true; } @@ -273,8 +283,8 @@ static WERROR do_modify_vals_config(TALLOC_CTX *mem_ctx, return werr; } -static WERROR do_DomainJoinConfig(TALLOC_CTX *mem_ctx, - struct libnet_JoinCtx *r) +static WERROR do_JoinConfig(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) { WERROR werr; struct registry_key *key = NULL; @@ -342,13 +352,18 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, return WERR_NOT_SUPPORTED; } - werr = do_DomainJoin(mem_ctx, r); + if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { + werr = do_DomainJoin(mem_ctx, r); + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + } + + werr = do_JoinConfig(mem_ctx, r); if (!W_ERROR_IS_OK(werr)) { return werr; } - werr = do_DomainJoinConfig(mem_ctx, r); - return werr; } -- cgit From 9dc0ac4637fdd05a95099c0a6a857c51ca811453 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 02:15:49 +0100 Subject: Getting rid of external credentials in libnetapi. Guenther (This used to be commit c10481dba01a084b0f9c4265f3408a0ec9a8b646) --- source3/lib/netapi/joindomain.c | 16 ++++++++-------- source3/lib/netapi/netapi.h | 3 +++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index bc26c22370..8287cd046f 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -20,10 +20,6 @@ #include "includes.h" #include "lib/netapi/joindomain.h" -extern const char *opt_user_name; -extern const char *opt_workgroup; -extern const char *opt_password; - static WERROR NetJoinDomainLocal(TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, @@ -219,8 +215,10 @@ WERROR NetUnjoinDomain(const char *server_name, status = cli_full_connection(&cli, NULL, server_name, NULL, 0, "IPC$", "IPC", - opt_user_name, opt_workgroup, - opt_password, 0, Undefined, NULL); + ctx->username, + ctx->workgroup, + ctx->password, + 0, Undefined, NULL); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); @@ -311,8 +309,10 @@ WERROR NetGetJoinInformation(const char *server_name, status = cli_full_connection(&cli, NULL, server_name, NULL, 0, "IPC$", "IPC", - opt_user_name, opt_workgroup, - opt_password, 0, Undefined, NULL); + ctx->username, + ctx->workgroup, + ctx->password, + 0, Undefined, NULL); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 0810ecb7bc..0637570c3e 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -22,6 +22,9 @@ struct libnetapi_ctx { int debuglevel; + char *username; + char *workgroup; + char *password; }; WERROR libnetapi_init(struct libnetapi_ctx **ctx); -- cgit From 4dd84b351125cdd95c945d8820ffe078f7325988 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 02:21:38 +0100 Subject: Define NET_API_STATUS to be just a uin32_t. Guenther (This used to be commit a42850926a26a4065a6126affc3754d291a2e178) --- source3/lib/netapi/netapi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 0637570c3e..7946cfb446 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -20,6 +20,8 @@ #ifndef __LIB_NETAPI_H__ #define __LIB_NETAPI_H__ +#define NET_API_STATUS uint32_t + struct libnetapi_ctx { int debuglevel; char *username; -- cgit From 3d853b8e7e975a3e1c07a125e775e3a597112912 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 02:29:50 +0100 Subject: Move basic libnetapi functions to NET_API_STATUS. Guenther (This used to be commit 086c55005976b3173e915e465108214876aa5bd6) --- source3/lib/netapi/netapi.c | 14 +++++++------- source3/lib/netapi/netapi.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 3da492bbe7..898e62d6a5 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -24,13 +24,13 @@ extern bool AllowDebugChange; static bool libnetapi_initialized = false; -WERROR libnetapi_init(struct libnetapi_ctx **context) +NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) { struct libnetapi_ctx *ctx = NULL; TALLOC_CTX *frame = NULL; if (libnetapi_initialized) { - return WERR_OK; + return W_ERROR_V(WERR_OK); } frame = talloc_stackframe(); @@ -38,7 +38,7 @@ WERROR libnetapi_init(struct libnetapi_ctx **context) ctx = talloc_zero(frame, struct libnetapi_ctx); if (!ctx) { TALLOC_FREE(frame); - return WERR_NOMEM; + return W_ERROR_V(WERR_NOMEM); } DEBUGLEVEL = 0; @@ -53,7 +53,7 @@ WERROR libnetapi_init(struct libnetapi_ctx **context) if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) { TALLOC_FREE(frame); - return WERR_GENERAL_FAILURE; + return W_ERROR_V(WERR_GENERAL_FAILURE); } init_names(); @@ -66,11 +66,11 @@ WERROR libnetapi_init(struct libnetapi_ctx **context) *context = ctx; - return WERR_OK; + return W_ERROR_V(WERR_OK); } -WERROR libnetapi_free(struct libnetapi_ctx *ctx) +NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) { TALLOC_FREE(ctx); - return WERR_OK; + return W_ERROR_V(WERR_OK); } diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 7946cfb446..3dfbc0cffb 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -29,8 +29,8 @@ struct libnetapi_ctx { char *password; }; -WERROR libnetapi_init(struct libnetapi_ctx **ctx); -WERROR libnetapi_free(struct libnetapi_ctx *ctx); +NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx); +NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx); #include "joindomain.h" -- cgit From c9b44e0fc3750afb6e001baceffad8fa2f33ac4e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 02:34:07 +0100 Subject: Add basic credential functions for libnetapi. Guenther (This used to be commit 7c38f706b5dc17f15708ac932c84d863a0cc713e) --- source3/lib/netapi/netapi.c | 33 +++++++++++++++++++++++++++++++++ source3/lib/netapi/netapi.h | 3 +++ 2 files changed, 36 insertions(+) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 898e62d6a5..38b44c769d 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -74,3 +74,36 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) TALLOC_FREE(ctx); return W_ERROR_V(WERR_OK); } + +NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, + const char *username) +{ + TALLOC_FREE(ctx->username); + ctx->username = talloc_strdup(ctx, username); + if (!ctx->username) { + return W_ERROR_V(WERR_NOMEM); + } + return W_ERROR_V(WERR_OK); +} + +NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, + const char *password) +{ + TALLOC_FREE(ctx->password); + ctx->password = talloc_strdup(ctx, password); + if (!ctx->password) { + return W_ERROR_V(WERR_NOMEM); + } + return W_ERROR_V(WERR_OK); +} + +NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, + const char *workgroup) +{ + TALLOC_FREE(ctx->workgroup); + ctx->workgroup = talloc_strdup(ctx, workgroup); + if (!ctx->workgroup) { + return W_ERROR_V(WERR_NOMEM); + } + return W_ERROR_V(WERR_OK); +} diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 3dfbc0cffb..d75299601f 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -31,6 +31,9 @@ struct libnetapi_ctx { NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx); NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx); +NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username); +NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password); +NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup); #include "joindomain.h" -- cgit From d14ee1dc08c5c765b07bd472e47e34152db2f9d3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 02:43:22 +0100 Subject: Use full string based debug_parse_levels in libnetapi. Guenther (This used to be commit 78d8f0e41aa3db0060596a7b345c2f04261986e0) --- source3/lib/netapi/netapi.c | 25 ++++++++++++++++++++++--- source3/lib/netapi/netapi.h | 4 +++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 38b44c769d..454d766ae9 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -42,20 +42,21 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) } DEBUGLEVEL = 0; - DEBUGLEVEL_CLASS[DBGC_ALL] = 0; + setup_logging("libnetapi", true); + dbf = x_stderr; x_setbuf(x_stderr, NULL); AllowDebugChange = false; load_case_tables(); - setup_logging("libnetapi", true); - if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) { TALLOC_FREE(frame); return W_ERROR_V(WERR_GENERAL_FAILURE); } + AllowDebugChange = true; + init_names(); load_interfaces(); reopen_logs(); @@ -75,6 +76,24 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) return W_ERROR_V(WERR_OK); } +NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, + const char *debuglevel) +{ + AllowDebugChange = true; + ctx->debuglevel = debuglevel; + if (!debug_parse_levels(debuglevel)) { + return W_ERROR_V(WERR_GENERAL_FAILURE); + } + return W_ERROR_V(WERR_OK); +} + +NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, + const char **debuglevel) +{ + *debuglevel = ctx->debuglevel; + return W_ERROR_V(WERR_OK); +} + NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username) { diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index d75299601f..278922224d 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -23,7 +23,7 @@ #define NET_API_STATUS uint32_t struct libnetapi_ctx { - int debuglevel; + const char *debuglevel; char *username; char *workgroup; char *password; @@ -31,6 +31,8 @@ struct libnetapi_ctx { NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx); NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx); +NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel); +NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, const char **debuglevel); NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username); NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password); NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup); -- cgit From fb2c13fe191212f5e782b398fa4dffa42bfba129 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 02:47:01 +0100 Subject: Add static libnetapi_ctx. Guenther (This used to be commit 97449ea341539a709953a57869570cf13be0f44e) --- source3/lib/netapi/netapi.c | 28 +++++++++++++++++++++++++--- source3/lib/netapi/netapi.h | 1 + 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 454d766ae9..853ac55f8a 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -22,14 +22,16 @@ extern bool AllowDebugChange; +struct libnetapi_ctx *stat_ctx = NULL; +TALLOC_CTX *frame = NULL; static bool libnetapi_initialized = false; NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) { struct libnetapi_ctx *ctx = NULL; - TALLOC_CTX *frame = NULL; - if (libnetapi_initialized) { + if (stat_ctx && libnetapi_initialized) { + *context = stat_ctx; return W_ERROR_V(WERR_OK); } @@ -65,14 +67,34 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) libnetapi_initialized = true; - *context = ctx; + *context = stat_ctx = ctx; return W_ERROR_V(WERR_OK); } +NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx) +{ + if (stat_ctx) { + *ctx = stat_ctx; + return W_ERROR_V(WERR_OK); + } + + return libnetapi_init(ctx); +} + NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) { + gfree_names(); + gfree_loadparm(); + gfree_case_tables(); + gfree_charcnv(); + gfree_interfaces(); + TALLOC_FREE(ctx); + TALLOC_FREE(frame); + + gfree_debugsyms(); + return W_ERROR_V(WERR_OK); } diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 278922224d..0b25c93d5b 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -30,6 +30,7 @@ struct libnetapi_ctx { }; NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx); +NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx); NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx); NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel); NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, const char **debuglevel); -- cgit From 62b3fd209d65caba36595dfbcde83fd74f4047b7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 02:52:34 +0100 Subject: Missed on instance of external creds. Guenther (This used to be commit 65d50f518766ab0a8115c2599d190e642eb00754) --- source3/lib/netapi/joindomain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 8287cd046f..67e53d4391 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -85,8 +85,10 @@ static WERROR NetJoinDomainRemote(TALLOC_CTX *mem_ctx, status = cli_full_connection(&cli, NULL, server_name, NULL, 0, "IPC$", "IPC", - opt_user_name, opt_workgroup, - opt_password, 0, Undefined, NULL); + ctx->username, + ctx->workgroup, + ctx->password, + 0, Undefined, NULL); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); -- cgit From dab660b9dc42b9e5817e59de4c97009796548b92 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 02:54:18 +0100 Subject: Move NetJoinDomain and friends to NET_API_STATUS and the static libnetapi_ctx. Guenther (This used to be commit e640c3a4a7695613e9e619516befbaf3d44ecb10) --- source3/lib/netapi/joindomain.c | 126 +++++++++++++++++++++++++++++++++------- source3/lib/netapi/joindomain.h | 26 ++++----- source3/utils/net_dom.c | 16 ++--- 3 files changed, 127 insertions(+), 41 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 67e53d4391..a0d3319998 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -18,9 +18,11 @@ */ #include "includes.h" -#include "lib/netapi/joindomain.h" -static WERROR NetJoinDomainLocal(TALLOC_CTX *mem_ctx, +#include "lib/netapi/netapi.h" +#include "libnet/libnet.h" + +static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, const char *server_name, const char *domain_name, const char *account_ou, @@ -65,7 +67,7 @@ static WERROR NetJoinDomainLocal(TALLOC_CTX *mem_ctx, return libnet_Join(mem_ctx, r); } -static WERROR NetJoinDomainRemote(TALLOC_CTX *mem_ctx, +static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, const char *account_ou, @@ -105,7 +107,7 @@ static WERROR NetJoinDomainRemote(TALLOC_CTX *mem_ctx, }; if (password) { - encode_wkssvc_join_password_buffer(mem_ctx, + encode_wkssvc_join_password_buffer(ctx, password, &cli->user_session_key, &encrypted_password); @@ -113,7 +115,7 @@ static WERROR NetJoinDomainRemote(TALLOC_CTX *mem_ctx, old_timeout = cli_set_timeout(cli, 60000); - status = rpccli_wkssvc_NetrJoinDomain2(pipe_cli, mem_ctx, + status = rpccli_wkssvc_NetrJoinDomain2(pipe_cli, ctx, server_name, domain_name, account_ou, Account, &encrypted_password, @@ -132,12 +134,13 @@ static WERROR NetJoinDomainRemote(TALLOC_CTX *mem_ctx, return werr; } -WERROR NetJoinDomain(const char *server_name, - const char *domain_name, - const char *account_ou, - const char *Account, - const char *password, - uint32_t join_flags) +static WERROR libnetapi_NetJoinDomain(struct libnetapi_ctx *ctx, + const char *server_name, + const char *domain_name, + const char *account_ou, + const char *Account, + const char *password, + uint32_t join_flags) { TALLOC_CTX *mem_ctx = NULL; WERROR werr; @@ -164,7 +167,7 @@ WERROR NetJoinDomain(const char *server_name, dc = domain_name; } - werr = NetJoinDomainLocal(mem_ctx, + werr = NetJoinDomainLocal(ctx, dc, domain_name, account_ou, @@ -175,7 +178,7 @@ WERROR NetJoinDomain(const char *server_name, goto done; } - werr = NetJoinDomainRemote(mem_ctx, + werr = NetJoinDomainRemote(ctx, server_name, domain_name, account_ou, @@ -188,10 +191,41 @@ done: return werr; } -WERROR NetUnjoinDomain(const char *server_name, - const char *account, - const char *password, - uint32_t unjoin_flags) +NET_API_STATUS NetJoinDomain(const char *server_name, + const char *domain_name, + const char *account_ou, + const char *Account, + const char *password, + uint32_t join_flags) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + werr = libnetapi_NetJoinDomain(ctx, + server_name, + domain_name, + account_ou, + Account, + password, + join_flags); + if (!W_ERROR_IS_OK(werr)) { + return W_ERROR_V(werr); + } + + return 0; +} + +static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, + const char *server_name, + const char *account, + const char *password, + uint32_t unjoin_flags) { TALLOC_CTX *mem_ctx = NULL; struct cli_state *cli = NULL; @@ -266,9 +300,37 @@ WERROR NetUnjoinDomain(const char *server_name, return werr; } -WERROR NetGetJoinInformation(const char *server_name, - const char **name_buffer, - uint16_t *name_type) +NET_API_STATUS NetUnjoinDomain(const char *server_name, + const char *account, + const char *password, + uint32_t unjoin_flags) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + werr = libnetapi_NetUnjoinDomain(ctx, + server_name, + account, + password, + unjoin_flags); + if (!W_ERROR_IS_OK(werr)) { + return W_ERROR_V(werr); + } + + return 0; +} + + +WERROR libnetapi_NetGetJoinInformation(struct libnetapi_ctx *ctx, + const char *server_name, + const char **name_buffer, + uint16_t *name_type) { TALLOC_CTX *mem_ctx = NULL; struct cli_state *cli = NULL; @@ -346,3 +408,27 @@ WERROR NetGetJoinInformation(const char *server_name, return werr; } + +NET_API_STATUS NetGetJoinInformation(const char *server_name, + const char **name_buffer, + uint16_t *name_type) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + werr = libnetapi_NetGetJoinInformation(ctx, + server_name, + name_buffer, + name_type); + if (!W_ERROR_IS_OK(werr)) { + return W_ERROR_V(werr); + } + + return 0; +} diff --git a/source3/lib/netapi/joindomain.h b/source3/lib/netapi/joindomain.h index 73d2ec3d32..b72bc9aecb 100644 --- a/source3/lib/netapi/joindomain.h +++ b/source3/lib/netapi/joindomain.h @@ -20,18 +20,18 @@ #ifndef __LIB_NETAPI_JOINDOMAIN_H__ #define __LIB_NETAPI_JOINDOMAIN_H__ -WERROR NetJoinDomain(const char *server, - const char *domain, - const char *account_ou, - const char *account, - const char *password, - uint32_t join_options); -WERROR NetUnjoinDomain(const char *server_name, - const char *account, - const char *password, - uint32_t unjoin_flags); -WERROR NetGetJoinInformation(const char *server_name, - const char **name_buffer, - uint16_t *name_type); +NET_API_STATUS NetJoinDomain(const char *server, + const char *domain, + const char *account_ou, + const char *account, + const char *password, + uint32_t join_options); +NET_API_STATUS NetUnjoinDomain(const char *server_name, + const char *account, + const char *password, + uint32_t unjoin_flags); +NET_API_STATUS NetGetJoinInformation(const char *server_name, + const char **name_buffer, + uint16_t *name_type); #endif diff --git a/source3/utils/net_dom.c b/source3/utils/net_dom.c index fd386c95a8..7b5f562727 100644 --- a/source3/utils/net_dom.c +++ b/source3/utils/net_dom.c @@ -19,7 +19,7 @@ #include "includes.h" #include "utils/net.h" -#include "lib/netapi/joindomain.h" +#include "lib/netapi/netapi.h" static int net_dom_usage(int argc, const char **argv) { @@ -51,7 +51,7 @@ static int net_dom_unjoin(int argc, const char **argv) struct cli_state *cli = NULL; bool reboot = false; NTSTATUS status; - WERROR werr; + NET_API_STATUS werr; int ret = -1; int i; @@ -90,9 +90,9 @@ static int net_dom_unjoin(int argc, const char **argv) } werr = NetUnjoinDomain(server_name, account, password, unjoin_flags); - if (!W_ERROR_IS_OK(werr)) { + if (werr != 0) { printf("Failed to unjoin domain: %s\n", - get_friendly_nt_error_msg(werror_to_ntstatus(werr))); + get_friendly_nt_error_msg(werror_to_ntstatus(W_ERROR(werr)))); goto done; } @@ -136,7 +136,7 @@ static int net_dom_join(int argc, const char **argv) struct cli_state *cli = NULL; bool reboot = false; NTSTATUS status; - WERROR werr; + NET_API_STATUS werr; int ret = -1; int i; @@ -194,10 +194,10 @@ static int net_dom_join(int argc, const char **argv) werr = NetJoinDomain(server_name, domain_name, account_ou, Account, password, join_flags); - if (!W_ERROR_IS_OK(werr)) { + if (werr != 0) { printf("Failed to join domain: %s (WERROR: %s)\n", - get_friendly_nt_error_msg(werror_to_ntstatus(werr)), - dos_errstr(werr)); + get_friendly_nt_error_msg(werror_to_ntstatus(W_ERROR(werr))), + dos_errstr(W_ERROR(werr))); goto done; } -- cgit From b6347c06935fc769b4bd6cdcbca63c633ba12614 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 10:16:40 +0100 Subject: Making do_DomainJoin return NTSTATUS again. Guenther (This used to be commit 91b884989891881b8abea70e11b87c16c574daaa) --- source3/libnet/libnet_join.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index dd3d2254d8..f787a2d632 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -22,15 +22,14 @@ #include "libnet/libnet_join.h" #include "libnet/libnet_proto.h" -static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, - struct libnet_JoinCtx *r) +static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) { struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_hnd = NULL; const char *password = NULL; POLICY_HND sam_pol, domain_pol, user_pol, lsa_pol; NTSTATUS status = NT_STATUS_UNSUCCESSFUL; - WERROR werr; char *acct_name; const char *const_acct_name; uint32 user_rid; @@ -49,7 +48,7 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, password = talloc_strdup(mem_ctx, generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH)); - W_ERROR_HAVE_NO_MEMORY(password); + NT_STATUS_HAVE_NO_MEMORY(password); status = cli_full_connection(&cli, NULL, r->in.server_name, NULL, 0, @@ -60,20 +59,17 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, 0, Undefined, NULL); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); goto done; } pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &status); if (!pipe_hnd) { - werr = ntstatus_to_werror(status); goto done; } status = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); goto done; } @@ -82,7 +78,6 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, &r->out.netbios_domain_name, &r->out.domain_sid); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); goto done; } @@ -99,14 +94,12 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &status); if (!pipe_hnd) { - werr = ntstatus_to_werror(status); goto done; } status = rpccli_samr_connect(pipe_hnd, mem_ctx, SEC_RIGHTS_MAXIMUM_ALLOWED, &sam_pol); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); goto done; } @@ -115,7 +108,6 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, r->out.domain_sid, &domain_pol); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); goto done; } @@ -128,7 +120,6 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, 0xe005000b, &user_pol, &user_rid); if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) { - werr = WERR_SETUP_ALREADY_JOINED; goto done; } } @@ -142,12 +133,11 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, &const_acct_name, &num_rids, &user_rids, &name_types); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); goto done; } if (name_types[0] != SID_NAME_USER) { - werr = ntstatus_to_werror(NT_STATUS_INVALID_WORKSTATION); + status = NT_STATUS_INVALID_WORKSTATION; goto done; } @@ -157,7 +147,6 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, SEC_RIGHTS_MAXIMUM_ALLOWED, user_rid, &user_pol); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); goto done; } @@ -197,7 +186,6 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, infolevel, &cli->user_session_key, &ctr); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); goto done; } @@ -207,7 +195,7 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, if (!secrets_store_domain_sid(r->out.netbios_domain_name, r->out.domain_sid)) { - werr = WERR_GENERAL_FAILURE; + status = NT_STATUS_INTERNAL_DB_ERROR; goto done; } @@ -215,17 +203,17 @@ static WERROR do_DomainJoin(TALLOC_CTX *mem_ctx, r->out.netbios_domain_name, SEC_CHAN_WKSTA)) { - werr = WERR_GENERAL_FAILURE; + status = NT_STATUS_INTERNAL_DB_ERROR; goto done; } - werr = WERR_OK; + status = NT_STATUS_OK; done: if (cli) { cli_shutdown(cli); } - return werr; + return status; } static WERROR do_modify_val_config(struct registry_key *key, @@ -343,6 +331,7 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { WERROR werr; + NTSTATUS status; if (!r->in.domain_name) { return WERR_INVALID_PARAM; @@ -354,9 +343,12 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - werr = do_DomainJoin(mem_ctx, r); - if (!W_ERROR_IS_OK(werr)) { - return werr; + status = do_DomainJoin(mem_ctx, r); + if (!NT_STATUS_IS_OK(status)) { + if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { + return WERR_SETUP_ALREADY_JOINED; + } + return ntstatus_to_werror(status); } } -- cgit From f3476faa36adeacea4301aff823ec021588cca2e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 10:31:12 +0100 Subject: In libnet join code, try lsa query with level 12 first. Guenther (This used to be commit f0e8d744c92d2602722e04be6266196941362d63) --- source3/libnet/libnet_join.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index f787a2d632..18421056da 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -73,14 +73,6 @@ static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, goto done; } - status = rpccli_lsa_query_info_policy(pipe_hnd, mem_ctx, &lsa_pol, - 5, - &r->out.netbios_domain_name, - &r->out.domain_sid); - if (!NT_STATUS_IS_OK(status)) { - goto done; - } - status = rpccli_lsa_query_info_policy2(pipe_hnd, mem_ctx, &lsa_pol, 12, &r->out.netbios_domain_name, @@ -89,6 +81,16 @@ static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, NULL, &r->out.domain_sid); + if (!NT_STATUS_IS_OK(status)) { + status = rpccli_lsa_query_info_policy(pipe_hnd, mem_ctx, &lsa_pol, + 5, + &r->out.netbios_domain_name, + &r->out.domain_sid); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + } + rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol); cli_rpc_pipe_close(pipe_hnd); -- cgit From 8f65326e9993a5caefde89f9a48cd677a9f0cefd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 18 Dec 2007 11:24:10 +0100 Subject: Build libnetapi shared and static if possible. Guenther (This used to be commit 11e90dcbf5dd1a91118e6a5cee53735d72767c93) --- source3/Makefile.in | 30 +++++++++++++++++++++++------- source3/configure.in | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 9cd035ae71..d12751a16e 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -141,6 +141,7 @@ PIDDIR = @piddir@ LIBSMBCLIENT=bin/libsmbclient.a @LIBSMBCLIENT_SHARED@ LIBSMBSHAREMODES=bin/libsmbsharemodes.a @LIBSMBSHAREMODES_SHARED@ LIBADDNS=bin/libaddns.a @LIBADDNS_SHARED@ +LIBNETAPI=bin/libnetapi.a @LIBNETAPI_SHARED@ FLAGS1 = $(CFLAGS) @FLAGS1@ @SAMBA_CPPFLAGS@ $(CPPFLAGS) FLAGS2 = @@ -198,7 +199,7 @@ EVERYTHING_PROGS = bin/debug2html@EXEEXT@ bin/smbfilter@EXEEXT@ \ bin/log2pcap@EXEEXT@ bin/sharesec@EXEEXT@ bin/ndrdump@EXEEXT@ \ bin/vlp@EXEEXT@ -SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@ +SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@ @LIBNETAPI@ PAM_MODULES = @PAM_MODULES@ @@ -706,10 +707,12 @@ REG_API_OBJ = registry/reg_api.o \ $(UTIL_REG_SMBCONF_OBJ) -LIBNETAPI_OBJ1 = lib/netapi/netapi.o lib/netapi/joindomain.o +LIBNETAPI_OBJ1 = lib/netapi/netapi.o \ + lib/netapi/joindomain.o + LIBNETAPI_OBJ = $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) \ $(REG_API_OBJ) \ - $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \ + $(PARAM_WITHOUT_REG_OBJ) $(LIB_NONSMBD_OBJ) \ $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \ $(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) @@ -1043,7 +1046,7 @@ idl: ##################################################################### -everything: all libsmbclient debug2html smbfilter talloctort replacetort modules torture \ +everything: all libsmbclient libnetapi debug2html smbfilter talloctort replacetort modules torture \ $(EVERYTHING_PROGS) .SUFFIXES: @@ -1408,6 +1411,7 @@ bin/libbigballofmud.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBBIGBALLOFMUD_OBJ) libsmbclient: $(LIBSMBCLIENT) libsmbsharemodes: $(LIBSMBSHAREMODES) libaddns: $(LIBADDNS) +libnetapi: $(LIBNETAPI) # Linker command to link a RPC, VFS, AUTH, CHARSET or PASSDB module. SHLD_MODULE = $(SHLD) $(LDSHFLAGS) $(MODULE_EXPORTS) \ @@ -1744,7 +1748,7 @@ bin/timelimit@EXEEXT@: script/tests/timelimit.o @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(DYNEXP) script/tests/timelimit.o -install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSSPNEGO@ installman installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ @INSTALL_LIBSMBCLIENT@ @INSTALL_PAM_MODULES@ @INSTALL_LIBSMBSHAREMODES@ +install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSSPNEGO@ installman installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ @INSTALL_LIBSMBCLIENT@ @INSTALL_PAM_MODULES@ @INSTALL_LIBSMBSHAREMODES@ @INSTALL_LIBNETAPI@ install-everything: install installmodules @@ -1823,6 +1827,13 @@ installlibaddns: installdirs libaddns -$(INSTALLLIBCMD_SH) bin/libaddns.@SHLIBEXT@ $(DESTDIR)$(LIBDIR) -$(INSTALLLIBCMD_A) bin/libaddns.a $(DESTDIR)$(LIBDIR) +installlibnetapi: installdirs libnetapi + @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) + -$(INSTALLLIBCMD_SH) bin/libnetapi.@SHLIBEXT@ $(DESTDIR)$(LIBDIR) + -$(INSTALLLIBCMD_A) bin/libnetapi.a $(DESTDIR)$(LIBDIR) + -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/libnetapi.h $(DESTDIR)${prefix}/include/samba/libnetapi + -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/joindomain.h $(DESTDIR)${prefix}/include/samba/libnetapi + installpammodules: $(PAM_MODULES) @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(PAMMODULESDIR) @for module in $(PAM_MODULES); do \ @@ -1857,7 +1868,7 @@ showlayout: @echo " swatdir: $(SWATDIR)" -uninstall: uninstallman uninstallservers uninstallbin @UNINSTALL_CIFSMOUNT@ @UNINSTALL_CIFSSPNEGO@ uninstallscripts uninstalldat uninstallswat uninstallmodules @UNINSTALL_LIBSMBCLIENT@ @UNINSTALL_PAM_MODULES@ @UNINSTALL_LIBSMBSHAREMODES@ +uninstall: uninstallman uninstallservers uninstallbin @UNINSTALL_CIFSMOUNT@ @UNINSTALL_CIFSSPNEGO@ uninstallscripts uninstalldat uninstallswat uninstallmodules @UNINSTALL_LIBSMBCLIENT@ @UNINSTALL_PAM_MODULES@ @UNINSTALL_LIBSMBSHAREMODES@ @UNINSTALL_LIBNETAPI@ uninstallman: @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(srcdir) C @@ -1907,6 +1918,11 @@ uninstalllibaddns: -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libaddns.@SHLIBEXT@ -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libaddns.a +uninstalllibnetapi: + -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libnetapi.@SHLIBEXT@ + -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libnetapi.a + -rm -f $(DESTDIR)${prefix}/include/samba/libnetapi/netapi.h + uninstallpammodules: @for module in $(PAM_MODULES); do \ echo "Removing $(DESTDIR)/$(PAMMODULESDIR)/$${module}.@SHLIBEXT@ "; \ @@ -1923,7 +1939,7 @@ clean: delheaders */*.@SHLIBEXT@ */*/*.@SHLIBEXT@ */*/*/*.@SHLIBEXT@ \ $(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(ROOT_SBIN_PROGS) \ $(MODULES) $(TORTURE_PROGS) $(LIBSMBCLIENT) $(LIBADDNS) \ - $(LIBSMBSHAREMODES) $(EVERYTHING_PROGS) \ + $(LIBSMBSHAREMODES) $(EVERYTHING_PROGS) $(LIBNETAPI) \ .headers.stamp */src/*.o proto_exists -rm -rf t_dir diff --git a/source3/configure.in b/source3/configure.in index 6015837a2e..57b74a3db5 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -326,6 +326,10 @@ AC_SUBST(INSTALL_LIBSMBSHAREMODES) AC_SUBST(UNINSTALL_LIBSMBSHAREMODES) AC_SUBST(LIBSMBSHAREMODES_SHARED) AC_SUBST(LIBSMBSHAREMODES) +AC_SUBST(INSTALL_LIBNETAPI) +AC_SUBST(UNINSTALL_LIBNETAPI) +AC_SUBST(LIBNETAPI_SHARED) +AC_SUBST(LIBNETAPI) AC_SUBST(PRINT_LIBS) AC_SUBST(AUTH_LIBS) AC_SUBST(ACL_LIBS) @@ -5066,6 +5070,51 @@ if test $enable_static = yes; then UNINSTALLLIBCMD_A="rm -f" fi +################################################# +# should we build libnetapi? +INSTALL_LIBNETAPI= +UNINSTALL_LIBNETAPI= +LIBNETAPI_SHARED= +LIBNETAPI= +AC_MSG_CHECKING(whether to build the libnetapi shared library) +AC_ARG_WITH(libnetapi, +[ --with-libnetapi Build the libnetapi shared library (default=no undefined API)], +[ case "$withval" in + *) + AC_MSG_RESULT(no) + ;; + yes) + if test $BLDSHARED = true; then + LIBNETAPI_SHARED=bin/libnetapi.$SHLIBEXT + LIBNETAPI=libnetapi + AC_MSG_RESULT(yes) + else + enable_static=yes + AC_MSG_RESULT(no shared library support -- will supply static library) + fi + if test $enable_static = yes; then + LIBNETAPI=libnetapi + fi + INSTALL_LIBNETAPI=installlibnetapi + UNINSTALL_LIBNETAPI=uninstalllibnetapi + ;; + esac ], +[ +# if unspecified, default is to built it if possible. + if test $BLDSHARED = true; then + LIBNETAPI_SHARED=bin/libnetapi.$SHLIBEXT + LIBNETAPI=libnetapi + AC_MSG_RESULT(yes) + else + enable_static=yes + AC_MSG_RESULT(no shared library support -- will supply static library) + fi + if test $enable_static = yes; then + LIBNETAPI=libnetapi + fi] + INSTALL_LIBNETAPI=installlibnetapi +) + ################################################# # should we build libaddns? INSTALL_LIBADDNS= -- cgit From d1548d035f3c296d5044b9aa47fc350cb62e4e2d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 02:25:15 +0100 Subject: Use DsGetDcName in local libnetapi join to find a dc. Guenther (This used to be commit fbc60c1648ff8b1fa0ae33c09237e41232f9769c) --- source3/Makefile.in | 3 ++- source3/lib/netapi/joindomain.c | 34 ++++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index d12751a16e..99f7b447ec 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -715,7 +715,8 @@ LIBNETAPI_OBJ = $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) \ $(PARAM_WITHOUT_REG_OBJ) $(LIB_NONSMBD_OBJ) \ $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \ - $(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) + $(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ + $(DCUTIL_OBJ) $(LIBADS_OBJ) LIBNET_OBJ = libnet/libnet_conf.o libnet/libnet_join.o diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index a0d3319998..c6bf3d687a 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -36,16 +36,31 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, werr = libnet_init_JoinCtx(mem_ctx, &r); W_ERROR_NOT_OK_RETURN(werr); - if (!server_name || !domain_name) { + if (!domain_name) { return WERR_INVALID_PARAM; } - r->in.server_name = talloc_strdup(mem_ctx, server_name); - W_ERROR_HAVE_NO_MEMORY(r->in.server_name); - r->in.domain_name = talloc_strdup(mem_ctx, domain_name); W_ERROR_HAVE_NO_MEMORY(r->in.domain_name); + if (server_name) { + r->in.server_name = talloc_strdup(mem_ctx, server_name); + W_ERROR_HAVE_NO_MEMORY(r->in.server_name); + } else if (join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { + NTSTATUS status; + struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; + uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED | + DS_WRITABLE_REQUIRED | + DS_RETURN_DNS_NAME; + status = DsGetDcName(mem_ctx, NULL, domain_name, + NULL, NULL, flags, &info); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + r->in.server_name = talloc_strdup(mem_ctx, info->domain_controller_name); + W_ERROR_HAVE_NO_MEMORY(r->in.server_name); + } + if (account_ou) { r->in.account_ou = talloc_strdup(mem_ctx, account_ou); W_ERROR_HAVE_NO_MEMORY(r->in.account_ou); @@ -158,17 +173,8 @@ static WERROR libnetapi_NetJoinDomain(struct libnetapi_ctx *ctx, if (!server_name || is_myname_or_ipaddr(server_name)) { - const char *dc = NULL; - - /* FIXME: DsGetDcName */ - if (server_name == NULL) { - dc = domain_name; - } else { - dc = domain_name; - } - werr = NetJoinDomainLocal(ctx, - dc, + server_name, domain_name, account_ou, Account, -- cgit From 14652eab180fa9555607a413e5d1b429d1e1673c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 10:52:45 +0100 Subject: Fix NetJoinDomainLocal. Guenther (This used to be commit 24605c9175fb313c9c888783817da755cd8ce594) --- source3/lib/netapi/joindomain.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index c6bf3d687a..180210f707 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -43,10 +43,7 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, r->in.domain_name = talloc_strdup(mem_ctx, domain_name); W_ERROR_HAVE_NO_MEMORY(r->in.domain_name); - if (server_name) { - r->in.server_name = talloc_strdup(mem_ctx, server_name); - W_ERROR_HAVE_NO_MEMORY(r->in.server_name); - } else if (join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { + if (join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { NTSTATUS status; struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED | -- cgit From 8f7723fc28cf9e71b0d5ef2890dbe95ae3fc5e07 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 10:55:52 +0100 Subject: Remove unrequired TALLOC_CTX from libnetapi_NetJoinDomain & friends. Guenther (This used to be commit 96ebdca45b998da7e6137973dea717bf3ac76328) --- source3/lib/netapi/joindomain.c | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 180210f707..08a39549f9 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -154,44 +154,28 @@ static WERROR libnetapi_NetJoinDomain(struct libnetapi_ctx *ctx, const char *password, uint32_t join_flags) { - TALLOC_CTX *mem_ctx = NULL; - WERROR werr; - - mem_ctx = talloc_init("NetJoinDomain"); - if (!mem_ctx) { - werr = WERR_NOMEM; - goto done; - } - if (!domain_name) { - werr = WERR_INVALID_PARAM; - goto done; + return WERR_INVALID_PARAM; } if (!server_name || is_myname_or_ipaddr(server_name)) { - werr = NetJoinDomainLocal(ctx, + return NetJoinDomainLocal(ctx, server_name, domain_name, account_ou, Account, password, join_flags); - - goto done; } - werr = NetJoinDomainRemote(ctx, + return NetJoinDomainRemote(ctx, server_name, domain_name, account_ou, Account, password, join_flags); -done: - TALLOC_FREE(mem_ctx); - - return werr; } NET_API_STATUS NetJoinDomain(const char *server_name, @@ -230,7 +214,6 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, const char *password, uint32_t unjoin_flags) { - TALLOC_CTX *mem_ctx = NULL; struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_cli = NULL; struct wkssvc_PasswordBuffer encrypted_password; @@ -240,17 +223,6 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, ZERO_STRUCT(encrypted_password); - mem_ctx = talloc_init("NetUnjoinDomain"); - if (!mem_ctx) { - werr = WERR_NOMEM; - goto done; - } - - if (!server_name || is_myname_or_ipaddr(server_name)) { - werr = WERR_NOT_SUPPORTED; - goto done; - } - status = cli_full_connection(&cli, NULL, server_name, NULL, 0, "IPC$", "IPC", @@ -274,7 +246,7 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, }; if (password) { - encode_wkssvc_join_password_buffer(mem_ctx, + encode_wkssvc_join_password_buffer(ctx, password, &cli->user_session_key, &encrypted_password); @@ -282,7 +254,7 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, old_timeout = cli_set_timeout(cli, 60000); - status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, mem_ctx, + status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, ctx, server_name, account, &encrypted_password, @@ -298,7 +270,6 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, cli_set_timeout(cli, old_timeout); cli_shutdown(cli); } - TALLOC_FREE(mem_ctx); return werr; } -- cgit From 41467ffc6d2588bfc9cd112586f6036c185536b2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 11:02:39 +0100 Subject: Add libnet_Unjoin(), libnet_UnjoinCtx and friends. Guenther (This used to be commit 89e8abb1163984eed358a4da9be4699a8e3a43f9) --- source3/libnet/libnet_join.c | 226 ++++++++++++++++++++++++++++++++++++++++++- source3/libnet/libnet_join.h | 17 ++++ 2 files changed, 239 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 18421056da..68434bd391 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -218,6 +218,119 @@ static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, return status; } +static NTSTATUS do_DomainUnjoin(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r) +{ + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_hnd = NULL; + POLICY_HND sam_pol, domain_pol, user_pol; + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + char *acct_name; + uint32 flags = 0x3e8; + const char *const_acct_name; + uint32 user_rid; + uint32 num_rids, *name_types, *user_rids; + SAM_USERINFO_CTR ctr, *qctr = NULL; + SAM_USER_INFO_16 p16; + + status = cli_full_connection(&cli, NULL, r->in.server_name, + NULL, 0, + "IPC$", "IPC", + r->in.admin_account, + NULL, //r->in.domain_name, + r->in.password, + 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &status); + if (!pipe_hnd) { + goto done; + } + + status = rpccli_samr_connect(pipe_hnd, mem_ctx, + SEC_RIGHTS_MAXIMUM_ALLOWED, &sam_pol); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + status = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &sam_pol, + SEC_RIGHTS_MAXIMUM_ALLOWED, + r->in.domain_sid, + &domain_pol); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname()); + strlower_m(acct_name); + const_acct_name = acct_name; + + status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx, + &domain_pol, flags, 1, + &const_acct_name, + &num_rids, &user_rids, &name_types); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + if (name_types[0] != SID_NAME_USER) { + status = NT_STATUS_INVALID_WORKSTATION; + goto done; + } + + user_rid = user_rids[0]; + + status = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol, + SEC_RIGHTS_MAXIMUM_ALLOWED, + user_rid, &user_pol); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + status = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, + &user_pol, 16, &qctr); + if (!NT_STATUS_IS_OK(status)) { + rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + goto done; + } + + ZERO_STRUCT(ctr); + ctr.switch_value = 16; + ctr.info.id16 = &p16; + + p16.acb_info = qctr->info.id16->acb_info | ACB_DISABLED; + + status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16, + &cli->user_session_key, &ctr); + + rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + + if (!secrets_delete_machine_password_ex(lp_workgroup())) { + status = NT_STATUS_INTERNAL_DB_ERROR; + goto done; + } + + if (!secrets_delete_domain_sid(lp_workgroup())) { + status = NT_STATUS_INTERNAL_DB_ERROR; + goto done; + } + +done: + rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_close(pipe_hnd, mem_ctx, &sam_pol); + + cli_rpc_pipe_close(pipe_hnd); + + if (cli) { + cli_shutdown(cli); + } + + return status; +} + static WERROR do_modify_val_config(struct registry_key *key, const char *val_name, const char *val_data) @@ -233,9 +346,9 @@ static WERROR do_modify_val_config(struct registry_key *key, return reg_setvalue(key, val_name, &val); } -static WERROR do_modify_vals_config(TALLOC_CTX *mem_ctx, - struct libnet_JoinCtx *r, - struct registry_key *key) +static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r, + struct registry_key *key) { WERROR werr; bool is_ad = false; @@ -273,6 +386,24 @@ static WERROR do_modify_vals_config(TALLOC_CTX *mem_ctx, return werr; } +static WERROR do_unjoin_modify_vals_config(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r, + struct registry_key *key) +{ + WERROR werr; + + if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { + + werr = do_modify_val_config(key, "security", "user"); + W_ERROR_NOT_OK_RETURN(werr); + } + + reg_deletevalue(key, "realm"); + + return werr; +} + + static WERROR do_JoinConfig(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { @@ -303,7 +434,48 @@ static WERROR do_JoinConfig(TALLOC_CTX *mem_ctx, return werr; } - werr = do_modify_vals_config(mem_ctx, r, key); + werr = do_join_modify_vals_config(mem_ctx, r, key); + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + r->out.modified_config = true; + r->out.result = werr; + + return werr; +} + +static WERROR do_UnjoinConfig(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r) +{ + WERROR werr; + struct registry_key *key = NULL; + + if (!W_ERROR_IS_OK(r->out.result)) { + return r->out.result; + } + + if (!r->in.modify_config) { + return WERR_OK; + } + + if (!registry_init_regdb()) { + return WERR_REG_IO_FAILURE; + } + + if (!libnet_smbconf_key_exists(mem_ctx, GLOBAL_NAME)) { + werr = libnet_reg_createkey_internal(mem_ctx, + GLOBAL_NAME, &key); + } else { + werr = libnet_smbconf_open_path(mem_ctx, + GLOBAL_NAME, + REG_KEY_WRITE, &key); + } + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + werr = do_unjoin_modify_vals_config(mem_ctx, r, key); if (!W_ERROR_IS_OK(werr)) { return werr; } @@ -329,6 +501,21 @@ WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx, return WERR_OK; } +WERROR libnet_init_UnjoinCtx(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx **r) +{ + struct libnet_UnjoinCtx *ctx; + + ctx = talloc_zero(mem_ctx, struct libnet_UnjoinCtx); + if (!ctx) { + return WERR_NOMEM; + } + + *r = ctx; + + return WERR_OK; +} + WERROR libnet_Join(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { @@ -361,3 +548,34 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, return werr; } + +WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r) +{ + WERROR werr; + NTSTATUS status; + + printf("libnet_Unjoin\n"); + + if (r->in.modify_config && !lp_include_registry_globals()) { + return WERR_NOT_SUPPORTED; + } + + if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { + + status = do_DomainUnjoin(mem_ctx, r); + if (!NT_STATUS_IS_OK(status)) { + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { + return WERR_SETUP_NOT_JOINED; + } + return ntstatus_to_werror(status); + } + } + + werr = do_UnjoinConfig(mem_ctx, r); + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + return werr; +} diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h index 9596733cee..46ab27e8b0 100644 --- a/source3/libnet/libnet_join.h +++ b/source3/libnet/libnet_join.h @@ -39,8 +39,25 @@ struct libnet_JoinCtx { char *netbios_domain_name; char *dns_domain_name; char *dn; + struct dom_sid *domain_sid; bool modified_config; + WERROR result; + } out; +}; + +struct libnet_UnjoinCtx { + struct { + const char *server_name; + const char *domain_name; + const char *admin_account; + const char *password; + uint32_t unjoin_flags; + bool modify_config; struct dom_sid *domain_sid; + } in; + + struct { + bool modified_config; WERROR result; } out; }; -- cgit From 75276ac2e3cb2d92e17231c906128bf98eea5d50 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 11:03:45 +0100 Subject: Add support for remote and local unjoining in libnetapi. Guenther (This used to be commit 74048fe7cfbd05994d533bea4a477d6ca93449d9) --- source3/lib/netapi/joindomain.c | 94 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 89 insertions(+), 5 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 08a39549f9..2cc93e2545 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -208,11 +208,73 @@ NET_API_STATUS NetJoinDomain(const char *server_name, return 0; } -static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, - const char *server_name, - const char *account, - const char *password, - uint32_t unjoin_flags) +static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, + const char *server_name, + const char *account, + const char *password, + uint32_t unjoin_flags) +{ + struct libnet_UnjoinCtx *r = NULL; + struct dom_sid domain_sid; + WERROR werr; + + if (!secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) { + return WERR_SETUP_NOT_JOINED; + } + + werr = libnet_init_UnjoinCtx(mem_ctx, &r); + W_ERROR_NOT_OK_RETURN(werr); + + if (server_name) { + r->in.server_name = talloc_strdup(mem_ctx, server_name); + W_ERROR_HAVE_NO_MEMORY(r->in.server_name); + } else { + + NTSTATUS status; + const char *domain = NULL; + struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; + uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED | + DS_WRITABLE_REQUIRED | + DS_IS_FLAT_NAME | + DS_RETURN_DNS_NAME; + if (lp_realm()) { + domain = lp_realm(); + } else { + domain = lp_workgroup(); + } + status = DsGetDcName(mem_ctx, NULL, domain, + NULL, NULL, flags, &info); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + r->in.server_name = talloc_strdup(mem_ctx, info->domain_controller_name); + W_ERROR_HAVE_NO_MEMORY(r->in.server_name); + } + + if (account) { + r->in.admin_account = talloc_strdup(mem_ctx, account); + W_ERROR_HAVE_NO_MEMORY(r->in.admin_account); + } + + if (password) { + r->in.password = talloc_strdup(mem_ctx, password); + W_ERROR_HAVE_NO_MEMORY(r->in.password); + } + + r->in.unjoin_flags = unjoin_flags; + r->in.modify_config = true; + + r->in.domain_sid = &domain_sid; + + return libnet_Unjoin(mem_ctx, r); + +} + +static WERROR NetUnjoinDomainRemote(struct libnetapi_ctx *ctx, + const char *server_name, + const char *account, + const char *password, + uint32_t unjoin_flags) { struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_cli = NULL; @@ -274,6 +336,28 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, return werr; } +static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, + const char *server_name, + const char *account, + const char *password, + uint32_t unjoin_flags) +{ + if (!server_name || is_myname_or_ipaddr(server_name)) { + + return NetUnjoinDomainLocal(ctx, + server_name, + account, + password, + unjoin_flags); + } + + return NetUnjoinDomainRemote(ctx, + server_name, + account, + password, + unjoin_flags); +} + NET_API_STATUS NetUnjoinDomain(const char *server_name, const char *account, const char *password, -- cgit From af08d8be3063ada42637a4ae7437499b03457de2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 12:09:08 +0100 Subject: Add libnetapi_errstr(). Guenther (This used to be commit 465e61a3599a277366ada6ecda3a1e6ddb1f2490) --- source3/lib/netapi/netapi.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ source3/lib/netapi/netapi.h | 1 + 2 files changed, 51 insertions(+) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 853ac55f8a..70d7e654a7 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -148,3 +148,53 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, } return W_ERROR_V(WERR_OK); } + +const char *libnetapi_errstr(struct libnetapi_ctx *ctx, + NET_API_STATUS status) +{ + const char *err_str = NULL; + + switch (status) { + case 0: + err_str = "Success"; + break; + case 0x00000057: /* WERR_INVALID_PARAM */ + err_str = "Invalid parameter"; + break; + case 0x0000052E: /* WERR_LOGON_FAILURE */ + err_str = "Invalid logon credentials"; + break; + case 0x00000995: /* WERR_DOMAIN_CONTROLLER_NOT_FOUND */ + err_str = "A domain controller could not be found"; + break; + case 0x00000a84: /* WERR_SETUP_NOT_JOINED */ + err_str = "Join failed"; + break; + case 0x00000a83: /* WERR_SETUP_ALREADY_JOINED */ + err_str = "Machine is already joined"; + break; + case 0x00000a85: /* WERR_SETUP_DOMAIN_CONTROLLER */ + err_str = "Machine is a Domain Controller"; + break; + case 0x00000032: /* WERR_NOT_SUPPORTED */ + err_str = "Not supported"; + break; + case 0x0000051f: /* WERR_NO_LOGON_SERVERS */ + err_str = "No logon servers found"; + break; + case 0x00000056: /* WERR_BAD_PASSWORD */ + err_str = "A bad password was supplied"; + break; + case 0x00000520: /* WERR_NO_SUCH_LOGON_SESSION */ + err_str = "No such logon session"; + break; + default: + err_str = talloc_asprintf(ctx, "0x%08x", status); + if (!err_str) { + return NULL; + } + break; + } + + return err_str; +} diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 0b25c93d5b..232d9c154f 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -37,6 +37,7 @@ NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, const char ** NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username); NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password); NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup); +const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status); #include "joindomain.h" -- cgit From 2bed9564dbe4fc3bc86d6ba231c5f2ecce468b5a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 13:52:51 +0100 Subject: Split out local and remote paths for NetGetJoinInformation. Guenther (This used to be commit d1e4f9dd5cde79f915e3e0f652621d966aa850e8) --- source3/lib/netapi/joindomain.c | 92 +++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 2cc93e2545..0c8d645db9 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -384,50 +384,16 @@ NET_API_STATUS NetUnjoinDomain(const char *server_name, return 0; } - -WERROR libnetapi_NetGetJoinInformation(struct libnetapi_ctx *ctx, - const char *server_name, - const char **name_buffer, - uint16_t *name_type) +static WERROR NetGetJoinInformationRemote(struct libnetapi_ctx *ctx, + const char *server_name, + const char **name_buffer, + uint16_t *name_type) { - TALLOC_CTX *mem_ctx = NULL; struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_cli = NULL; NTSTATUS status; WERROR werr; - mem_ctx = talloc_init("NetGetJoinInformation"); - if (!mem_ctx) { - werr = WERR_NOMEM; - goto done; - } - - if (!server_name || is_myname_or_ipaddr(server_name)) { - if ((lp_security() == SEC_ADS) && lp_realm()) { - *name_buffer = SMB_STRDUP(lp_realm()); - } else { - *name_buffer = SMB_STRDUP(lp_workgroup()); - } - if (!*name_buffer) { - werr = WERR_NOMEM; - goto done; - } - switch (lp_server_role()) { - case ROLE_DOMAIN_MEMBER: - case ROLE_DOMAIN_PDC: - case ROLE_DOMAIN_BDC: - *name_type = NetSetupDomainName; - break; - case ROLE_STANDALONE: - default: - *name_type = NetSetupWorkgroupName; - break; - } - - werr = WERR_OK; - goto done; - } - status = cli_full_connection(&cli, NULL, server_name, NULL, 0, "IPC$", "IPC", @@ -448,7 +414,7 @@ WERROR libnetapi_NetGetJoinInformation(struct libnetapi_ctx *ctx, goto done; }; - status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, mem_ctx, + status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, ctx, server_name, name_buffer, (enum wkssvc_NetJoinStatus *)name_type, @@ -462,11 +428,57 @@ WERROR libnetapi_NetGetJoinInformation(struct libnetapi_ctx *ctx, if (cli) { cli_shutdown(cli); } - TALLOC_FREE(mem_ctx); return werr; } +static WERROR NetGetJoinInformationLocal(struct libnetapi_ctx *ctx, + const char *server_name, + const char **name_buffer, + uint16_t *name_type) +{ + if ((lp_security() == SEC_ADS) && lp_realm()) { + *name_buffer = SMB_STRDUP(lp_realm()); + } else { + *name_buffer = SMB_STRDUP(lp_workgroup()); + } + if (!*name_buffer) { + return WERR_NOMEM; + } + + switch (lp_server_role()) { + case ROLE_DOMAIN_MEMBER: + case ROLE_DOMAIN_PDC: + case ROLE_DOMAIN_BDC: + *name_type = NetSetupDomainName; + break; + case ROLE_STANDALONE: + default: + *name_type = NetSetupWorkgroupName; + break; + } + + return WERR_OK; +} + +WERROR libnetapi_NetGetJoinInformation(struct libnetapi_ctx *ctx, + const char *server_name, + const char **name_buffer, + uint16_t *name_type) +{ + if (!server_name || is_myname_or_ipaddr(server_name)) { + return NetGetJoinInformationLocal(ctx, + server_name, + name_buffer, + name_type); + } + + return NetGetJoinInformationRemote(ctx, + server_name, + name_buffer, + name_type); +} + NET_API_STATUS NetGetJoinInformation(const char *server_name, const char **name_buffer, uint16_t *name_type) -- cgit From 721d36df8372dd45430a93c99180bb94ec7d9773 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 15:10:24 +0100 Subject: Add NetServerGetInfo and NetServerSetInfo (for level 1005). Guenther (This used to be commit 1cad549f54563c3a9787624ba7a56b54107ebd57) --- source3/Makefile.in | 4 +- source3/lib/netapi/netapi.h | 1 + source3/lib/netapi/serverinfo.c | 297 ++++++++++++++++++++++++++++++++++++++++ source3/lib/netapi/serverinfo.h | 30 ++++ 4 files changed, 331 insertions(+), 1 deletion(-) create mode 100644 source3/lib/netapi/serverinfo.c create mode 100644 source3/lib/netapi/serverinfo.h diff --git a/source3/Makefile.in b/source3/Makefile.in index 99f7b447ec..fd59ada3f5 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -708,7 +708,8 @@ REG_API_OBJ = registry/reg_api.o \ LIBNETAPI_OBJ1 = lib/netapi/netapi.o \ - lib/netapi/joindomain.o + lib/netapi/joindomain.o \ + lib/netapi/serverinfo.o LIBNETAPI_OBJ = $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) \ $(REG_API_OBJ) \ @@ -1834,6 +1835,7 @@ installlibnetapi: installdirs libnetapi -$(INSTALLLIBCMD_A) bin/libnetapi.a $(DESTDIR)$(LIBDIR) -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/libnetapi.h $(DESTDIR)${prefix}/include/samba/libnetapi -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/joindomain.h $(DESTDIR)${prefix}/include/samba/libnetapi + -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/serverinfo.h $(DESTDIR)${prefix}/include/samba/libnetapi installpammodules: $(PAM_MODULES) @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(PAMMODULESDIR) diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 232d9c154f..a1137b45ee 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -40,5 +40,6 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *wo const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status); #include "joindomain.h" +#include "serverinfo.h" #endif diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c new file mode 100644 index 0000000000..d6031b69d2 --- /dev/null +++ b/source3/lib/netapi/serverinfo.c @@ -0,0 +1,297 @@ +/* + * Unix SMB/CIFS implementation. + * NetApi Server Support + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" + +#include "lib/netapi/netapi.h" +#include "libnet/libnet.h" + +static WERROR NetServerGetInfoLocal_1005(struct libnetapi_ctx *ctx, + uint8_t **buffer) +{ + struct srvsvc_NetSrvInfo1005 info1005; + + info1005.comment = lp_serverstring(); + *buffer = (uint8_t *)talloc_memdup(ctx, &info1005, sizeof(info1005)); + if (!*buffer) { + return WERR_NOMEM; + } + + return WERR_OK; +} + +static WERROR NetServerGetInfoLocal(struct libnetapi_ctx *ctx, + const char *server_name, + uint32_t level, + uint8_t **buffer) +{ + switch (level) { + case 1005: + return NetServerGetInfoLocal_1005(ctx, buffer); + default: + return WERR_UNKNOWN_LEVEL; + } + + return WERR_UNKNOWN_LEVEL; +} + +static WERROR NetServerGetInfoRemote(struct libnetapi_ctx *ctx, + const char *server_name, + uint32_t level, + uint8_t **buffer) +{ + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_cli = NULL; + NTSTATUS status; + WERROR werr; + union srvsvc_NetSrvInfo info; + + status = cli_full_connection(&cli, NULL, server_name, + NULL, 0, + "IPC$", "IPC", + ctx->username, + ctx->workgroup, + ctx->password, + 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC, + &status); + if (!pipe_cli) { + werr = ntstatus_to_werror(status); + goto done; + }; + + status = rpccli_srvsvc_NetSrvGetInfo(pipe_cli, ctx, + server_name, + level, + &info, + &werr); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + *buffer = (uint8_t *)&info; + + done: + if (cli) { + cli_shutdown(cli); + } + + return werr; +} + +WERROR libnetapi_NetServerGetInfo(struct libnetapi_ctx *ctx, + const char *server_name, + uint32_t level, + uint8_t **buffer) +{ + if (!server_name || is_myname_or_ipaddr(server_name)) { + return NetServerGetInfoLocal(ctx, + server_name, + level, + buffer); + } + + return NetServerGetInfoRemote(ctx, + server_name, + level, + buffer); + +} + +NET_API_STATUS NetServerGetInfo(const char *server_name, + uint32_t level, + uint8_t **buffer) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + werr = libnetapi_NetServerGetInfo(ctx, + server_name, + level, + buffer); + if (!W_ERROR_IS_OK(werr)) { + return W_ERROR_V(werr); + } + + return 0; +} + +static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, + uint8_t *buffer, + uint32_t *parm_error) +{ + struct srvsvc_NetSrvInfo1005 *info1005; + + if (!buffer) { + *parm_error = 1005; /* sure here ? */ + return WERR_INVALID_PARAM; + } + + info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer; + + if (!info1005->comment) { + *parm_error = 1005; + return WERR_INVALID_PARAM; + } + + /* + return libnet_conf_set_parm(GLOBAL_NAME, + "server string", + info1005->comment); + */ + return WERR_NOT_SUPPORTED; +} + +static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx, + const char *server_name, + uint32_t level, + uint8_t *buffer, + uint32_t *parm_error) +{ + switch (level) { + case 1005: + return NetServerSetInfoLocal_1005(ctx, buffer, parm_error); + break; + default: + return WERR_UNKNOWN_LEVEL; + } + + return WERR_UNKNOWN_LEVEL; +} + +static WERROR NetServerSetInfoRemote(struct libnetapi_ctx *ctx, + const char *server_name, + uint32_t level, + uint8_t *buffer, + uint32_t *parm_error) +{ + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_cli = NULL; + NTSTATUS status; + WERROR werr; + union srvsvc_NetSrvInfo info; + + status = cli_full_connection(&cli, NULL, server_name, + NULL, 0, + "IPC$", "IPC", + ctx->username, + ctx->workgroup, + ctx->password, + 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC, + &status); + if (!pipe_cli) { + werr = ntstatus_to_werror(status); + goto done; + }; + + switch (level) { + case 1005: + info.info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer; + break; + default: + werr = WERR_NOT_SUPPORTED; + goto done; + } + + status = rpccli_srvsvc_NetSrvSetInfo(pipe_cli, ctx, + server_name, + level, + info, + parm_error, + &werr); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + done: + if (cli) { + cli_shutdown(cli); + } + + return werr; +} + +WERROR libnetapi_NetServerSetInfo(struct libnetapi_ctx *ctx, + const char *server_name, + uint32_t level, + uint8_t *buffer, + uint32_t *parm_error) +{ + if (!server_name || is_myname_or_ipaddr(server_name)) { + return NetServerSetInfoLocal(ctx, + server_name, + level, + buffer, + parm_error); + } + + return NetServerSetInfoRemote(ctx, + server_name, + level, + buffer, + parm_error); +} + + +NET_API_STATUS NetServerSetInfo(const char *server_name, + uint32_t level, + uint8_t *buffer, + uint32_t *parm_error) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + werr = libnetapi_NetServerSetInfo(ctx, + server_name, + level, + buffer, + parm_error); + if (!W_ERROR_IS_OK(werr)) { + return W_ERROR_V(werr); + } + + return 0; +} diff --git a/source3/lib/netapi/serverinfo.h b/source3/lib/netapi/serverinfo.h new file mode 100644 index 0000000000..66c406657a --- /dev/null +++ b/source3/lib/netapi/serverinfo.h @@ -0,0 +1,30 @@ +/* + * Unix SMB/CIFS implementation. + * NetApi Support + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LIB_NETAPI_SERVERINFO_H__ +#define __LIB_NETAPI_SERVERINFO_H__ + +NET_API_STATUS NetServerGetInfo(const char *server_name, + uint32_t level, + uint8_t **buffer); +NET_API_STATUS NetServerSetInfo(const char *server_name, + uint32_t level, + uint8_t *buffer, + uint32_t *parm_error); +#endif -- cgit From 991112eda710c97dff607dd615c777023395da65 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 19 Dec 2007 16:07:40 +0100 Subject: Implement NetServerSetInfo level 1005 in local mode with smbconf registry. Guenther (This used to be commit 15c2bc15f20a677c3c94895150e396275de6ac9b) --- source3/lib/netapi/serverinfo.c | 14 ++++++------- source3/libnet/libnet_conf.c | 46 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index d6031b69d2..d1bfa47649 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -163,12 +163,13 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, return WERR_INVALID_PARAM; } - /* - return libnet_conf_set_parm(GLOBAL_NAME, - "server string", - info1005->comment); - */ - return WERR_NOT_SUPPORTED; + if (!lp_include_registry_globals()) { + return WERR_NOT_SUPPORTED; + } + + return libnet_smbconf_set_global_param(ctx, + "server string", + info1005->comment); } static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx, @@ -180,7 +181,6 @@ static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx, switch (level) { case 1005: return NetServerSetInfoLocal_1005(ctx, buffer, parm_error); - break; default: return WERR_UNKNOWN_LEVEL; } diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index f394e02e20..8bc5161268 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -147,3 +147,49 @@ done: return werr; } +static WERROR do_modify_val_config(struct registry_key *key, + const char *val_name, + const char *val_data) +{ + struct registry_value val; + + ZERO_STRUCT(val); + + val.type = REG_SZ; + val.v.sz.str = CONST_DISCARD(char *, val_data); + val.v.sz.len = strlen(val_data) + 1; + + return reg_setvalue(key, val_name, &val); +} + +WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx, + const char *param, + const char *val) +{ + WERROR werr; + struct registry_key *key = NULL; + + if (!lp_include_registry_globals()) { + return WERR_NOT_SUPPORTED; + } + + if (!registry_init_regdb()) { + return WERR_REG_IO_FAILURE; + } + + if (!libnet_smbconf_key_exists(mem_ctx, GLOBAL_NAME)) { + werr = libnet_reg_createkey_internal(mem_ctx, + GLOBAL_NAME, &key); + } else { + werr = libnet_smbconf_open_path(mem_ctx, + GLOBAL_NAME, + REG_KEY_WRITE, &key); + } + + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + return do_modify_val_config(key, param, val); +} + -- cgit From 5479c50c37ee78037a96df8844fd06b1b0c9ccbb Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 20 Dec 2007 01:19:26 +0100 Subject: Merge all headers into libnetapi.h. Guenther (This used to be commit a2c5beda2ec98dea8951fb3a37774f5f325410ef) --- source3/Makefile.in | 6 ++---- source3/lib/netapi/joindomain.h | 37 ------------------------------------- source3/lib/netapi/netapi.h | 24 ++++++++++++++++++++++-- source3/lib/netapi/serverinfo.h | 30 ------------------------------ 4 files changed, 24 insertions(+), 73 deletions(-) delete mode 100644 source3/lib/netapi/joindomain.h delete mode 100644 source3/lib/netapi/serverinfo.h diff --git a/source3/Makefile.in b/source3/Makefile.in index fd59ada3f5..d1515c6a48 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1833,9 +1833,7 @@ installlibnetapi: installdirs libnetapi @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) -$(INSTALLLIBCMD_SH) bin/libnetapi.@SHLIBEXT@ $(DESTDIR)$(LIBDIR) -$(INSTALLLIBCMD_A) bin/libnetapi.a $(DESTDIR)$(LIBDIR) - -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/libnetapi.h $(DESTDIR)${prefix}/include/samba/libnetapi - -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/joindomain.h $(DESTDIR)${prefix}/include/samba/libnetapi - -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/serverinfo.h $(DESTDIR)${prefix}/include/samba/libnetapi + -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/libnetapi.h $(DESTDIR)${prefix}/include installpammodules: $(PAM_MODULES) @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(PAMMODULESDIR) @@ -1924,7 +1922,7 @@ uninstalllibaddns: uninstalllibnetapi: -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libnetapi.@SHLIBEXT@ -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libnetapi.a - -rm -f $(DESTDIR)${prefix}/include/samba/libnetapi/netapi.h + -rm -f $(DESTDIR)${prefix}/include/libnetapi.h uninstallpammodules: @for module in $(PAM_MODULES); do \ diff --git a/source3/lib/netapi/joindomain.h b/source3/lib/netapi/joindomain.h deleted file mode 100644 index b72bc9aecb..0000000000 --- a/source3/lib/netapi/joindomain.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * NetApi Support - * Copyright (C) Guenther Deschner 2007 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef __LIB_NETAPI_JOINDOMAIN_H__ -#define __LIB_NETAPI_JOINDOMAIN_H__ - -NET_API_STATUS NetJoinDomain(const char *server, - const char *domain, - const char *account_ou, - const char *account, - const char *password, - uint32_t join_options); -NET_API_STATUS NetUnjoinDomain(const char *server_name, - const char *account, - const char *password, - uint32_t unjoin_flags); -NET_API_STATUS NetGetJoinInformation(const char *server_name, - const char **name_buffer, - uint16_t *name_type); - -#endif diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index a1137b45ee..bbd2282a77 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -39,7 +39,27 @@ NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *pas NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup); const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status); -#include "joindomain.h" -#include "serverinfo.h" +/* wkssvc */ +NET_API_STATUS NetJoinDomain(const char *server, + const char *domain, + const char *account_ou, + const char *account, + const char *password, + uint32_t join_options); +NET_API_STATUS NetUnjoinDomain(const char *server_name, + const char *account, + const char *password, + uint32_t unjoin_flags); +NET_API_STATUS NetGetJoinInformation(const char *server_name, + const char **name_buffer, + uint16_t *name_type); +/* srvsvc */ +NET_API_STATUS NetServerGetInfo(const char *server_name, + uint32_t level, + uint8_t **buffer); +NET_API_STATUS NetServerSetInfo(const char *server_name, + uint32_t level, + uint8_t *buffer, + uint32_t *parm_error); #endif diff --git a/source3/lib/netapi/serverinfo.h b/source3/lib/netapi/serverinfo.h deleted file mode 100644 index 66c406657a..0000000000 --- a/source3/lib/netapi/serverinfo.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * NetApi Support - * Copyright (C) Guenther Deschner 2007 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef __LIB_NETAPI_SERVERINFO_H__ -#define __LIB_NETAPI_SERVERINFO_H__ - -NET_API_STATUS NetServerGetInfo(const char *server_name, - uint32_t level, - uint8_t **buffer); -NET_API_STATUS NetServerSetInfo(const char *server_name, - uint32_t level, - uint8_t *buffer, - uint32_t *parm_error); -#endif -- cgit From f2fe17245436f8e68be2d5ad96b77721828f040a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 20 Dec 2007 12:12:06 +0100 Subject: Keep libnetapi_NetX calls static for now. Guenther (This used to be commit c255654c68923aca3e258906e49be82d719d5ccd) --- source3/lib/netapi/joindomain.c | 8 ++++---- source3/lib/netapi/serverinfo.c | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 0c8d645db9..0c3e021520 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -461,10 +461,10 @@ static WERROR NetGetJoinInformationLocal(struct libnetapi_ctx *ctx, return WERR_OK; } -WERROR libnetapi_NetGetJoinInformation(struct libnetapi_ctx *ctx, - const char *server_name, - const char **name_buffer, - uint16_t *name_type) +static WERROR libnetapi_NetGetJoinInformation(struct libnetapi_ctx *ctx, + const char *server_name, + const char **name_buffer, + uint16_t *name_type) { if (!server_name || is_myname_or_ipaddr(server_name)) { return NetGetJoinInformationLocal(ctx, diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index d1bfa47649..276a98c15e 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -102,10 +102,10 @@ static WERROR NetServerGetInfoRemote(struct libnetapi_ctx *ctx, return werr; } -WERROR libnetapi_NetServerGetInfo(struct libnetapi_ctx *ctx, - const char *server_name, - uint32_t level, - uint8_t **buffer) +static WERROR libnetapi_NetServerGetInfo(struct libnetapi_ctx *ctx, + const char *server_name, + uint32_t level, + uint8_t **buffer) { if (!server_name || is_myname_or_ipaddr(server_name)) { return NetServerGetInfoLocal(ctx, @@ -248,11 +248,11 @@ static WERROR NetServerSetInfoRemote(struct libnetapi_ctx *ctx, return werr; } -WERROR libnetapi_NetServerSetInfo(struct libnetapi_ctx *ctx, - const char *server_name, - uint32_t level, - uint8_t *buffer, - uint32_t *parm_error) +static WERROR libnetapi_NetServerSetInfo(struct libnetapi_ctx *ctx, + const char *server_name, + uint32_t level, + uint8_t *buffer, + uint32_t *parm_error) { if (!server_name || is_myname_or_ipaddr(server_name)) { return NetServerSetInfoLocal(ctx, -- cgit From 3537af86c409ea7478e3414a17d7ff3779e4bdbe Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 20 Dec 2007 12:13:04 +0100 Subject: Fix typo. Guenther (This used to be commit b95801db595109e8eade7cf7c344f281c8684249) --- source3/libnet/libnet_join.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 68434bd391..b1ebed3e15 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -555,8 +555,6 @@ WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx, WERROR werr; NTSTATUS status; - printf("libnet_Unjoin\n"); - if (r->in.modify_config && !lp_include_registry_globals()) { return WERR_NOT_SUPPORTED; } -- cgit From 1a30bdb506f3f288e781cf1f445696c7eceb823e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 20 Dec 2007 15:03:12 +0100 Subject: Remove doubled cli_set_timeout calls from libnetapi. Guenther (This used to be commit acc5d8e784b706001457ceeeb9bd4961a13d57d2) --- source3/lib/netapi/joindomain.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 0c3e021520..e3d5eada02 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -109,8 +109,6 @@ static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx, goto done; } - old_timeout = cli_set_timeout(cli, 60000); - pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_WKSSVC, &status); if (!pipe_cli) { @@ -298,8 +296,6 @@ static WERROR NetUnjoinDomainRemote(struct libnetapi_ctx *ctx, goto done; } - old_timeout = cli_set_timeout(cli, 60000); - pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_WKSSVC, &status); if (!pipe_cli) { -- cgit From 9518d738b17eb987dffb20f68df6b6768113b441 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 20 Dec 2007 15:06:20 +0100 Subject: Add error string for access denied in libnetapi. Guenther (This used to be commit 4df868e3c366958c64ed8445489c8d1e8a28e50b) --- source3/lib/netapi/netapi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 70d7e654a7..1db745b5c7 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -158,6 +158,9 @@ const char *libnetapi_errstr(struct libnetapi_ctx *ctx, case 0: err_str = "Success"; break; + case 0x00000005: /* WERR_ACCESS_DENIED */ + err_str = "Access is denied"; + break; case 0x00000057: /* WERR_INVALID_PARAM */ err_str = "Invalid parameter"; break; -- cgit From d230cd8dd554439c7d5e8fa9d7fd56520d9288d0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 15:30:29 +0100 Subject: Make libnetapi_errstr use our NTSTATUS and WERROR error string macros. Guenther (This used to be commit e46aa35d432e930835206b9ce7583f46933015d8) --- source3/lib/netapi/netapi.c | 49 +++------------------------------------------ 1 file changed, 3 insertions(+), 46 deletions(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 1db745b5c7..032798d0f9 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -152,52 +152,9 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status) { - const char *err_str = NULL; - - switch (status) { - case 0: - err_str = "Success"; - break; - case 0x00000005: /* WERR_ACCESS_DENIED */ - err_str = "Access is denied"; - break; - case 0x00000057: /* WERR_INVALID_PARAM */ - err_str = "Invalid parameter"; - break; - case 0x0000052E: /* WERR_LOGON_FAILURE */ - err_str = "Invalid logon credentials"; - break; - case 0x00000995: /* WERR_DOMAIN_CONTROLLER_NOT_FOUND */ - err_str = "A domain controller could not be found"; - break; - case 0x00000a84: /* WERR_SETUP_NOT_JOINED */ - err_str = "Join failed"; - break; - case 0x00000a83: /* WERR_SETUP_ALREADY_JOINED */ - err_str = "Machine is already joined"; - break; - case 0x00000a85: /* WERR_SETUP_DOMAIN_CONTROLLER */ - err_str = "Machine is a Domain Controller"; - break; - case 0x00000032: /* WERR_NOT_SUPPORTED */ - err_str = "Not supported"; - break; - case 0x0000051f: /* WERR_NO_LOGON_SERVERS */ - err_str = "No logon servers found"; - break; - case 0x00000056: /* WERR_BAD_PASSWORD */ - err_str = "A bad password was supplied"; - break; - case 0x00000520: /* WERR_NO_SUCH_LOGON_SESSION */ - err_str = "No such logon session"; - break; - default: - err_str = talloc_asprintf(ctx, "0x%08x", status); - if (!err_str) { - return NULL; - } - break; + if (status & 0xc0000000) { + return get_friendly_nt_error_msg(NT_STATUS(status)); } - return err_str; + return get_friendly_werror_msg(W_ERROR(status)); } -- cgit From eddd190921f2b322a227044a5c8067397f80c0f5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 15:51:00 +0100 Subject: Add basic remote NetGetDCName and NetGetAnyDCName versions to libnetapi. Guenther (This used to be commit 5bc49546a32abb4524133b9f2916cdd51d4eb462) --- source3/lib/netapi/getdc.c | 243 ++++++++++++++++++++++++++++++++++++++++++++ source3/lib/netapi/netapi.h | 9 ++ 2 files changed, 252 insertions(+) create mode 100644 source3/lib/netapi/getdc.c diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c new file mode 100644 index 0000000000..85a0ae52ef --- /dev/null +++ b/source3/lib/netapi/getdc.c @@ -0,0 +1,243 @@ +/* + * Unix SMB/CIFS implementation. + * NetApi GetDC Support + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" + +#include "lib/netapi/netapi.h" +#include "libnet/libnet.h" + +#if 0 +#include "librpc/gen_ndr/cli_netlogon.h" +#endif + +NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *domainname, + const char **dcname); +NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *domainname, + const char **dcname, + WERROR *werror); + +static WERROR NetGetDCNameLocal(struct libnetapi_ctx *ctx, + const char *server_name, + const char *domain_name, + uint8_t **buffer) +{ + return WERR_NOT_SUPPORTED; +} + +static WERROR NetGetDCNameRemote(struct libnetapi_ctx *ctx, + const char *server_name, + const char *domain_name, + uint8_t **buffer) +{ + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_cli = NULL; + NTSTATUS status; + WERROR werr; + + status = cli_full_connection(&cli, NULL, server_name, + NULL, 0, + "IPC$", "IPC", + ctx->username, + ctx->workgroup, + ctx->password, + 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, + &status); + if (!pipe_cli) { + werr = ntstatus_to_werror(status); + goto done; + }; + +#if 0 + werr = rpccli_netr_GetDcName(pipe_cli, ctx, + server_name, + domain_name, + (const char **)&buffer); +#else + werr = rpccli_netlogon_getdcname(pipe_cli, ctx, + server_name, + domain_name, + (char **)buffer); +#endif + done: + if (cli) { + cli_shutdown(cli); + } + + return werr; +} + +static WERROR libnetapi_NetGetDCName(struct libnetapi_ctx *ctx, + const char *server_name, + const char *domain_name, + uint8_t **buffer) +{ + if (!server_name || is_myname_or_ipaddr(server_name)) { + return NetGetDCNameLocal(ctx, + server_name, + domain_name, + buffer); + } + + return NetGetDCNameRemote(ctx, + server_name, + domain_name, + buffer); +} + +NET_API_STATUS NetGetDCName(const char *server_name, + const char *domain_name, + uint8_t **buffer) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + werr = libnetapi_NetGetDCName(ctx, + server_name, + domain_name, + buffer); + if (!W_ERROR_IS_OK(werr)) { + return W_ERROR_V(werr); + } + + return 0; +} + +static WERROR NetGetAnyDCNameLocal(struct libnetapi_ctx *ctx, + const char *server_name, + const char *domain_name, + uint8_t **buffer) +{ + return WERR_NOT_SUPPORTED; +} + +static WERROR NetGetAnyDCNameRemote(struct libnetapi_ctx *ctx, + const char *server_name, + const char *domain_name, + uint8_t **buffer) +{ + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_cli = NULL; + NTSTATUS status; + WERROR werr; + + status = cli_full_connection(&cli, NULL, server_name, + NULL, 0, + "IPC$", "IPC", + ctx->username, + ctx->workgroup, + ctx->password, + 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, + &status); + if (!pipe_cli) { + werr = ntstatus_to_werror(status); + goto done; + }; + +#if 0 + status = rpccli_netr_GetAnyDCName(pipe_cli, ctx, + server_name, + domain_name, + (const char **)&buffer, + &werr); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } +#else + werr = rpccli_netlogon_getanydcname(pipe_cli, ctx, + server_name, + domain_name, + (char **)buffer); +#endif + done: + if (cli) { + cli_shutdown(cli); + } + + return werr; + +} + +static WERROR libnetapi_NetGetAnyDCName(struct libnetapi_ctx *ctx, + const char *server_name, + const char *domain_name, + uint8_t **buffer) +{ + if (!server_name || is_myname_or_ipaddr(server_name)) { + return NetGetAnyDCNameLocal(ctx, + server_name, + domain_name, + buffer); + } + + return NetGetAnyDCNameRemote(ctx, + server_name, + domain_name, + buffer); +} + +NET_API_STATUS NetGetAnyDCName(const char *server_name, + const char *domain_name, + uint8_t **buffer) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + werr = libnetapi_NetGetAnyDCName(ctx, + server_name, + domain_name, + buffer); + if (!W_ERROR_IS_OK(werr)) { + return W_ERROR_V(werr); + } + + return 0; +} diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index bbd2282a77..0dd6d95ceb 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -62,4 +62,13 @@ NET_API_STATUS NetServerSetInfo(const char *server_name, uint32_t level, uint8_t *buffer, uint32_t *parm_error); + +/* netlogon */ +NET_API_STATUS NetGetDCName(const char *server_name, + const char *domain_name, + uint8_t **buffer); +NET_API_STATUS NetGetAnyDCName(const char *server_name, + const char *domain_name, + uint8_t **buffer); + #endif -- cgit From 27a58bd50cfd749cdcfa90fe7abeaf15dc09bbf3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 16:02:35 +0100 Subject: Add getdc.c, a libnetapi example (incl. Makefile). Guenther (This used to be commit faedc78fc78527ee3bf05e1177ea43653aea67b2) --- source3/configure.in | 5 ++- source3/lib/netapi/examples/Makefile.in | 34 ++++++++++++++++++++ source3/lib/netapi/examples/getdc.c | 57 +++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 source3/lib/netapi/examples/Makefile.in create mode 100644 source3/lib/netapi/examples/getdc.c diff --git a/source3/configure.in b/source3/configure.in index 57b74a3db5..a9053d9a08 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -6603,7 +6603,10 @@ AC_SUBST(builddir) SMBD_LIBS="$samba_dmapi_libs" AC_SUBST(SMBD_LIBS) -AC_OUTPUT(Makefile library-versions script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh) +AC_OUTPUT(Makefile library-versions + script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh + lib/netapi/examples/Makefile + ) ################################################# # Print very concise instructions on building/use diff --git a/source3/lib/netapi/examples/Makefile.in b/source3/lib/netapi/examples/Makefile.in new file mode 100644 index 0000000000..79f9187d84 --- /dev/null +++ b/source3/lib/netapi/examples/Makefile.in @@ -0,0 +1,34 @@ +KRB5LIBS=@KRB5_LIBS@ +LDAP_LIBS=@LDAP_LIBS@ +LIBS=@LIBS@ -lnetapi +DEVELOPER_CFLAGS=@DEVELOPER_CFLAGS@ +FLAGS=@CFLAGS@ +CC=@CC@ +LDFLAGS=@PIE_LDFLAGS@ @LDFLAGS@ +DYNEXP=@DYNEXP@ + +# Compile a source file. +COMPILE_CC = $(CC) -I. $(FLAGS) $(PICFLAG) -c $< -o $@ +COMPILE = $(COMPILE_CC) + +.c.o: + @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \ + dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi + @echo Compiling $*.c + @$(COMPILE) && exit 0;\ + echo "The following command failed:" 1>&2;\ + echo "$(COMPILE_CC)" 1>&2;\ + $(COMPILE_CC) >/dev/null 2>&1 + +GETDC_OBJ = getdc.o + +PROGS = getdc + +all: $(PROGS) + +getdc: $(GETDC_OBJ) + @echo Linking $@ + @$(CC) $(FLAGS) -o $@ $(GETDC_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) + +clean: + @rm -f $(PROGS) diff --git a/source3/lib/netapi/examples/getdc.c b/source3/lib/netapi/examples/getdc.c new file mode 100644 index 0000000000..ed6a8bd05d --- /dev/null +++ b/source3/lib/netapi/examples/getdc.c @@ -0,0 +1,57 @@ +/* + * Unix SMB/CIFS implementation. + * GetDCName query + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include +#include +#include +#include +#include + +#include + +int main(int argc, char **argv) +{ + NET_API_STATUS status; + struct libnetapi_ctx *ctx = NULL; + uint8_t *buffer; + + if (argc < 3) { + printf("usage: getdc \n"); + return -1; + } + + status = libnetapi_init(&ctx); + if (status != 0) { + return status; + } + + libnetapi_set_username(ctx, ""); + libnetapi_set_password(ctx, ""); + + status = NetGetDCName(argv[1], argv[2], &buffer); + if (status != 0) { + printf("GetDcName failed with: %s\n", libnetapi_errstr(ctx, status)); + } else { + printf("%s\n", (char *)buffer); + } + + libnetapi_free(ctx); + + return status; +} -- cgit From be57bc8568fc48597695327473f1e06354574236 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 16:03:12 +0100 Subject: Make sure libnetapi has getdcname support. Guenther (This used to be commit c527a28c47f42617853cd28772ef46e5e6b058b6) --- source3/Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index d1515c6a48..f2b0bc633e 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -709,7 +709,8 @@ REG_API_OBJ = registry/reg_api.o \ LIBNETAPI_OBJ1 = lib/netapi/netapi.o \ lib/netapi/joindomain.o \ - lib/netapi/serverinfo.o + lib/netapi/serverinfo.o \ + lib/netapi/getdc.o LIBNETAPI_OBJ = $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) \ $(REG_API_OBJ) \ -- cgit From f3607f85b673ade41773fcfd2cb6935b512fbf60 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 16:08:13 +0100 Subject: Add netdomjoin cmd line tool (another libnetapi example). Guenther (This used to be commit c502686f09713a7cf3786c254be6515a7aa23555) --- source3/lib/netapi/examples/Makefile.in | 7 +- source3/lib/netapi/examples/netdomjoin.c | 107 +++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 source3/lib/netapi/examples/netdomjoin.c diff --git a/source3/lib/netapi/examples/Makefile.in b/source3/lib/netapi/examples/Makefile.in index 79f9187d84..d618599433 100644 --- a/source3/lib/netapi/examples/Makefile.in +++ b/source3/lib/netapi/examples/Makefile.in @@ -21,8 +21,9 @@ COMPILE = $(COMPILE_CC) $(COMPILE_CC) >/dev/null 2>&1 GETDC_OBJ = getdc.o +NETDOMJOIN_OBJ = netdomjoin.o -PROGS = getdc +PROGS = getdc netdomjoin all: $(PROGS) @@ -30,5 +31,9 @@ getdc: $(GETDC_OBJ) @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(GETDC_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) +netdomjoin: $(NETDOMJOIN_OBJ) + @echo Linking $@ + @$(CC) $(FLAGS) -o $@ $(NETDOMJOIN_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) + clean: @rm -f $(PROGS) diff --git a/source3/lib/netapi/examples/netdomjoin.c b/source3/lib/netapi/examples/netdomjoin.c new file mode 100644 index 0000000000..a2bb700250 --- /dev/null +++ b/source3/lib/netapi/examples/netdomjoin.c @@ -0,0 +1,107 @@ +/* + * Unix SMB/CIFS implementation. + * Join Support (cmdline + netapi) + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include +#include +#include +#include +#include + +#include + +char *get_string_param(const char *param) +{ + char *p; + + p = strchr(param, '='); + if (!p) { + return NULL; + } + + return (p+1); +} + +int main(int argc, char **argv) +{ + NET_API_STATUS status; + const char *server_name = NULL; + const char *domain_name = NULL; + const char *account_ou = NULL; + const char *Account = NULL; + const char *password = NULL; + uint32_t join_flags = 3; + struct libnetapi_ctx *ctx = NULL; + int i; + + status = libnetapi_init(&ctx); + if (status != 0) { + return status; + } + + if (argc < 2) { + printf("usage: netdomjoin\n"); + printf("\t[hostname=HOSTNAME] [domain=DOMAIN] \n"); + return 0; + } + + if (argc > 2) { + server_name = argv[1]; + } + + for (i=0; i Date: Fri, 21 Dec 2007 16:36:06 +0100 Subject: Add netdomjoin-gui (my first gui application), another libnetapi user. Guenther (This used to be commit cf57ade5ec4a808eccb19a7723d753742fb71ca9) --- source3/lib/netapi/examples/Makefile.in | 12 +- source3/lib/netapi/examples/logo.png | Bin 0 -> 9329 bytes source3/lib/netapi/examples/netdomjoin-gui.c | 1347 ++++++++++++++++++++++++++ source3/lib/netapi/examples/samba.ico | Bin 0 -> 1406 bytes 4 files changed, 1357 insertions(+), 2 deletions(-) create mode 100644 source3/lib/netapi/examples/logo.png create mode 100644 source3/lib/netapi/examples/netdomjoin-gui.c create mode 100755 source3/lib/netapi/examples/samba.ico diff --git a/source3/lib/netapi/examples/Makefile.in b/source3/lib/netapi/examples/Makefile.in index d618599433..119e722aec 100644 --- a/source3/lib/netapi/examples/Makefile.in +++ b/source3/lib/netapi/examples/Makefile.in @@ -1,8 +1,11 @@ +GTK_FLAGS=`pkg-config gtk+-2.0 --cflags` +GTK_LIBS=`pkg-config gtk+-2.0 --libs` + KRB5LIBS=@KRB5_LIBS@ LDAP_LIBS=@LDAP_LIBS@ LIBS=@LIBS@ -lnetapi DEVELOPER_CFLAGS=@DEVELOPER_CFLAGS@ -FLAGS=@CFLAGS@ +FLAGS=@CFLAGS@ $(GTK_FLAGS) CC=@CC@ LDFLAGS=@PIE_LDFLAGS@ @LDFLAGS@ DYNEXP=@DYNEXP@ @@ -22,8 +25,9 @@ COMPILE = $(COMPILE_CC) GETDC_OBJ = getdc.o NETDOMJOIN_OBJ = netdomjoin.o +NETDOMJOIN_GUI_OBJ = netdomjoin-gui.o -PROGS = getdc netdomjoin +PROGS = getdc netdomjoin netdomjoin-gui all: $(PROGS) @@ -35,5 +39,9 @@ netdomjoin: $(NETDOMJOIN_OBJ) @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(NETDOMJOIN_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) +netdomjoin-gui: $(NETDOMJOIN_GUI_OBJ) + @echo Linking $@ + @$(CC) $(FLAGS) $(GTK_FLAGS) -o $@ $(NETDOMJOIN_GUI_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(GTK_LIBS) + clean: @rm -f $(PROGS) diff --git a/source3/lib/netapi/examples/logo.png b/source3/lib/netapi/examples/logo.png new file mode 100644 index 0000000000..6df4ace659 Binary files /dev/null and b/source3/lib/netapi/examples/logo.png differ diff --git a/source3/lib/netapi/examples/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui.c new file mode 100644 index 0000000000..8ca6897cab --- /dev/null +++ b/source3/lib/netapi/examples/netdomjoin-gui.c @@ -0,0 +1,1347 @@ +/* + * Unix SMB/CIFS implementation. + * Join Support (gtk + netapi) + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define MAX_CRED_LEN 256 +#define MAX_NETBIOS_NAME_LEN 15 + +#define SAMBA_ICON_PATH "/usr/share/pixmaps/samba/samba.ico" +#define SAMBA_IMAGE_PATH "/usr/share/pixmaps/samba/logo.png" + +#define WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED ( 0x00000020 ) +#define WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE ( 0x00000004 ) +#define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 ) +#define WKSSVC_JOIN_FLAGS_JOIN_TYPE ( 0x00000001 ) + +#define NetSetupWorkgroupName ( 2 ) +#define NetSetupDomainName ( 3 ) + +#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) + +struct srvsvc_NetSrvInfo1005 { + const char *comment;/* [unique,charset(UTF16)] */ +}; + +static gboolean verbose = FALSE; + +typedef struct join_state { + struct libnetapi_ctx *ctx; + GtkWidget *window_main; + GtkWidget *window_parent; + GtkWidget *window_do_change; + GtkWidget *window_creds_prompt; + GtkWidget *entry_account; + GtkWidget *entry_password; + GtkWidget *entry_domain; + GtkWidget *entry_workgroup; + GtkWidget *button_ok; + GtkWidget *button_apply; + GtkWidget *button_ok_creds; + GtkWidget *label_reboot; + GtkWidget *label_current_name_buffer; + GtkWidget *label_current_name_type; + GtkWidget *label_full_computer_name; + uint16_t name_type_initial; + uint16_t name_type_new; + char *name_buffer_initial; + char *name_buffer_new; + char *password; + char *account; + char *comment; + char *comment_new; + char *my_fqdn; + char *my_dnsdomain; + char *my_hostname; + uint16_t server_role; + gboolean settings_changed; + gboolean hostname_changed; +} join_state; + +static void debug(const char *format, ...) +{ + va_list args; + + if (!verbose) { + return; + } + + va_start(args, format); + g_vprintf(format, args); + va_end(args); +} + +static gboolean callback_delete_event(GtkWidget *widget, + GdkEvent *event, + gpointer data) +{ + gtk_main_quit(); + return FALSE; +} + +static void callback_do_close(GtkWidget *widget, + gpointer data) +{ + debug("Closing now...\n"); + gtk_widget_destroy(data); +} + +static void free_join_state(struct join_state *s) +{ + SAFE_FREE(s->name_buffer_initial); + SAFE_FREE(s->name_buffer_new); + SAFE_FREE(s->password); + SAFE_FREE(s->account); + SAFE_FREE(s->comment); + SAFE_FREE(s->comment_new); + SAFE_FREE(s->my_fqdn); + SAFE_FREE(s->my_dnsdomain); + SAFE_FREE(s->my_hostname); + +} + +static void do_cleanup(struct join_state *state) +{ + libnetapi_free(state->ctx); + free_join_state(state); +} + +static void callback_apply_description_change(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + NET_API_STATUS status = 0; + uint32_t parm_err = 0; + struct srvsvc_NetSrvInfo1005 info1005; + GtkWidget *dialog; + + info1005.comment = state->comment_new; + + status = NetServerSetInfo(NULL, 1005, (uint8_t *)&info1005, &parm_err); + if (status) { + debug("NetServerSetInfo failed with: %s\n", + libnetapi_errstr(state->ctx, status)); + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "Failed to change computer description: %s.", + libnetapi_errstr(state->ctx, status)); + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + return; + } + + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); +} + +static void callback_do_exit(GtkWidget *widget, + gpointer data) +{ + GtkWidget *dialog; + gint result; + struct join_state *state = (struct join_state *)data; + + if (!state->settings_changed) { + callback_delete_event(NULL, NULL, NULL); + return; + } + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "You must restart your computer before the new settings will take effect."); + result = gtk_dialog_run(GTK_DIALOG(dialog)); + switch (result) { + case GTK_RESPONSE_YES: + g_print("would reboot here\n"); + break; + case GTK_RESPONSE_NO: + default: + break; + } + gtk_widget_destroy(dialog); + gtk_widget_destroy(state->window_main); + do_cleanup(state); + exit(0); +} + + +static void callback_do_reboot(GtkWidget *widget, + gpointer data, + gpointer data2) +{ + GtkWidget *dialog; + struct join_state *state = (struct join_state *)data2; + + debug("callback_do_reboot\n"); + + state->settings_changed = TRUE; + dialog = gtk_message_dialog_new(GTK_WINDOW(data), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "You must restart this computer for the changes to take effect."); +#if 0 + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + debug("showing dialog\n"); + gtk_widget_show(dialog); +#else + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +#endif + + gtk_label_set_text(GTK_LABEL(state->label_reboot), "Changes will take effect after you restart this computer"); + + debug("destroying do_change window\n"); + gtk_widget_destroy(GTK_WIDGET(state->window_do_change)); + + { + uint32_t status; + const char *buffer; + uint16_t type; + + status = NetGetJoinInformation(NULL, &buffer, &type); + if (status != 0) { + g_print("failed to query status\n"); + return; + } + + debug("got new status: %s\n", buffer); +#if 0 + SAFE_FREE(state->name_buffer_new); + state->name_buffer_new = strdup(buffer); + SAFE_FREE(buffer); + state->name_type_new = type; +#endif + gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer), state->name_buffer_new); + if (state->name_type_new == 3) { + gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Domain:"); + } else { + gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Workgroup:"); + } + } +} + +static void callback_return_username(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_return_username: %s\n", entry_text); + SAFE_FREE(state->account); + state->account = strdup(entry_text); +} + +static void callback_return_username_and_enter(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_return_username: %s\n", entry_text); + SAFE_FREE(state->account); + state->account = strdup(entry_text); + g_signal_emit_by_name(state->button_ok_creds, "clicked"); +} + +static void callback_return_password(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); +#ifdef DEBUG_PASSWORD + debug("callback_return_password: %s\n", entry_text); +#else + debug("callback_return_password: (not printed)\n"); +#endif + SAFE_FREE(state->password); + state->password = strdup(entry_text); +} + +static void callback_return_password_and_enter(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); +#ifdef DEBUG_PASSWORD + debug("callback_return_password: %s\n", entry_text); +#else + debug("callback_return_password: (not printed)\n"); +#endif + SAFE_FREE(state->password); + state->password = strdup(entry_text); + g_signal_emit_by_name(state->button_ok_creds, "clicked"); +} + +static void callback_do_hostname_change(GtkWidget *widget, + gpointer data) +{ + GtkWidget *dialog; + const char *str = NULL; + + struct join_state *state = (struct join_state *)data; + + switch (state->name_type_initial) { + case NetSetupDomainName: + str = "To be implemented: call NetRenameMachineInDomain\n"; + break; + case NetSetupWorkgroupName: + str = "To be implemented: call SetComputerNameEx\n"; + break; + default: + break; + } + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + str); + + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + gtk_widget_show(dialog); +} + +static void callback_do_join(GtkWidget *widget, + gpointer data) +{ + GtkWidget *dialog; + + NET_API_STATUS status; + const char *err_str = NULL; + uint32_t join_flags = 0; + uint32_t unjoin_flags = 0; + gboolean domain_join = FALSE; + gboolean try_unjoin = FALSE; + const char *domain_or_workgroup = NULL; + + struct join_state *state = (struct join_state *)data; + + callback_return_username(state->entry_account, state); + callback_return_password(state->entry_password, state); + + if (state->window_creds_prompt) { + gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt)); + } + + if (state->name_type_new == NetSetupDomainName) { + domain_join = TRUE; + join_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | + WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE | + WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED; /* for testing */ + domain_or_workgroup = "domain"; + } else { + domain_or_workgroup = "workgroup"; + } + + if ((state->name_type_initial == NetSetupDomainName) && + (state->name_type_new == NetSetupWorkgroupName)) { + try_unjoin = TRUE; + unjoin_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | + WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE; + } + + debug("callback_do_join: Joining a %s named %s using join_flags 0x%08x ", + domain_or_workgroup, + state->name_buffer_new, + join_flags); + if (domain_join) { + debug("as %s ", state->account); +#ifdef DEBUG_PASSWORD + debug("with %s ", state->password); +#endif + } + debug("\n"); + if (try_unjoin) { + + debug("callback_do_join: Unjoining\n"); + + status = NetUnjoinDomain(NULL, + state->account, + state->password, + unjoin_flags); + if (status != 0) { + err_str = libnetapi_errstr(state->ctx, status); + g_print("callback_do_join: failed to unjoin (%s)\n", + err_str); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "The following error occured attempting to unjoin the %s: \"%s\": %s", + domain_or_workgroup, + state->name_buffer_new, + err_str); + + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + + return; + } + + } + status = NetJoinDomain(NULL, + state->name_buffer_new, + NULL, + state->account, + state->password, + join_flags); + if (status != 0) { + err_str = libnetapi_errstr(state->ctx, status); + g_print("callback_do_join: failed to join (%s)\n", err_str); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "The following error occured attempting to join the %s: \"%s\": %s", + domain_or_workgroup, + state->name_buffer_new, + err_str); + + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + + return; + } + + debug("callback_do_join: Successfully joined %s\n", + domain_or_workgroup); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Welcome to the %s %s.", + state->name_buffer_new, + domain_or_workgroup); + + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + callback_do_reboot(NULL, state->window_parent, state); +} + +static void callback_creds_prompt(GtkWidget *widget, + gpointer data) +{ + GtkWidget *window; + GtkWidget *box1; + GtkWidget *bbox; + GtkWidget *button; + GtkWidget *label; + + struct join_state *state = (struct join_state *)data; + + debug("callback_creds_prompt:\n"); + + state->window_parent = state->window_do_change; + + if (state->hostname_changed) { + return callback_do_hostname_change(NULL, state); + } + + if ((state->name_type_initial != NetSetupDomainName) && + (state->name_type_new != NetSetupDomainName)) { + return callback_do_join(NULL, state); + } + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); + gtk_widget_set_size_request(GTK_WIDGET(window), 380, 280); + gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); +/* gtk_window_set_icon_name(GTK_WIDGET(window), GTK_STOCK_DIALOG_AUTHENTICATION); */ + state->window_creds_prompt = window; + + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(callback_do_close), window); + + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + box1 = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(window), box1); + + if ((state->name_type_initial == NetSetupDomainName) && + (state->name_type_new == NetSetupWorkgroupName)) { + label = gtk_label_new("Enter the name and password of an account with permission to leave the domain.\n"); + } else { + label = gtk_label_new("Enter the name and password of an account with permission to join the domain.\n"); + } + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + + gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); + + gtk_widget_show(label); + + /* USER NAME */ + label = gtk_label_new("User name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + state->entry_account = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(state->entry_account), MAX_CRED_LEN); + g_signal_connect(G_OBJECT(state->entry_account), "activate", + G_CALLBACK(callback_return_username_and_enter), + (gpointer)state); + gtk_editable_select_region(GTK_EDITABLE(state->entry_account), + 0, GTK_ENTRY(state->entry_account)->text_length); + gtk_box_pack_start(GTK_BOX(box1), state->entry_account, TRUE, TRUE, 0); + gtk_widget_show(state->entry_account); + + /* PASSWORD */ + label = gtk_label_new("Password:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + state->entry_password = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(state->entry_password), MAX_CRED_LEN); + gtk_entry_set_visibility(GTK_ENTRY(state->entry_password), FALSE); + g_signal_connect(G_OBJECT(state->entry_password), "activate", + G_CALLBACK(callback_return_password_and_enter), + (gpointer)state); + gtk_editable_set_editable(GTK_EDITABLE(state->entry_password), TRUE); + gtk_editable_select_region(GTK_EDITABLE(state->entry_password), + 0, GTK_ENTRY(state->entry_password)->text_length); + gtk_box_pack_start(GTK_BOX(box1), state->entry_password, TRUE, TRUE, 0); + gtk_widget_show(state->entry_password); + + bbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); + gtk_container_add(GTK_CONTAINER(box1), bbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox), 10); + + state->button_ok_creds = gtk_button_new_from_stock(GTK_STOCK_OK); + gtk_widget_grab_focus(GTK_WIDGET(state->button_ok_creds)); + gtk_container_add(GTK_CONTAINER(bbox), state->button_ok_creds); + g_signal_connect(G_OBJECT(state->button_ok_creds), "clicked", + G_CALLBACK(callback_do_join), + (gpointer)state); + gtk_widget_show(state->button_ok_creds); + + button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_container_add(GTK_CONTAINER(bbox), button); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(callback_do_close), (gpointer) window); + gtk_widget_show_all(window); +} + +static void callback_enter_hostname_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + char *str = NULL; + struct join_state *state = (struct join_state *)data; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_hostname_and_unlock: %s\n", entry_text); + if (!entry_text || entry_text[0] == 0) { + state->hostname_changed = FALSE; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + if (strcasecmp(state->my_hostname, entry_text) == 0) { + state->hostname_changed = FALSE; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + state->hostname_changed = TRUE; + if (state->name_type_initial == NetSetupDomainName) { + asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); + } else { + asprintf(&str, "%s.", entry_text); + } + gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); + free(str); + + if (state->hostname_changed && str && str[0] != 0 && str[0] != '.') { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); + } +} + +static void callback_enter_computer_description_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + struct join_state *state = (struct join_state *)data; + int string_unchanged = 0; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_computer_description_and_unlock: %s\n", + entry_text); +#if 0 + if (!entry_text || entry_text[0] == 0) { + string_unchanged = 1; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), + FALSE); + return; + } +#endif + if (entry_text && strcasecmp(state->comment, entry_text) == 0) { + string_unchanged = 1; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), + FALSE); + return; + } + + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), TRUE); + SAFE_FREE(state->comment_new); + state->comment_new = strdup(entry_text); + +} + + +static void callback_enter_workgroup_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + struct join_state *state = (struct join_state *)data; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_workgroup_and_unlock: %s\n", entry_text); + if (!entry_text || entry_text[0] == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); + SAFE_FREE(state->name_buffer_new); + state->name_buffer_new = strdup(entry_text); + state->name_type_new = NetSetupWorkgroupName; +} + +static void callback_enter_domain_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + struct join_state *state = (struct join_state *)data; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_domain_and_unlock: %s\n", entry_text); + if (!entry_text || entry_text[0] == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); + SAFE_FREE(state->name_buffer_new); + state->name_buffer_new = strdup(entry_text); + state->name_type_new = NetSetupDomainName; +} + +static void callback_continue(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + + gtk_widget_grab_focus(GTK_WIDGET(state->button_ok)); + g_signal_emit_by_name(state->button_ok, "clicked"); +} + +static void callback_apply_continue(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + + gtk_widget_grab_focus(GTK_WIDGET(state->button_apply)); + g_signal_emit_by_name(state->button_apply, "clicked"); +} + +static void callback_do_join_workgroup(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + debug("callback_do_join_workgroup choosen\n"); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); + gtk_widget_grab_focus(GTK_WIDGET(state->entry_workgroup)); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); + callback_enter_workgroup_and_unlock(state->entry_workgroup, state); /* TEST */ +} + +static void callback_do_join_domain(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + debug("callback_do_join_domain choosen\n"); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), TRUE); + gtk_widget_grab_focus(GTK_WIDGET(state->entry_domain)); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), FALSE); + callback_enter_domain_and_unlock(state->entry_domain, state); /* TEST */ +} + +static void callback_do_change(GtkWidget *widget, + gpointer data) +{ + GtkWidget *window; + GtkWidget *box1; + GtkWidget *bbox; + GtkWidget *button_workgroup; + GtkWidget *button_domain; + GtkWidget *button; + GtkWidget *label; + GtkWidget *frame_horz; + GtkWidget *vbox; + GtkWidget *entry; + GSList *group; + + struct join_state *state = (struct join_state *)data; + + debug("callback_do_change called\n"); + + if (state->server_role == 3) { + GtkWidget *dialog; + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "Domain controller cannot be moved from one domain to another, they must first be demoted. Renaming this domain controller may cause it to become temporarily unavailable to users and computers. For information on renaming domain controllers, including alternate renaming methods, see Help and Support. To continue renaming this domain controller, click OK."); + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + return; + } + + state->button_ok = gtk_button_new_from_stock(GTK_STOCK_OK); + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + gtk_widget_set_size_request(GTK_WIDGET(window), 480, 500); /* breite * höhe */ + gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); + + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(callback_do_close), window); + + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + box1 = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), box1); + + label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network ressources."); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + /* COMPUTER NAME */ + label = gtk_label_new("Computer name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + state->label_full_computer_name = gtk_label_new(NULL); + { + entry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(entry), MAX_NETBIOS_NAME_LEN); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(callback_enter_hostname_and_unlock), + (gpointer)state); + gtk_entry_set_text(GTK_ENTRY(entry), state->my_hostname); + gtk_editable_select_region(GTK_EDITABLE(entry), + 0, GTK_ENTRY(entry)->text_length); + + gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ + gtk_box_pack_start(GTK_BOX(box1), entry, TRUE, TRUE, 0); + gtk_widget_show(entry); + } + + /* FULL COMPUTER NAME */ + label = gtk_label_new("Full computer name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + { + const gchar *entry_text; + char *str = NULL; + entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); + if (state->name_type_initial == NetSetupDomainName) { + asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); + } else { + asprintf(&str, "%s.", entry_text); + } + gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); + free(str); + gtk_misc_set_alignment(GTK_MISC(state->label_full_computer_name), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), state->label_full_computer_name, TRUE, TRUE, 0); + gtk_widget_show(state->label_full_computer_name); + } + + /* BOX */ + frame_horz = gtk_frame_new ("Member Of"); + gtk_box_pack_start(GTK_BOX(box1), frame_horz, TRUE, TRUE, 10); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + gtk_container_add(GTK_CONTAINER(frame_horz), vbox); + + /* TWO ENTRIES */ + state->entry_workgroup = gtk_entry_new(); + state->entry_domain = gtk_entry_new(); + + /* DOMAIN */ + button_domain = gtk_radio_button_new_with_label(NULL, "Domain"); + if (state->name_type_initial == NetSetupDomainName) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_domain), TRUE); + } + gtk_box_pack_start(GTK_BOX(vbox), button_domain, TRUE, TRUE, 0); + g_signal_connect(G_OBJECT(button_domain), "clicked", + G_CALLBACK(callback_do_join_domain), + (gpointer)state); + + { + gtk_entry_set_max_length(GTK_ENTRY(state->entry_domain), 50); + g_signal_connect(G_OBJECT(state->entry_domain), "changed", + G_CALLBACK(callback_enter_domain_and_unlock), + (gpointer)state); + g_signal_connect(G_OBJECT(state->entry_domain), "activate", + G_CALLBACK(callback_continue), + (gpointer)state); + if (state->name_type_initial == NetSetupDomainName) { + gtk_entry_set_text(GTK_ENTRY(state->entry_domain), state->name_buffer_initial); + gtk_widget_set_sensitive(state->entry_workgroup, FALSE); + gtk_widget_set_sensitive(state->entry_domain, TRUE); + } + gtk_editable_set_editable(GTK_EDITABLE(state->entry_domain), TRUE); + gtk_box_pack_start(GTK_BOX(vbox), state->entry_domain, TRUE, TRUE, 0); + gtk_widget_show(state->entry_domain); + } + gtk_widget_show(button_domain); + + /* WORKGROUP */ + group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button_domain)); + button_workgroup = gtk_radio_button_new_with_label(group, "Workgroup"); + if (state->name_type_initial == NetSetupWorkgroupName) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_workgroup), TRUE); + } + gtk_box_pack_start(GTK_BOX(vbox), button_workgroup, TRUE, TRUE, 0); + g_signal_connect(G_OBJECT(button_workgroup), "clicked", + G_CALLBACK(callback_do_join_workgroup), + (gpointer)state); + { + gtk_entry_set_max_length(GTK_ENTRY(state->entry_workgroup), MAX_NETBIOS_NAME_LEN); + g_signal_connect(G_OBJECT(state->entry_workgroup), "changed", + G_CALLBACK(callback_enter_workgroup_and_unlock), + (gpointer)state); + g_signal_connect(G_OBJECT(state->entry_workgroup), "activate", + G_CALLBACK(callback_continue), + (gpointer)state); + + if (state->name_type_initial == NetSetupWorkgroupName) { + gtk_entry_set_text(GTK_ENTRY(state->entry_workgroup), state->name_buffer_initial); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); + } + gtk_box_pack_start(GTK_BOX(vbox), state->entry_workgroup, TRUE, TRUE, 0); + gtk_widget_show(state->entry_workgroup); + } + gtk_widget_show(button_workgroup); + + /* BUTTONS */ + bbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); + gtk_container_add(GTK_CONTAINER(box1), bbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox), 10); + + state->window_do_change = window; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); /* !!! */ + gtk_container_add(GTK_CONTAINER(bbox), state->button_ok); + g_signal_connect(G_OBJECT(state->button_ok), "clicked", + G_CALLBACK(callback_creds_prompt), + (gpointer)state); + + button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_container_add(GTK_CONTAINER(bbox), button); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(callback_do_close), + (gpointer)window); + + gtk_widget_show_all(window); + +} + +static void callback_do_about(GtkWidget *widget, + gpointer data) +{ + GdkPixbuf *logo; + GError *error = NULL; + + debug("callback_do_about called\n"); + + logo = gdk_pixbuf_new_from_file(SAMBA_IMAGE_PATH, + &error); + if (logo == NULL) { + g_print("failed to load logo from %s: %s\n", + SAMBA_IMAGE_PATH, error->message); + } + + gtk_show_about_dialog(data, + "name", "Samba", + "version", "3.2.0pre2-GIT-904a90-test", + "copyright", "Copyright Andrew Tridgell and the Samba Team 1992-2007", + "website", "http://www.samba.org", + "license", "GPLv3", + "logo", logo, + "comments", "Samba gtk domain join utility", + NULL); +} + +static int draw_main_window(struct join_state *state) +{ + GtkWidget *window; + GtkWidget *button; + GtkWidget *label; + GtkWidget *main_vbox; + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *bbox; + GtkWidget *image; + GtkWidget *table; + GtkWidget *entry; + GdkPixbuf *icon; + GError *error = NULL; + + icon = gdk_pixbuf_new_from_file(SAMBA_ICON_PATH, + &error); + if (icon == NULL) { + g_print("failed to load logo from %s : %s\n", + SAMBA_ICON_PATH, error->message); + } + +#if 1 + image = gtk_image_new_from_file(SAMBA_IMAGE_PATH); +#else + image = gtk_image_new_from_file("/usr/share/pixmaps/redhat-system_settings.png"); +#endif + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + state->window_main = window; + + gtk_window_set_title(GTK_WINDOW(window), "Samba - Join Domain dialogue"); + gtk_widget_set_size_request(GTK_WIDGET(window), 600, 600); /* breite * höhe */ + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); + + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(callback_delete_event), NULL); + + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + main_vbox = gtk_vbox_new(FALSE, 10); + gtk_container_add(GTK_CONTAINER(window), main_vbox); + +#if 0 + gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); + gtk_widget_show(image); +#endif + /* Hbox */ + hbox = gtk_hbox_new(FALSE, 10); + gtk_container_add(GTK_CONTAINER(main_vbox), hbox); + + { +/* gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); */ + gtk_misc_set_alignment(GTK_MISC(image), 0, 0); + gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 10); + gtk_widget_show(image); + + /* Label */ + label = gtk_label_new("Samba uses the following information to identify your computer on the network."); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_set_size_request(GTK_WIDGET(label), 500, 40); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + } + + gtk_widget_show(hbox); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + gtk_container_add(GTK_CONTAINER(main_vbox), vbox); + + /* Table */ + table = gtk_table_new(6, 3, TRUE); + gtk_table_set_row_spacings(GTK_TABLE(table), 5); + gtk_table_set_col_spacings(GTK_TABLE(table), 5); + gtk_container_add(GTK_CONTAINER(vbox), table); + + { + /* Label */ + label = gtk_label_new("Computer description:"); +/* gtk_misc_set_alignment(GTK_MISC(label), 0, 0); */ + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); + gtk_widget_show(label); + + state->button_apply = gtk_button_new_from_stock(GTK_STOCK_APPLY); + + /* Entry */ + entry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(entry), 256); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(callback_enter_computer_description_and_unlock), + state); + g_signal_connect(G_OBJECT(entry), "activate", + G_CALLBACK(callback_apply_continue), + (gpointer)state); + + gtk_entry_set_text(GTK_ENTRY(entry), (char *)state->comment); + gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ + gtk_table_attach_defaults(GTK_TABLE(table), entry, 1, 3, 0, 1); + gtk_widget_show(entry); + } + + /* Label */ + label = gtk_label_new("For example: \"Samba \%v\"."); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 1, 2); + gtk_widget_show(label); + + /* Label */ + label = gtk_label_new("Full computer name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); + gtk_widget_show(label); + + { + /* Label */ + char *str = NULL; + if (state->name_type_initial == NetSetupDomainName) { + asprintf(&str, "%s.%s", state->my_hostname, + state->my_dnsdomain); + } else { + asprintf(&str, "%s.", state->my_hostname); + } + + label = gtk_label_new(str); + SAFE_FREE(str); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 2, 3); + gtk_widget_show(label); + } + + /* Label */ + if (state->name_type_initial == NetSetupDomainName) { + label = gtk_label_new("Domain:"); + } else { + label = gtk_label_new("Workgroup:"); + } + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); + gtk_widget_show(label); + state->label_current_name_type = label; + + /* Label */ + label = gtk_label_new(state->name_buffer_initial); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 3, 4); + gtk_widget_show(label); + state->label_current_name_buffer = label; + + { + hbox = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + label = gtk_label_new("To rename this computer or join a domain, click Change."); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + + } + + /* bbox */ + bbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); + gtk_container_add(GTK_CONTAINER(hbox), bbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox), 10); + + button = gtk_button_new_with_mnemonic("Ch_ange"); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(callback_do_change), + (gpointer)state); + gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + /* Label (hidden) */ + state->label_reboot = gtk_label_new(NULL); + gtk_label_set_line_wrap(GTK_LABEL(state->label_reboot), TRUE); + gtk_misc_set_alignment(GTK_MISC(state->label_reboot), 0, 0); + gtk_box_pack_start(GTK_BOX(vbox), state->label_reboot, TRUE, TRUE, 0); + gtk_widget_show(state->label_reboot); + +#if 0 + gtk_box_pack_start(GTK_BOX(vbox), + create_bbox(window, TRUE, NULL, 10, 85, 20, GTK_BUTTONBOX_END), + TRUE, TRUE, 5); +#endif + { + + GtkWidget *frame; + GtkWidget *bbox2; + GtkWidget *button2; + + frame = gtk_frame_new(NULL); + bbox2 = gtk_hbutton_box_new(); + + gtk_container_set_border_width(GTK_CONTAINER(bbox2), 5); + gtk_container_add(GTK_CONTAINER(frame), bbox2); + + /* Set the appearance of the Button Box */ + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox2), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox2), 10); + /*gtk_button_box_set_child_size(GTK_BUTTON_BOX(bbox2), child_w, child_h);*/ + + button2 = gtk_button_new_from_stock(GTK_STOCK_OK); + gtk_container_add(GTK_CONTAINER(bbox2), button2); + g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(callback_do_exit), state); + + button2 = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_container_add(GTK_CONTAINER(bbox2), button2); + g_signal_connect(G_OBJECT(button2), "clicked", + G_CALLBACK(callback_delete_event), + window); + + gtk_container_add(GTK_CONTAINER(bbox2), state->button_apply); + g_signal_connect(G_OBJECT(state->button_apply), "clicked", + G_CALLBACK(callback_apply_description_change), + state); + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); + + button2 = gtk_button_new_from_stock(GTK_STOCK_ABOUT); + gtk_container_add(GTK_CONTAINER(bbox2), button2); + g_signal_connect(G_OBJECT(button2), "clicked", + G_CALLBACK(callback_do_about), + window); + + gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); + } + + gtk_widget_show_all(window); + + return 0; +} + +static int init_join_state(struct join_state **state) +{ + struct join_state *s; + + s = malloc(sizeof(struct join_state)); + if (!s) { + return -1; + } + + memset(s, '\0', sizeof(struct join_state)); + + *state = s; + + return 0; +} + +static int initialize_join_state(struct join_state *state, + const char *debug_level) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status = 0; + + status = libnetapi_init(&ctx); + if (status) { + return status; + } + + if (debug_level) { + libnetapi_set_debuglevel(ctx, debug_level); + } + + { + char my_hostname[HOST_NAME_MAX]; + const char *p = NULL; + if (gethostname(my_hostname, sizeof(my_hostname)) == -1) { + return -1; + } + + state->my_fqdn = strdup(my_hostname); + if (!state->my_fqdn) { + return -1; + } + + p = strchr(my_hostname, '.'); + if (p) { + my_hostname[strlen(my_hostname) - strlen(p)] = '\0'; + state->my_hostname = strdup(my_hostname); + if (!state->my_hostname) { + return -1; + } + p++; + state->my_dnsdomain = strdup(p); + if (!state->my_dnsdomain) { + return -1; + } + } + } + + { + const char *buffer = NULL; + uint16_t type = 0; + status = NetGetJoinInformation(NULL, &buffer, &type); + if (status) { + return status; + } + state->name_buffer_initial = (char *)buffer; + state->name_type_initial = type; + } + + { + struct srvsvc_NetSrvInfo1005 *info1005 = NULL; + uint8_t *buffer = NULL; + + status = NetServerGetInfo(NULL, 1005, &buffer); + if (status) { + return status; + } + + info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer; + + state->comment = strdup(info1005->comment); + if (!state->comment) { + return -1; + } + } +#if 0 + { + struct srvsvc_NetSrvInfo100 *info100 = NULL; + uint8_t *buffer = NULL; + + status = NetServerGetInfo(NULL, 100, &buffer); + if (status) { + return status; + } + + info100 = (struct srvsvc_NetSrvInfo100 *)buffer; + + state->comment = strdup(info100->comment); + if (!state->comment) { + return -1; + } + } +#endif + + state->ctx = ctx; + + return 0; +} + +int main(int argc, char **argv) +{ + GOptionContext *context = NULL; + static const char *debug_level = NULL; + struct join_state *state = NULL; + GError *error = NULL; + int ret = 0; + + static GOptionEntry entries[] = { + { "debug", 'd', 0, G_OPTION_ARG_STRING, &debug_level, "Debug level (for samba)", "N" }, + { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Verbose output", 0 }, + { NULL } + }; + + context = g_option_context_new("- Samba domain join utility"); + g_option_context_add_main_entries(context, entries, NULL); +/* g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); */ + g_option_context_add_group(context, gtk_get_option_group(TRUE)); + g_option_context_parse(context, &argc, &argv, &error); + + gtk_init(&argc, &argv); + g_set_application_name("Samba"); + + ret = init_join_state(&state); + if (ret) { + return ret; + } + + ret = initialize_join_state(state, debug_level); + if (ret) { + return ret; + } + + draw_main_window(state); + + gtk_main(); + + do_cleanup(state); + + return 0; +} diff --git a/source3/lib/netapi/examples/samba.ico b/source3/lib/netapi/examples/samba.ico new file mode 100755 index 0000000000..b70c9590de Binary files /dev/null and b/source3/lib/netapi/examples/samba.ico differ -- cgit From cdb51f3bc31892e80e5a34204b427660edbd7e63 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 16:44:52 +0100 Subject: Deactive remote join code server side until some last issues are resolved. Guenther (This used to be commit 1489870f05695a929902264eb9b95eab886bdaa6) --- source3/rpc_server/srv_wkssvc_nt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/rpc_server/srv_wkssvc_nt.c b/source3/rpc_server/srv_wkssvc_nt.c index e60dca61c7..b30a7f8792 100644 --- a/source3/rpc_server/srv_wkssvc_nt.c +++ b/source3/rpc_server/srv_wkssvc_nt.c @@ -286,6 +286,7 @@ WERROR _wkssvc_NetrGetJoinableOus(pipes_struct *p, struct wkssvc_NetrGetJoinable WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r) { +#if 0 struct libnet_JoinCtx *j = NULL; char *pwd = NULL; char *admin_domain = NULL; @@ -350,6 +351,9 @@ WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r unbecome_root(); return werr; +#endif + p->rng_fault_state = True; + return WERR_NOT_SUPPORTED; } /******************************************************************** -- cgit From 73634050607d44279f04e14c1e161a6a304c5e47 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 16:49:33 +0100 Subject: Gitignore some generated files. Guenther (This used to be commit 1e090654320ba3ce94d8114acaf931dbb2557a0c) --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index bd1cba16b0..d3266edbbe 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.po *~ source/client/client_proto.h +source/libnet/libnet_proto.h source/include/build_env.h source/include/config.h source/include/config.h.in @@ -9,6 +10,7 @@ source/include/proto.h source/include/stamp-h source/include/version.h source/Makefile +source/lib/netapi/examples/Makefile source/config.log source/config.status source/configure -- cgit From 77a2e13cb1950cfd591f31b6a12eae66c342e632 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 17:05:55 +0100 Subject: Move libnetapi examples into subdirs. Guenther (This used to be commit 0c3de6f3458419e57daaa71f1dad679897388f5a) --- source3/lib/netapi/examples/Makefile.in | 24 +- source3/lib/netapi/examples/getdc.c | 57 - source3/lib/netapi/examples/getdc/getdc.c | 57 + source3/lib/netapi/examples/logo.png | Bin 9329 -> 0 bytes source3/lib/netapi/examples/netdomjoin-gui.c | 1347 -------------------- .../lib/netapi/examples/netdomjoin-gui/logo.png | Bin 0 -> 9329 bytes .../lib/netapi/examples/netdomjoin-gui/samba.ico | Bin 0 -> 1406 bytes source3/lib/netapi/examples/netdomjoin.c | 107 -- .../netapi/examples/netdomjoin/netdomjoin-gui.c | 1347 ++++++++++++++++++++ .../lib/netapi/examples/netdomjoin/netdomjoin.c | 107 ++ source3/lib/netapi/examples/samba.ico | Bin 1406 -> 0 bytes 11 files changed, 1528 insertions(+), 1518 deletions(-) delete mode 100644 source3/lib/netapi/examples/getdc.c create mode 100644 source3/lib/netapi/examples/getdc/getdc.c delete mode 100644 source3/lib/netapi/examples/logo.png delete mode 100644 source3/lib/netapi/examples/netdomjoin-gui.c create mode 100644 source3/lib/netapi/examples/netdomjoin-gui/logo.png create mode 100755 source3/lib/netapi/examples/netdomjoin-gui/samba.ico delete mode 100644 source3/lib/netapi/examples/netdomjoin.c create mode 100644 source3/lib/netapi/examples/netdomjoin/netdomjoin-gui.c create mode 100644 source3/lib/netapi/examples/netdomjoin/netdomjoin.c delete mode 100755 source3/lib/netapi/examples/samba.ico diff --git a/source3/lib/netapi/examples/Makefile.in b/source3/lib/netapi/examples/Makefile.in index 119e722aec..c2f453dedc 100644 --- a/source3/lib/netapi/examples/Makefile.in +++ b/source3/lib/netapi/examples/Makefile.in @@ -14,6 +14,16 @@ DYNEXP=@DYNEXP@ COMPILE_CC = $(CC) -I. $(FLAGS) $(PICFLAG) -c $< -o $@ COMPILE = $(COMPILE_CC) +BINARY_PREREQS = proto_exists bin/.dummy + +MAKEDIR = || exec false; \ + if test -d "$$dir"; then :; else \ + echo mkdir "$$dir"; \ + mkdir -p "$$dir" >/dev/null 2>&1 || \ + test -d "$$dir" || \ + mkdir "$$dir" || \ + exec false; fi || exec false + .c.o: @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \ dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi @@ -23,23 +33,23 @@ COMPILE = $(COMPILE_CC) echo "$(COMPILE_CC)" 1>&2;\ $(COMPILE_CC) >/dev/null 2>&1 -GETDC_OBJ = getdc.o -NETDOMJOIN_OBJ = netdomjoin.o -NETDOMJOIN_GUI_OBJ = netdomjoin-gui.o +GETDC_OBJ = getdc/getdc.o +NETDOMJOIN_OBJ = netdomjoin/netdomjoin.o +NETDOMJOIN_GUI_OBJ = netdomjoin-gui/netdomjoin-gui.o -PROGS = getdc netdomjoin netdomjoin-gui +PROGS = bin/getdc@EXEEXT@ bin/netdomjoin@EXEEXT@ bin/netdomjoin-gui@EXEEXT@ all: $(PROGS) -getdc: $(GETDC_OBJ) +bin/getdc@EXEEXT@: $(GETDC_OBJ) @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(GETDC_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) -netdomjoin: $(NETDOMJOIN_OBJ) +bin/netdomjoin@EXEEXT@: $(NETDOMJOIN_OBJ) @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(NETDOMJOIN_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) -netdomjoin-gui: $(NETDOMJOIN_GUI_OBJ) +bin/netdomjoin-gui@EXEEXT@: $(NETDOMJOIN_GUI_OBJ) @echo Linking $@ @$(CC) $(FLAGS) $(GTK_FLAGS) -o $@ $(NETDOMJOIN_GUI_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(GTK_LIBS) diff --git a/source3/lib/netapi/examples/getdc.c b/source3/lib/netapi/examples/getdc.c deleted file mode 100644 index ed6a8bd05d..0000000000 --- a/source3/lib/netapi/examples/getdc.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * GetDCName query - * Copyright (C) Guenther Deschner 2007 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include -#include -#include -#include -#include - -#include - -int main(int argc, char **argv) -{ - NET_API_STATUS status; - struct libnetapi_ctx *ctx = NULL; - uint8_t *buffer; - - if (argc < 3) { - printf("usage: getdc \n"); - return -1; - } - - status = libnetapi_init(&ctx); - if (status != 0) { - return status; - } - - libnetapi_set_username(ctx, ""); - libnetapi_set_password(ctx, ""); - - status = NetGetDCName(argv[1], argv[2], &buffer); - if (status != 0) { - printf("GetDcName failed with: %s\n", libnetapi_errstr(ctx, status)); - } else { - printf("%s\n", (char *)buffer); - } - - libnetapi_free(ctx); - - return status; -} diff --git a/source3/lib/netapi/examples/getdc/getdc.c b/source3/lib/netapi/examples/getdc/getdc.c new file mode 100644 index 0000000000..ed6a8bd05d --- /dev/null +++ b/source3/lib/netapi/examples/getdc/getdc.c @@ -0,0 +1,57 @@ +/* + * Unix SMB/CIFS implementation. + * GetDCName query + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include +#include +#include +#include +#include + +#include + +int main(int argc, char **argv) +{ + NET_API_STATUS status; + struct libnetapi_ctx *ctx = NULL; + uint8_t *buffer; + + if (argc < 3) { + printf("usage: getdc \n"); + return -1; + } + + status = libnetapi_init(&ctx); + if (status != 0) { + return status; + } + + libnetapi_set_username(ctx, ""); + libnetapi_set_password(ctx, ""); + + status = NetGetDCName(argv[1], argv[2], &buffer); + if (status != 0) { + printf("GetDcName failed with: %s\n", libnetapi_errstr(ctx, status)); + } else { + printf("%s\n", (char *)buffer); + } + + libnetapi_free(ctx); + + return status; +} diff --git a/source3/lib/netapi/examples/logo.png b/source3/lib/netapi/examples/logo.png deleted file mode 100644 index 6df4ace659..0000000000 Binary files a/source3/lib/netapi/examples/logo.png and /dev/null differ diff --git a/source3/lib/netapi/examples/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui.c deleted file mode 100644 index 8ca6897cab..0000000000 --- a/source3/lib/netapi/examples/netdomjoin-gui.c +++ /dev/null @@ -1,1347 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Join Support (gtk + netapi) - * Copyright (C) Guenther Deschner 2007 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#define MAX_CRED_LEN 256 -#define MAX_NETBIOS_NAME_LEN 15 - -#define SAMBA_ICON_PATH "/usr/share/pixmaps/samba/samba.ico" -#define SAMBA_IMAGE_PATH "/usr/share/pixmaps/samba/logo.png" - -#define WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED ( 0x00000020 ) -#define WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE ( 0x00000004 ) -#define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 ) -#define WKSSVC_JOIN_FLAGS_JOIN_TYPE ( 0x00000001 ) - -#define NetSetupWorkgroupName ( 2 ) -#define NetSetupDomainName ( 3 ) - -#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) - -struct srvsvc_NetSrvInfo1005 { - const char *comment;/* [unique,charset(UTF16)] */ -}; - -static gboolean verbose = FALSE; - -typedef struct join_state { - struct libnetapi_ctx *ctx; - GtkWidget *window_main; - GtkWidget *window_parent; - GtkWidget *window_do_change; - GtkWidget *window_creds_prompt; - GtkWidget *entry_account; - GtkWidget *entry_password; - GtkWidget *entry_domain; - GtkWidget *entry_workgroup; - GtkWidget *button_ok; - GtkWidget *button_apply; - GtkWidget *button_ok_creds; - GtkWidget *label_reboot; - GtkWidget *label_current_name_buffer; - GtkWidget *label_current_name_type; - GtkWidget *label_full_computer_name; - uint16_t name_type_initial; - uint16_t name_type_new; - char *name_buffer_initial; - char *name_buffer_new; - char *password; - char *account; - char *comment; - char *comment_new; - char *my_fqdn; - char *my_dnsdomain; - char *my_hostname; - uint16_t server_role; - gboolean settings_changed; - gboolean hostname_changed; -} join_state; - -static void debug(const char *format, ...) -{ - va_list args; - - if (!verbose) { - return; - } - - va_start(args, format); - g_vprintf(format, args); - va_end(args); -} - -static gboolean callback_delete_event(GtkWidget *widget, - GdkEvent *event, - gpointer data) -{ - gtk_main_quit(); - return FALSE; -} - -static void callback_do_close(GtkWidget *widget, - gpointer data) -{ - debug("Closing now...\n"); - gtk_widget_destroy(data); -} - -static void free_join_state(struct join_state *s) -{ - SAFE_FREE(s->name_buffer_initial); - SAFE_FREE(s->name_buffer_new); - SAFE_FREE(s->password); - SAFE_FREE(s->account); - SAFE_FREE(s->comment); - SAFE_FREE(s->comment_new); - SAFE_FREE(s->my_fqdn); - SAFE_FREE(s->my_dnsdomain); - SAFE_FREE(s->my_hostname); - -} - -static void do_cleanup(struct join_state *state) -{ - libnetapi_free(state->ctx); - free_join_state(state); -} - -static void callback_apply_description_change(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - NET_API_STATUS status = 0; - uint32_t parm_err = 0; - struct srvsvc_NetSrvInfo1005 info1005; - GtkWidget *dialog; - - info1005.comment = state->comment_new; - - status = NetServerSetInfo(NULL, 1005, (uint8_t *)&info1005, &parm_err); - if (status) { - debug("NetServerSetInfo failed with: %s\n", - libnetapi_errstr(state->ctx, status)); - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - "Failed to change computer description: %s.", - libnetapi_errstr(state->ctx, status)); - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - gtk_widget_show(dialog); - return; - } - - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); -} - -static void callback_do_exit(GtkWidget *widget, - gpointer data) -{ - GtkWidget *dialog; - gint result; - struct join_state *state = (struct join_state *)data; - - if (!state->settings_changed) { - callback_delete_event(NULL, NULL, NULL); - return; - } - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - "You must restart your computer before the new settings will take effect."); - result = gtk_dialog_run(GTK_DIALOG(dialog)); - switch (result) { - case GTK_RESPONSE_YES: - g_print("would reboot here\n"); - break; - case GTK_RESPONSE_NO: - default: - break; - } - gtk_widget_destroy(dialog); - gtk_widget_destroy(state->window_main); - do_cleanup(state); - exit(0); -} - - -static void callback_do_reboot(GtkWidget *widget, - gpointer data, - gpointer data2) -{ - GtkWidget *dialog; - struct join_state *state = (struct join_state *)data2; - - debug("callback_do_reboot\n"); - - state->settings_changed = TRUE; - dialog = gtk_message_dialog_new(GTK_WINDOW(data), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - "You must restart this computer for the changes to take effect."); -#if 0 - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - debug("showing dialog\n"); - gtk_widget_show(dialog); -#else - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); -#endif - - gtk_label_set_text(GTK_LABEL(state->label_reboot), "Changes will take effect after you restart this computer"); - - debug("destroying do_change window\n"); - gtk_widget_destroy(GTK_WIDGET(state->window_do_change)); - - { - uint32_t status; - const char *buffer; - uint16_t type; - - status = NetGetJoinInformation(NULL, &buffer, &type); - if (status != 0) { - g_print("failed to query status\n"); - return; - } - - debug("got new status: %s\n", buffer); -#if 0 - SAFE_FREE(state->name_buffer_new); - state->name_buffer_new = strdup(buffer); - SAFE_FREE(buffer); - state->name_type_new = type; -#endif - gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer), state->name_buffer_new); - if (state->name_type_new == 3) { - gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Domain:"); - } else { - gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Workgroup:"); - } - } -} - -static void callback_return_username(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text; - struct join_state *state = (struct join_state *)data; - if (!widget) { - return; - } - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_return_username: %s\n", entry_text); - SAFE_FREE(state->account); - state->account = strdup(entry_text); -} - -static void callback_return_username_and_enter(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text; - struct join_state *state = (struct join_state *)data; - if (!widget) { - return; - } - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_return_username: %s\n", entry_text); - SAFE_FREE(state->account); - state->account = strdup(entry_text); - g_signal_emit_by_name(state->button_ok_creds, "clicked"); -} - -static void callback_return_password(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text; - struct join_state *state = (struct join_state *)data; - if (!widget) { - return; - } - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); -#ifdef DEBUG_PASSWORD - debug("callback_return_password: %s\n", entry_text); -#else - debug("callback_return_password: (not printed)\n"); -#endif - SAFE_FREE(state->password); - state->password = strdup(entry_text); -} - -static void callback_return_password_and_enter(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text; - struct join_state *state = (struct join_state *)data; - if (!widget) { - return; - } - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); -#ifdef DEBUG_PASSWORD - debug("callback_return_password: %s\n", entry_text); -#else - debug("callback_return_password: (not printed)\n"); -#endif - SAFE_FREE(state->password); - state->password = strdup(entry_text); - g_signal_emit_by_name(state->button_ok_creds, "clicked"); -} - -static void callback_do_hostname_change(GtkWidget *widget, - gpointer data) -{ - GtkWidget *dialog; - const char *str = NULL; - - struct join_state *state = (struct join_state *)data; - - switch (state->name_type_initial) { - case NetSetupDomainName: - str = "To be implemented: call NetRenameMachineInDomain\n"; - break; - case NetSetupWorkgroupName: - str = "To be implemented: call SetComputerNameEx\n"; - break; - default: - break; - } - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - str); - - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - gtk_widget_show(dialog); -} - -static void callback_do_join(GtkWidget *widget, - gpointer data) -{ - GtkWidget *dialog; - - NET_API_STATUS status; - const char *err_str = NULL; - uint32_t join_flags = 0; - uint32_t unjoin_flags = 0; - gboolean domain_join = FALSE; - gboolean try_unjoin = FALSE; - const char *domain_or_workgroup = NULL; - - struct join_state *state = (struct join_state *)data; - - callback_return_username(state->entry_account, state); - callback_return_password(state->entry_password, state); - - if (state->window_creds_prompt) { - gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt)); - } - - if (state->name_type_new == NetSetupDomainName) { - domain_join = TRUE; - join_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | - WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE | - WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED; /* for testing */ - domain_or_workgroup = "domain"; - } else { - domain_or_workgroup = "workgroup"; - } - - if ((state->name_type_initial == NetSetupDomainName) && - (state->name_type_new == NetSetupWorkgroupName)) { - try_unjoin = TRUE; - unjoin_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | - WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE; - } - - debug("callback_do_join: Joining a %s named %s using join_flags 0x%08x ", - domain_or_workgroup, - state->name_buffer_new, - join_flags); - if (domain_join) { - debug("as %s ", state->account); -#ifdef DEBUG_PASSWORD - debug("with %s ", state->password); -#endif - } - debug("\n"); - if (try_unjoin) { - - debug("callback_do_join: Unjoining\n"); - - status = NetUnjoinDomain(NULL, - state->account, - state->password, - unjoin_flags); - if (status != 0) { - err_str = libnetapi_errstr(state->ctx, status); - g_print("callback_do_join: failed to unjoin (%s)\n", - err_str); - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "The following error occured attempting to unjoin the %s: \"%s\": %s", - domain_or_workgroup, - state->name_buffer_new, - err_str); - - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - gtk_widget_show(dialog); - - return; - } - - } - status = NetJoinDomain(NULL, - state->name_buffer_new, - NULL, - state->account, - state->password, - join_flags); - if (status != 0) { - err_str = libnetapi_errstr(state->ctx, status); - g_print("callback_do_join: failed to join (%s)\n", err_str); - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "The following error occured attempting to join the %s: \"%s\": %s", - domain_or_workgroup, - state->name_buffer_new, - err_str); - - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - gtk_widget_show(dialog); - - return; - } - - debug("callback_do_join: Successfully joined %s\n", - domain_or_workgroup); - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - "Welcome to the %s %s.", - state->name_buffer_new, - domain_or_workgroup); - - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - - callback_do_reboot(NULL, state->window_parent, state); -} - -static void callback_creds_prompt(GtkWidget *widget, - gpointer data) -{ - GtkWidget *window; - GtkWidget *box1; - GtkWidget *bbox; - GtkWidget *button; - GtkWidget *label; - - struct join_state *state = (struct join_state *)data; - - debug("callback_creds_prompt:\n"); - - state->window_parent = state->window_do_change; - - if (state->hostname_changed) { - return callback_do_hostname_change(NULL, state); - } - - if ((state->name_type_initial != NetSetupDomainName) && - (state->name_type_new != NetSetupDomainName)) { - return callback_do_join(NULL, state); - } - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - - gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); - gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); - gtk_widget_set_size_request(GTK_WIDGET(window), 380, 280); - gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); -/* gtk_window_set_icon_name(GTK_WIDGET(window), GTK_STOCK_DIALOG_AUTHENTICATION); */ - state->window_creds_prompt = window; - - g_signal_connect(G_OBJECT(window), "delete_event", - G_CALLBACK(callback_do_close), window); - - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - box1 = gtk_vbox_new(FALSE, 0); - - gtk_container_add(GTK_CONTAINER(window), box1); - - if ((state->name_type_initial == NetSetupDomainName) && - (state->name_type_new == NetSetupWorkgroupName)) { - label = gtk_label_new("Enter the name and password of an account with permission to leave the domain.\n"); - } else { - label = gtk_label_new("Enter the name and password of an account with permission to join the domain.\n"); - } - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - - gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); - - gtk_widget_show(label); - - /* USER NAME */ - label = gtk_label_new("User name:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - state->entry_account = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(state->entry_account), MAX_CRED_LEN); - g_signal_connect(G_OBJECT(state->entry_account), "activate", - G_CALLBACK(callback_return_username_and_enter), - (gpointer)state); - gtk_editable_select_region(GTK_EDITABLE(state->entry_account), - 0, GTK_ENTRY(state->entry_account)->text_length); - gtk_box_pack_start(GTK_BOX(box1), state->entry_account, TRUE, TRUE, 0); - gtk_widget_show(state->entry_account); - - /* PASSWORD */ - label = gtk_label_new("Password:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - state->entry_password = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(state->entry_password), MAX_CRED_LEN); - gtk_entry_set_visibility(GTK_ENTRY(state->entry_password), FALSE); - g_signal_connect(G_OBJECT(state->entry_password), "activate", - G_CALLBACK(callback_return_password_and_enter), - (gpointer)state); - gtk_editable_set_editable(GTK_EDITABLE(state->entry_password), TRUE); - gtk_editable_select_region(GTK_EDITABLE(state->entry_password), - 0, GTK_ENTRY(state->entry_password)->text_length); - gtk_box_pack_start(GTK_BOX(box1), state->entry_password, TRUE, TRUE, 0); - gtk_widget_show(state->entry_password); - - bbox = gtk_hbutton_box_new(); - gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); - gtk_container_add(GTK_CONTAINER(box1), bbox); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(bbox), 10); - - state->button_ok_creds = gtk_button_new_from_stock(GTK_STOCK_OK); - gtk_widget_grab_focus(GTK_WIDGET(state->button_ok_creds)); - gtk_container_add(GTK_CONTAINER(bbox), state->button_ok_creds); - g_signal_connect(G_OBJECT(state->button_ok_creds), "clicked", - G_CALLBACK(callback_do_join), - (gpointer)state); - gtk_widget_show(state->button_ok_creds); - - button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - gtk_container_add(GTK_CONTAINER(bbox), button); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(callback_do_close), (gpointer) window); - gtk_widget_show_all(window); -} - -static void callback_enter_hostname_and_unlock(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text = NULL; - char *str = NULL; - struct join_state *state = (struct join_state *)data; - - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_enter_hostname_and_unlock: %s\n", entry_text); - if (!entry_text || entry_text[0] == 0) { - state->hostname_changed = FALSE; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - if (strcasecmp(state->my_hostname, entry_text) == 0) { - state->hostname_changed = FALSE; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - state->hostname_changed = TRUE; - if (state->name_type_initial == NetSetupDomainName) { - asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); - } else { - asprintf(&str, "%s.", entry_text); - } - gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); - free(str); - - if (state->hostname_changed && str && str[0] != 0 && str[0] != '.') { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); - } -} - -static void callback_enter_computer_description_and_unlock(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text = NULL; - struct join_state *state = (struct join_state *)data; - int string_unchanged = 0; - - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_enter_computer_description_and_unlock: %s\n", - entry_text); -#if 0 - if (!entry_text || entry_text[0] == 0) { - string_unchanged = 1; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), - FALSE); - return; - } -#endif - if (entry_text && strcasecmp(state->comment, entry_text) == 0) { - string_unchanged = 1; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), - FALSE); - return; - } - - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), TRUE); - SAFE_FREE(state->comment_new); - state->comment_new = strdup(entry_text); - -} - - -static void callback_enter_workgroup_and_unlock(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text = NULL; - struct join_state *state = (struct join_state *)data; - - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_enter_workgroup_and_unlock: %s\n", entry_text); - if (!entry_text || entry_text[0] == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); - SAFE_FREE(state->name_buffer_new); - state->name_buffer_new = strdup(entry_text); - state->name_type_new = NetSetupWorkgroupName; -} - -static void callback_enter_domain_and_unlock(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text = NULL; - struct join_state *state = (struct join_state *)data; - - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_enter_domain_and_unlock: %s\n", entry_text); - if (!entry_text || entry_text[0] == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); - SAFE_FREE(state->name_buffer_new); - state->name_buffer_new = strdup(entry_text); - state->name_type_new = NetSetupDomainName; -} - -static void callback_continue(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - - gtk_widget_grab_focus(GTK_WIDGET(state->button_ok)); - g_signal_emit_by_name(state->button_ok, "clicked"); -} - -static void callback_apply_continue(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - - gtk_widget_grab_focus(GTK_WIDGET(state->button_apply)); - g_signal_emit_by_name(state->button_apply, "clicked"); -} - -static void callback_do_join_workgroup(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - debug("callback_do_join_workgroup choosen\n"); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); - gtk_widget_grab_focus(GTK_WIDGET(state->entry_workgroup)); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); - callback_enter_workgroup_and_unlock(state->entry_workgroup, state); /* TEST */ -} - -static void callback_do_join_domain(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - debug("callback_do_join_domain choosen\n"); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), TRUE); - gtk_widget_grab_focus(GTK_WIDGET(state->entry_domain)); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), FALSE); - callback_enter_domain_and_unlock(state->entry_domain, state); /* TEST */ -} - -static void callback_do_change(GtkWidget *widget, - gpointer data) -{ - GtkWidget *window; - GtkWidget *box1; - GtkWidget *bbox; - GtkWidget *button_workgroup; - GtkWidget *button_domain; - GtkWidget *button; - GtkWidget *label; - GtkWidget *frame_horz; - GtkWidget *vbox; - GtkWidget *entry; - GSList *group; - - struct join_state *state = (struct join_state *)data; - - debug("callback_do_change called\n"); - - if (state->server_role == 3) { - GtkWidget *dialog; - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - "Domain controller cannot be moved from one domain to another, they must first be demoted. Renaming this domain controller may cause it to become temporarily unavailable to users and computers. For information on renaming domain controllers, including alternate renaming methods, see Help and Support. To continue renaming this domain controller, click OK."); - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - gtk_widget_show(dialog); - return; - } - - state->button_ok = gtk_button_new_from_stock(GTK_STOCK_OK); - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - - gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); - gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_widget_set_size_request(GTK_WIDGET(window), 480, 500); /* breite * höhe */ - gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); - - g_signal_connect(G_OBJECT(window), "delete_event", - G_CALLBACK(callback_do_close), window); - - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - box1 = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(window), box1); - - label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network ressources."); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); - gtk_widget_show(label); - - /* COMPUTER NAME */ - label = gtk_label_new("Computer name:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); - gtk_widget_show(label); - - state->label_full_computer_name = gtk_label_new(NULL); - { - entry = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(entry), MAX_NETBIOS_NAME_LEN); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(callback_enter_hostname_and_unlock), - (gpointer)state); - gtk_entry_set_text(GTK_ENTRY(entry), state->my_hostname); - gtk_editable_select_region(GTK_EDITABLE(entry), - 0, GTK_ENTRY(entry)->text_length); - - gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ - gtk_box_pack_start(GTK_BOX(box1), entry, TRUE, TRUE, 0); - gtk_widget_show(entry); - } - - /* FULL COMPUTER NAME */ - label = gtk_label_new("Full computer name:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); - gtk_widget_show(label); - - { - const gchar *entry_text; - char *str = NULL; - entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); - if (state->name_type_initial == NetSetupDomainName) { - asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); - } else { - asprintf(&str, "%s.", entry_text); - } - gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); - free(str); - gtk_misc_set_alignment(GTK_MISC(state->label_full_computer_name), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), state->label_full_computer_name, TRUE, TRUE, 0); - gtk_widget_show(state->label_full_computer_name); - } - - /* BOX */ - frame_horz = gtk_frame_new ("Member Of"); - gtk_box_pack_start(GTK_BOX(box1), frame_horz, TRUE, TRUE, 10); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - gtk_container_add(GTK_CONTAINER(frame_horz), vbox); - - /* TWO ENTRIES */ - state->entry_workgroup = gtk_entry_new(); - state->entry_domain = gtk_entry_new(); - - /* DOMAIN */ - button_domain = gtk_radio_button_new_with_label(NULL, "Domain"); - if (state->name_type_initial == NetSetupDomainName) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_domain), TRUE); - } - gtk_box_pack_start(GTK_BOX(vbox), button_domain, TRUE, TRUE, 0); - g_signal_connect(G_OBJECT(button_domain), "clicked", - G_CALLBACK(callback_do_join_domain), - (gpointer)state); - - { - gtk_entry_set_max_length(GTK_ENTRY(state->entry_domain), 50); - g_signal_connect(G_OBJECT(state->entry_domain), "changed", - G_CALLBACK(callback_enter_domain_and_unlock), - (gpointer)state); - g_signal_connect(G_OBJECT(state->entry_domain), "activate", - G_CALLBACK(callback_continue), - (gpointer)state); - if (state->name_type_initial == NetSetupDomainName) { - gtk_entry_set_text(GTK_ENTRY(state->entry_domain), state->name_buffer_initial); - gtk_widget_set_sensitive(state->entry_workgroup, FALSE); - gtk_widget_set_sensitive(state->entry_domain, TRUE); - } - gtk_editable_set_editable(GTK_EDITABLE(state->entry_domain), TRUE); - gtk_box_pack_start(GTK_BOX(vbox), state->entry_domain, TRUE, TRUE, 0); - gtk_widget_show(state->entry_domain); - } - gtk_widget_show(button_domain); - - /* WORKGROUP */ - group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button_domain)); - button_workgroup = gtk_radio_button_new_with_label(group, "Workgroup"); - if (state->name_type_initial == NetSetupWorkgroupName) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_workgroup), TRUE); - } - gtk_box_pack_start(GTK_BOX(vbox), button_workgroup, TRUE, TRUE, 0); - g_signal_connect(G_OBJECT(button_workgroup), "clicked", - G_CALLBACK(callback_do_join_workgroup), - (gpointer)state); - { - gtk_entry_set_max_length(GTK_ENTRY(state->entry_workgroup), MAX_NETBIOS_NAME_LEN); - g_signal_connect(G_OBJECT(state->entry_workgroup), "changed", - G_CALLBACK(callback_enter_workgroup_and_unlock), - (gpointer)state); - g_signal_connect(G_OBJECT(state->entry_workgroup), "activate", - G_CALLBACK(callback_continue), - (gpointer)state); - - if (state->name_type_initial == NetSetupWorkgroupName) { - gtk_entry_set_text(GTK_ENTRY(state->entry_workgroup), state->name_buffer_initial); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); - } - gtk_box_pack_start(GTK_BOX(vbox), state->entry_workgroup, TRUE, TRUE, 0); - gtk_widget_show(state->entry_workgroup); - } - gtk_widget_show(button_workgroup); - - /* BUTTONS */ - bbox = gtk_hbutton_box_new(); - gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); - gtk_container_add(GTK_CONTAINER(box1), bbox); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(bbox), 10); - - state->window_do_change = window; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); /* !!! */ - gtk_container_add(GTK_CONTAINER(bbox), state->button_ok); - g_signal_connect(G_OBJECT(state->button_ok), "clicked", - G_CALLBACK(callback_creds_prompt), - (gpointer)state); - - button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - gtk_container_add(GTK_CONTAINER(bbox), button); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(callback_do_close), - (gpointer)window); - - gtk_widget_show_all(window); - -} - -static void callback_do_about(GtkWidget *widget, - gpointer data) -{ - GdkPixbuf *logo; - GError *error = NULL; - - debug("callback_do_about called\n"); - - logo = gdk_pixbuf_new_from_file(SAMBA_IMAGE_PATH, - &error); - if (logo == NULL) { - g_print("failed to load logo from %s: %s\n", - SAMBA_IMAGE_PATH, error->message); - } - - gtk_show_about_dialog(data, - "name", "Samba", - "version", "3.2.0pre2-GIT-904a90-test", - "copyright", "Copyright Andrew Tridgell and the Samba Team 1992-2007", - "website", "http://www.samba.org", - "license", "GPLv3", - "logo", logo, - "comments", "Samba gtk domain join utility", - NULL); -} - -static int draw_main_window(struct join_state *state) -{ - GtkWidget *window; - GtkWidget *button; - GtkWidget *label; - GtkWidget *main_vbox; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *bbox; - GtkWidget *image; - GtkWidget *table; - GtkWidget *entry; - GdkPixbuf *icon; - GError *error = NULL; - - icon = gdk_pixbuf_new_from_file(SAMBA_ICON_PATH, - &error); - if (icon == NULL) { - g_print("failed to load logo from %s : %s\n", - SAMBA_ICON_PATH, error->message); - } - -#if 1 - image = gtk_image_new_from_file(SAMBA_IMAGE_PATH); -#else - image = gtk_image_new_from_file("/usr/share/pixmaps/redhat-system_settings.png"); -#endif - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - state->window_main = window; - - gtk_window_set_title(GTK_WINDOW(window), "Samba - Join Domain dialogue"); - gtk_widget_set_size_request(GTK_WIDGET(window), 600, 600); /* breite * höhe */ - gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); - - g_signal_connect(G_OBJECT(window), "delete_event", - G_CALLBACK(callback_delete_event), NULL); - - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - main_vbox = gtk_vbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(window), main_vbox); - -#if 0 - gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); - gtk_widget_show(image); -#endif - /* Hbox */ - hbox = gtk_hbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(main_vbox), hbox); - - { -/* gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); */ - gtk_misc_set_alignment(GTK_MISC(image), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 10); - gtk_widget_show(image); - - /* Label */ - label = gtk_label_new("Samba uses the following information to identify your computer on the network."); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_widget_set_size_request(GTK_WIDGET(label), 500, 40); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - } - - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - gtk_container_add(GTK_CONTAINER(main_vbox), vbox); - - /* Table */ - table = gtk_table_new(6, 3, TRUE); - gtk_table_set_row_spacings(GTK_TABLE(table), 5); - gtk_table_set_col_spacings(GTK_TABLE(table), 5); - gtk_container_add(GTK_CONTAINER(vbox), table); - - { - /* Label */ - label = gtk_label_new("Computer description:"); -/* gtk_misc_set_alignment(GTK_MISC(label), 0, 0); */ - gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); - gtk_widget_show(label); - - state->button_apply = gtk_button_new_from_stock(GTK_STOCK_APPLY); - - /* Entry */ - entry = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(entry), 256); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(callback_enter_computer_description_and_unlock), - state); - g_signal_connect(G_OBJECT(entry), "activate", - G_CALLBACK(callback_apply_continue), - (gpointer)state); - - gtk_entry_set_text(GTK_ENTRY(entry), (char *)state->comment); - gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ - gtk_table_attach_defaults(GTK_TABLE(table), entry, 1, 3, 0, 1); - gtk_widget_show(entry); - } - - /* Label */ - label = gtk_label_new("For example: \"Samba \%v\"."); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 1, 2); - gtk_widget_show(label); - - /* Label */ - label = gtk_label_new("Full computer name:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); - gtk_widget_show(label); - - { - /* Label */ - char *str = NULL; - if (state->name_type_initial == NetSetupDomainName) { - asprintf(&str, "%s.%s", state->my_hostname, - state->my_dnsdomain); - } else { - asprintf(&str, "%s.", state->my_hostname); - } - - label = gtk_label_new(str); - SAFE_FREE(str); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 2, 3); - gtk_widget_show(label); - } - - /* Label */ - if (state->name_type_initial == NetSetupDomainName) { - label = gtk_label_new("Domain:"); - } else { - label = gtk_label_new("Workgroup:"); - } - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); - gtk_widget_show(label); - state->label_current_name_type = label; - - /* Label */ - label = gtk_label_new(state->name_buffer_initial); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 3, 4); - gtk_widget_show(label); - state->label_current_name_buffer = label; - - { - hbox = gtk_hbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(vbox), hbox); - label = gtk_label_new("To rename this computer or join a domain, click Change."); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - - } - - /* bbox */ - bbox = gtk_hbutton_box_new(); - gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); - gtk_container_add(GTK_CONTAINER(hbox), bbox); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(bbox), 10); - - button = gtk_button_new_with_mnemonic("Ch_ange"); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(callback_do_change), - (gpointer)state); - gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - /* Label (hidden) */ - state->label_reboot = gtk_label_new(NULL); - gtk_label_set_line_wrap(GTK_LABEL(state->label_reboot), TRUE); - gtk_misc_set_alignment(GTK_MISC(state->label_reboot), 0, 0); - gtk_box_pack_start(GTK_BOX(vbox), state->label_reboot, TRUE, TRUE, 0); - gtk_widget_show(state->label_reboot); - -#if 0 - gtk_box_pack_start(GTK_BOX(vbox), - create_bbox(window, TRUE, NULL, 10, 85, 20, GTK_BUTTONBOX_END), - TRUE, TRUE, 5); -#endif - { - - GtkWidget *frame; - GtkWidget *bbox2; - GtkWidget *button2; - - frame = gtk_frame_new(NULL); - bbox2 = gtk_hbutton_box_new(); - - gtk_container_set_border_width(GTK_CONTAINER(bbox2), 5); - gtk_container_add(GTK_CONTAINER(frame), bbox2); - - /* Set the appearance of the Button Box */ - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox2), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(bbox2), 10); - /*gtk_button_box_set_child_size(GTK_BUTTON_BOX(bbox2), child_w, child_h);*/ - - button2 = gtk_button_new_from_stock(GTK_STOCK_OK); - gtk_container_add(GTK_CONTAINER(bbox2), button2); - g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(callback_do_exit), state); - - button2 = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - gtk_container_add(GTK_CONTAINER(bbox2), button2); - g_signal_connect(G_OBJECT(button2), "clicked", - G_CALLBACK(callback_delete_event), - window); - - gtk_container_add(GTK_CONTAINER(bbox2), state->button_apply); - g_signal_connect(G_OBJECT(state->button_apply), "clicked", - G_CALLBACK(callback_apply_description_change), - state); - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); - - button2 = gtk_button_new_from_stock(GTK_STOCK_ABOUT); - gtk_container_add(GTK_CONTAINER(bbox2), button2); - g_signal_connect(G_OBJECT(button2), "clicked", - G_CALLBACK(callback_do_about), - window); - - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); - } - - gtk_widget_show_all(window); - - return 0; -} - -static int init_join_state(struct join_state **state) -{ - struct join_state *s; - - s = malloc(sizeof(struct join_state)); - if (!s) { - return -1; - } - - memset(s, '\0', sizeof(struct join_state)); - - *state = s; - - return 0; -} - -static int initialize_join_state(struct join_state *state, - const char *debug_level) -{ - struct libnetapi_ctx *ctx = NULL; - NET_API_STATUS status = 0; - - status = libnetapi_init(&ctx); - if (status) { - return status; - } - - if (debug_level) { - libnetapi_set_debuglevel(ctx, debug_level); - } - - { - char my_hostname[HOST_NAME_MAX]; - const char *p = NULL; - if (gethostname(my_hostname, sizeof(my_hostname)) == -1) { - return -1; - } - - state->my_fqdn = strdup(my_hostname); - if (!state->my_fqdn) { - return -1; - } - - p = strchr(my_hostname, '.'); - if (p) { - my_hostname[strlen(my_hostname) - strlen(p)] = '\0'; - state->my_hostname = strdup(my_hostname); - if (!state->my_hostname) { - return -1; - } - p++; - state->my_dnsdomain = strdup(p); - if (!state->my_dnsdomain) { - return -1; - } - } - } - - { - const char *buffer = NULL; - uint16_t type = 0; - status = NetGetJoinInformation(NULL, &buffer, &type); - if (status) { - return status; - } - state->name_buffer_initial = (char *)buffer; - state->name_type_initial = type; - } - - { - struct srvsvc_NetSrvInfo1005 *info1005 = NULL; - uint8_t *buffer = NULL; - - status = NetServerGetInfo(NULL, 1005, &buffer); - if (status) { - return status; - } - - info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer; - - state->comment = strdup(info1005->comment); - if (!state->comment) { - return -1; - } - } -#if 0 - { - struct srvsvc_NetSrvInfo100 *info100 = NULL; - uint8_t *buffer = NULL; - - status = NetServerGetInfo(NULL, 100, &buffer); - if (status) { - return status; - } - - info100 = (struct srvsvc_NetSrvInfo100 *)buffer; - - state->comment = strdup(info100->comment); - if (!state->comment) { - return -1; - } - } -#endif - - state->ctx = ctx; - - return 0; -} - -int main(int argc, char **argv) -{ - GOptionContext *context = NULL; - static const char *debug_level = NULL; - struct join_state *state = NULL; - GError *error = NULL; - int ret = 0; - - static GOptionEntry entries[] = { - { "debug", 'd', 0, G_OPTION_ARG_STRING, &debug_level, "Debug level (for samba)", "N" }, - { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Verbose output", 0 }, - { NULL } - }; - - context = g_option_context_new("- Samba domain join utility"); - g_option_context_add_main_entries(context, entries, NULL); -/* g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); */ - g_option_context_add_group(context, gtk_get_option_group(TRUE)); - g_option_context_parse(context, &argc, &argv, &error); - - gtk_init(&argc, &argv); - g_set_application_name("Samba"); - - ret = init_join_state(&state); - if (ret) { - return ret; - } - - ret = initialize_join_state(state, debug_level); - if (ret) { - return ret; - } - - draw_main_window(state); - - gtk_main(); - - do_cleanup(state); - - return 0; -} diff --git a/source3/lib/netapi/examples/netdomjoin-gui/logo.png b/source3/lib/netapi/examples/netdomjoin-gui/logo.png new file mode 100644 index 0000000000..6df4ace659 Binary files /dev/null and b/source3/lib/netapi/examples/netdomjoin-gui/logo.png differ diff --git a/source3/lib/netapi/examples/netdomjoin-gui/samba.ico b/source3/lib/netapi/examples/netdomjoin-gui/samba.ico new file mode 100755 index 0000000000..b70c9590de Binary files /dev/null and b/source3/lib/netapi/examples/netdomjoin-gui/samba.ico differ diff --git a/source3/lib/netapi/examples/netdomjoin.c b/source3/lib/netapi/examples/netdomjoin.c deleted file mode 100644 index a2bb700250..0000000000 --- a/source3/lib/netapi/examples/netdomjoin.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Join Support (cmdline + netapi) - * Copyright (C) Guenther Deschner 2007 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include -#include -#include -#include -#include - -#include - -char *get_string_param(const char *param) -{ - char *p; - - p = strchr(param, '='); - if (!p) { - return NULL; - } - - return (p+1); -} - -int main(int argc, char **argv) -{ - NET_API_STATUS status; - const char *server_name = NULL; - const char *domain_name = NULL; - const char *account_ou = NULL; - const char *Account = NULL; - const char *password = NULL; - uint32_t join_flags = 3; - struct libnetapi_ctx *ctx = NULL; - int i; - - status = libnetapi_init(&ctx); - if (status != 0) { - return status; - } - - if (argc < 2) { - printf("usage: netdomjoin\n"); - printf("\t[hostname=HOSTNAME] [domain=DOMAIN] \n"); - return 0; - } - - if (argc > 2) { - server_name = argv[1]; - } - - for (i=0; i. + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define MAX_CRED_LEN 256 +#define MAX_NETBIOS_NAME_LEN 15 + +#define SAMBA_ICON_PATH "/usr/share/pixmaps/samba/samba.ico" +#define SAMBA_IMAGE_PATH "/usr/share/pixmaps/samba/logo.png" + +#define WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED ( 0x00000020 ) +#define WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE ( 0x00000004 ) +#define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 ) +#define WKSSVC_JOIN_FLAGS_JOIN_TYPE ( 0x00000001 ) + +#define NetSetupWorkgroupName ( 2 ) +#define NetSetupDomainName ( 3 ) + +#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) + +struct srvsvc_NetSrvInfo1005 { + const char *comment;/* [unique,charset(UTF16)] */ +}; + +static gboolean verbose = FALSE; + +typedef struct join_state { + struct libnetapi_ctx *ctx; + GtkWidget *window_main; + GtkWidget *window_parent; + GtkWidget *window_do_change; + GtkWidget *window_creds_prompt; + GtkWidget *entry_account; + GtkWidget *entry_password; + GtkWidget *entry_domain; + GtkWidget *entry_workgroup; + GtkWidget *button_ok; + GtkWidget *button_apply; + GtkWidget *button_ok_creds; + GtkWidget *label_reboot; + GtkWidget *label_current_name_buffer; + GtkWidget *label_current_name_type; + GtkWidget *label_full_computer_name; + uint16_t name_type_initial; + uint16_t name_type_new; + char *name_buffer_initial; + char *name_buffer_new; + char *password; + char *account; + char *comment; + char *comment_new; + char *my_fqdn; + char *my_dnsdomain; + char *my_hostname; + uint16_t server_role; + gboolean settings_changed; + gboolean hostname_changed; +} join_state; + +static void debug(const char *format, ...) +{ + va_list args; + + if (!verbose) { + return; + } + + va_start(args, format); + g_vprintf(format, args); + va_end(args); +} + +static gboolean callback_delete_event(GtkWidget *widget, + GdkEvent *event, + gpointer data) +{ + gtk_main_quit(); + return FALSE; +} + +static void callback_do_close(GtkWidget *widget, + gpointer data) +{ + debug("Closing now...\n"); + gtk_widget_destroy(data); +} + +static void free_join_state(struct join_state *s) +{ + SAFE_FREE(s->name_buffer_initial); + SAFE_FREE(s->name_buffer_new); + SAFE_FREE(s->password); + SAFE_FREE(s->account); + SAFE_FREE(s->comment); + SAFE_FREE(s->comment_new); + SAFE_FREE(s->my_fqdn); + SAFE_FREE(s->my_dnsdomain); + SAFE_FREE(s->my_hostname); + +} + +static void do_cleanup(struct join_state *state) +{ + libnetapi_free(state->ctx); + free_join_state(state); +} + +static void callback_apply_description_change(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + NET_API_STATUS status = 0; + uint32_t parm_err = 0; + struct srvsvc_NetSrvInfo1005 info1005; + GtkWidget *dialog; + + info1005.comment = state->comment_new; + + status = NetServerSetInfo(NULL, 1005, (uint8_t *)&info1005, &parm_err); + if (status) { + debug("NetServerSetInfo failed with: %s\n", + libnetapi_errstr(state->ctx, status)); + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "Failed to change computer description: %s.", + libnetapi_errstr(state->ctx, status)); + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + return; + } + + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); +} + +static void callback_do_exit(GtkWidget *widget, + gpointer data) +{ + GtkWidget *dialog; + gint result; + struct join_state *state = (struct join_state *)data; + + if (!state->settings_changed) { + callback_delete_event(NULL, NULL, NULL); + return; + } + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "You must restart your computer before the new settings will take effect."); + result = gtk_dialog_run(GTK_DIALOG(dialog)); + switch (result) { + case GTK_RESPONSE_YES: + g_print("would reboot here\n"); + break; + case GTK_RESPONSE_NO: + default: + break; + } + gtk_widget_destroy(dialog); + gtk_widget_destroy(state->window_main); + do_cleanup(state); + exit(0); +} + + +static void callback_do_reboot(GtkWidget *widget, + gpointer data, + gpointer data2) +{ + GtkWidget *dialog; + struct join_state *state = (struct join_state *)data2; + + debug("callback_do_reboot\n"); + + state->settings_changed = TRUE; + dialog = gtk_message_dialog_new(GTK_WINDOW(data), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "You must restart this computer for the changes to take effect."); +#if 0 + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + debug("showing dialog\n"); + gtk_widget_show(dialog); +#else + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +#endif + + gtk_label_set_text(GTK_LABEL(state->label_reboot), "Changes will take effect after you restart this computer"); + + debug("destroying do_change window\n"); + gtk_widget_destroy(GTK_WIDGET(state->window_do_change)); + + { + uint32_t status; + const char *buffer; + uint16_t type; + + status = NetGetJoinInformation(NULL, &buffer, &type); + if (status != 0) { + g_print("failed to query status\n"); + return; + } + + debug("got new status: %s\n", buffer); +#if 0 + SAFE_FREE(state->name_buffer_new); + state->name_buffer_new = strdup(buffer); + SAFE_FREE(buffer); + state->name_type_new = type; +#endif + gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer), state->name_buffer_new); + if (state->name_type_new == 3) { + gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Domain:"); + } else { + gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Workgroup:"); + } + } +} + +static void callback_return_username(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_return_username: %s\n", entry_text); + SAFE_FREE(state->account); + state->account = strdup(entry_text); +} + +static void callback_return_username_and_enter(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_return_username: %s\n", entry_text); + SAFE_FREE(state->account); + state->account = strdup(entry_text); + g_signal_emit_by_name(state->button_ok_creds, "clicked"); +} + +static void callback_return_password(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); +#ifdef DEBUG_PASSWORD + debug("callback_return_password: %s\n", entry_text); +#else + debug("callback_return_password: (not printed)\n"); +#endif + SAFE_FREE(state->password); + state->password = strdup(entry_text); +} + +static void callback_return_password_and_enter(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); +#ifdef DEBUG_PASSWORD + debug("callback_return_password: %s\n", entry_text); +#else + debug("callback_return_password: (not printed)\n"); +#endif + SAFE_FREE(state->password); + state->password = strdup(entry_text); + g_signal_emit_by_name(state->button_ok_creds, "clicked"); +} + +static void callback_do_hostname_change(GtkWidget *widget, + gpointer data) +{ + GtkWidget *dialog; + const char *str = NULL; + + struct join_state *state = (struct join_state *)data; + + switch (state->name_type_initial) { + case NetSetupDomainName: + str = "To be implemented: call NetRenameMachineInDomain\n"; + break; + case NetSetupWorkgroupName: + str = "To be implemented: call SetComputerNameEx\n"; + break; + default: + break; + } + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + str); + + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + gtk_widget_show(dialog); +} + +static void callback_do_join(GtkWidget *widget, + gpointer data) +{ + GtkWidget *dialog; + + NET_API_STATUS status; + const char *err_str = NULL; + uint32_t join_flags = 0; + uint32_t unjoin_flags = 0; + gboolean domain_join = FALSE; + gboolean try_unjoin = FALSE; + const char *domain_or_workgroup = NULL; + + struct join_state *state = (struct join_state *)data; + + callback_return_username(state->entry_account, state); + callback_return_password(state->entry_password, state); + + if (state->window_creds_prompt) { + gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt)); + } + + if (state->name_type_new == NetSetupDomainName) { + domain_join = TRUE; + join_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | + WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE | + WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED; /* for testing */ + domain_or_workgroup = "domain"; + } else { + domain_or_workgroup = "workgroup"; + } + + if ((state->name_type_initial == NetSetupDomainName) && + (state->name_type_new == NetSetupWorkgroupName)) { + try_unjoin = TRUE; + unjoin_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | + WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE; + } + + debug("callback_do_join: Joining a %s named %s using join_flags 0x%08x ", + domain_or_workgroup, + state->name_buffer_new, + join_flags); + if (domain_join) { + debug("as %s ", state->account); +#ifdef DEBUG_PASSWORD + debug("with %s ", state->password); +#endif + } + debug("\n"); + if (try_unjoin) { + + debug("callback_do_join: Unjoining\n"); + + status = NetUnjoinDomain(NULL, + state->account, + state->password, + unjoin_flags); + if (status != 0) { + err_str = libnetapi_errstr(state->ctx, status); + g_print("callback_do_join: failed to unjoin (%s)\n", + err_str); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "The following error occured attempting to unjoin the %s: \"%s\": %s", + domain_or_workgroup, + state->name_buffer_new, + err_str); + + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + + return; + } + + } + status = NetJoinDomain(NULL, + state->name_buffer_new, + NULL, + state->account, + state->password, + join_flags); + if (status != 0) { + err_str = libnetapi_errstr(state->ctx, status); + g_print("callback_do_join: failed to join (%s)\n", err_str); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "The following error occured attempting to join the %s: \"%s\": %s", + domain_or_workgroup, + state->name_buffer_new, + err_str); + + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + + return; + } + + debug("callback_do_join: Successfully joined %s\n", + domain_or_workgroup); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Welcome to the %s %s.", + state->name_buffer_new, + domain_or_workgroup); + + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + callback_do_reboot(NULL, state->window_parent, state); +} + +static void callback_creds_prompt(GtkWidget *widget, + gpointer data) +{ + GtkWidget *window; + GtkWidget *box1; + GtkWidget *bbox; + GtkWidget *button; + GtkWidget *label; + + struct join_state *state = (struct join_state *)data; + + debug("callback_creds_prompt:\n"); + + state->window_parent = state->window_do_change; + + if (state->hostname_changed) { + return callback_do_hostname_change(NULL, state); + } + + if ((state->name_type_initial != NetSetupDomainName) && + (state->name_type_new != NetSetupDomainName)) { + return callback_do_join(NULL, state); + } + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); + gtk_widget_set_size_request(GTK_WIDGET(window), 380, 280); + gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); +/* gtk_window_set_icon_name(GTK_WIDGET(window), GTK_STOCK_DIALOG_AUTHENTICATION); */ + state->window_creds_prompt = window; + + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(callback_do_close), window); + + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + box1 = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(window), box1); + + if ((state->name_type_initial == NetSetupDomainName) && + (state->name_type_new == NetSetupWorkgroupName)) { + label = gtk_label_new("Enter the name and password of an account with permission to leave the domain.\n"); + } else { + label = gtk_label_new("Enter the name and password of an account with permission to join the domain.\n"); + } + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + + gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); + + gtk_widget_show(label); + + /* USER NAME */ + label = gtk_label_new("User name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + state->entry_account = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(state->entry_account), MAX_CRED_LEN); + g_signal_connect(G_OBJECT(state->entry_account), "activate", + G_CALLBACK(callback_return_username_and_enter), + (gpointer)state); + gtk_editable_select_region(GTK_EDITABLE(state->entry_account), + 0, GTK_ENTRY(state->entry_account)->text_length); + gtk_box_pack_start(GTK_BOX(box1), state->entry_account, TRUE, TRUE, 0); + gtk_widget_show(state->entry_account); + + /* PASSWORD */ + label = gtk_label_new("Password:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + state->entry_password = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(state->entry_password), MAX_CRED_LEN); + gtk_entry_set_visibility(GTK_ENTRY(state->entry_password), FALSE); + g_signal_connect(G_OBJECT(state->entry_password), "activate", + G_CALLBACK(callback_return_password_and_enter), + (gpointer)state); + gtk_editable_set_editable(GTK_EDITABLE(state->entry_password), TRUE); + gtk_editable_select_region(GTK_EDITABLE(state->entry_password), + 0, GTK_ENTRY(state->entry_password)->text_length); + gtk_box_pack_start(GTK_BOX(box1), state->entry_password, TRUE, TRUE, 0); + gtk_widget_show(state->entry_password); + + bbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); + gtk_container_add(GTK_CONTAINER(box1), bbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox), 10); + + state->button_ok_creds = gtk_button_new_from_stock(GTK_STOCK_OK); + gtk_widget_grab_focus(GTK_WIDGET(state->button_ok_creds)); + gtk_container_add(GTK_CONTAINER(bbox), state->button_ok_creds); + g_signal_connect(G_OBJECT(state->button_ok_creds), "clicked", + G_CALLBACK(callback_do_join), + (gpointer)state); + gtk_widget_show(state->button_ok_creds); + + button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_container_add(GTK_CONTAINER(bbox), button); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(callback_do_close), (gpointer) window); + gtk_widget_show_all(window); +} + +static void callback_enter_hostname_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + char *str = NULL; + struct join_state *state = (struct join_state *)data; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_hostname_and_unlock: %s\n", entry_text); + if (!entry_text || entry_text[0] == 0) { + state->hostname_changed = FALSE; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + if (strcasecmp(state->my_hostname, entry_text) == 0) { + state->hostname_changed = FALSE; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + state->hostname_changed = TRUE; + if (state->name_type_initial == NetSetupDomainName) { + asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); + } else { + asprintf(&str, "%s.", entry_text); + } + gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); + free(str); + + if (state->hostname_changed && str && str[0] != 0 && str[0] != '.') { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); + } +} + +static void callback_enter_computer_description_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + struct join_state *state = (struct join_state *)data; + int string_unchanged = 0; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_computer_description_and_unlock: %s\n", + entry_text); +#if 0 + if (!entry_text || entry_text[0] == 0) { + string_unchanged = 1; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), + FALSE); + return; + } +#endif + if (entry_text && strcasecmp(state->comment, entry_text) == 0) { + string_unchanged = 1; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), + FALSE); + return; + } + + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), TRUE); + SAFE_FREE(state->comment_new); + state->comment_new = strdup(entry_text); + +} + + +static void callback_enter_workgroup_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + struct join_state *state = (struct join_state *)data; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_workgroup_and_unlock: %s\n", entry_text); + if (!entry_text || entry_text[0] == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); + SAFE_FREE(state->name_buffer_new); + state->name_buffer_new = strdup(entry_text); + state->name_type_new = NetSetupWorkgroupName; +} + +static void callback_enter_domain_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + struct join_state *state = (struct join_state *)data; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_domain_and_unlock: %s\n", entry_text); + if (!entry_text || entry_text[0] == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); + SAFE_FREE(state->name_buffer_new); + state->name_buffer_new = strdup(entry_text); + state->name_type_new = NetSetupDomainName; +} + +static void callback_continue(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + + gtk_widget_grab_focus(GTK_WIDGET(state->button_ok)); + g_signal_emit_by_name(state->button_ok, "clicked"); +} + +static void callback_apply_continue(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + + gtk_widget_grab_focus(GTK_WIDGET(state->button_apply)); + g_signal_emit_by_name(state->button_apply, "clicked"); +} + +static void callback_do_join_workgroup(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + debug("callback_do_join_workgroup choosen\n"); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); + gtk_widget_grab_focus(GTK_WIDGET(state->entry_workgroup)); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); + callback_enter_workgroup_and_unlock(state->entry_workgroup, state); /* TEST */ +} + +static void callback_do_join_domain(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + debug("callback_do_join_domain choosen\n"); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), TRUE); + gtk_widget_grab_focus(GTK_WIDGET(state->entry_domain)); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), FALSE); + callback_enter_domain_and_unlock(state->entry_domain, state); /* TEST */ +} + +static void callback_do_change(GtkWidget *widget, + gpointer data) +{ + GtkWidget *window; + GtkWidget *box1; + GtkWidget *bbox; + GtkWidget *button_workgroup; + GtkWidget *button_domain; + GtkWidget *button; + GtkWidget *label; + GtkWidget *frame_horz; + GtkWidget *vbox; + GtkWidget *entry; + GSList *group; + + struct join_state *state = (struct join_state *)data; + + debug("callback_do_change called\n"); + + if (state->server_role == 3) { + GtkWidget *dialog; + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "Domain controller cannot be moved from one domain to another, they must first be demoted. Renaming this domain controller may cause it to become temporarily unavailable to users and computers. For information on renaming domain controllers, including alternate renaming methods, see Help and Support. To continue renaming this domain controller, click OK."); + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + return; + } + + state->button_ok = gtk_button_new_from_stock(GTK_STOCK_OK); + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + gtk_widget_set_size_request(GTK_WIDGET(window), 480, 500); /* breite * höhe */ + gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); + + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(callback_do_close), window); + + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + box1 = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), box1); + + label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network ressources."); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + /* COMPUTER NAME */ + label = gtk_label_new("Computer name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + state->label_full_computer_name = gtk_label_new(NULL); + { + entry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(entry), MAX_NETBIOS_NAME_LEN); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(callback_enter_hostname_and_unlock), + (gpointer)state); + gtk_entry_set_text(GTK_ENTRY(entry), state->my_hostname); + gtk_editable_select_region(GTK_EDITABLE(entry), + 0, GTK_ENTRY(entry)->text_length); + + gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ + gtk_box_pack_start(GTK_BOX(box1), entry, TRUE, TRUE, 0); + gtk_widget_show(entry); + } + + /* FULL COMPUTER NAME */ + label = gtk_label_new("Full computer name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + { + const gchar *entry_text; + char *str = NULL; + entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); + if (state->name_type_initial == NetSetupDomainName) { + asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); + } else { + asprintf(&str, "%s.", entry_text); + } + gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); + free(str); + gtk_misc_set_alignment(GTK_MISC(state->label_full_computer_name), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), state->label_full_computer_name, TRUE, TRUE, 0); + gtk_widget_show(state->label_full_computer_name); + } + + /* BOX */ + frame_horz = gtk_frame_new ("Member Of"); + gtk_box_pack_start(GTK_BOX(box1), frame_horz, TRUE, TRUE, 10); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + gtk_container_add(GTK_CONTAINER(frame_horz), vbox); + + /* TWO ENTRIES */ + state->entry_workgroup = gtk_entry_new(); + state->entry_domain = gtk_entry_new(); + + /* DOMAIN */ + button_domain = gtk_radio_button_new_with_label(NULL, "Domain"); + if (state->name_type_initial == NetSetupDomainName) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_domain), TRUE); + } + gtk_box_pack_start(GTK_BOX(vbox), button_domain, TRUE, TRUE, 0); + g_signal_connect(G_OBJECT(button_domain), "clicked", + G_CALLBACK(callback_do_join_domain), + (gpointer)state); + + { + gtk_entry_set_max_length(GTK_ENTRY(state->entry_domain), 50); + g_signal_connect(G_OBJECT(state->entry_domain), "changed", + G_CALLBACK(callback_enter_domain_and_unlock), + (gpointer)state); + g_signal_connect(G_OBJECT(state->entry_domain), "activate", + G_CALLBACK(callback_continue), + (gpointer)state); + if (state->name_type_initial == NetSetupDomainName) { + gtk_entry_set_text(GTK_ENTRY(state->entry_domain), state->name_buffer_initial); + gtk_widget_set_sensitive(state->entry_workgroup, FALSE); + gtk_widget_set_sensitive(state->entry_domain, TRUE); + } + gtk_editable_set_editable(GTK_EDITABLE(state->entry_domain), TRUE); + gtk_box_pack_start(GTK_BOX(vbox), state->entry_domain, TRUE, TRUE, 0); + gtk_widget_show(state->entry_domain); + } + gtk_widget_show(button_domain); + + /* WORKGROUP */ + group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button_domain)); + button_workgroup = gtk_radio_button_new_with_label(group, "Workgroup"); + if (state->name_type_initial == NetSetupWorkgroupName) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_workgroup), TRUE); + } + gtk_box_pack_start(GTK_BOX(vbox), button_workgroup, TRUE, TRUE, 0); + g_signal_connect(G_OBJECT(button_workgroup), "clicked", + G_CALLBACK(callback_do_join_workgroup), + (gpointer)state); + { + gtk_entry_set_max_length(GTK_ENTRY(state->entry_workgroup), MAX_NETBIOS_NAME_LEN); + g_signal_connect(G_OBJECT(state->entry_workgroup), "changed", + G_CALLBACK(callback_enter_workgroup_and_unlock), + (gpointer)state); + g_signal_connect(G_OBJECT(state->entry_workgroup), "activate", + G_CALLBACK(callback_continue), + (gpointer)state); + + if (state->name_type_initial == NetSetupWorkgroupName) { + gtk_entry_set_text(GTK_ENTRY(state->entry_workgroup), state->name_buffer_initial); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); + } + gtk_box_pack_start(GTK_BOX(vbox), state->entry_workgroup, TRUE, TRUE, 0); + gtk_widget_show(state->entry_workgroup); + } + gtk_widget_show(button_workgroup); + + /* BUTTONS */ + bbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); + gtk_container_add(GTK_CONTAINER(box1), bbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox), 10); + + state->window_do_change = window; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); /* !!! */ + gtk_container_add(GTK_CONTAINER(bbox), state->button_ok); + g_signal_connect(G_OBJECT(state->button_ok), "clicked", + G_CALLBACK(callback_creds_prompt), + (gpointer)state); + + button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_container_add(GTK_CONTAINER(bbox), button); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(callback_do_close), + (gpointer)window); + + gtk_widget_show_all(window); + +} + +static void callback_do_about(GtkWidget *widget, + gpointer data) +{ + GdkPixbuf *logo; + GError *error = NULL; + + debug("callback_do_about called\n"); + + logo = gdk_pixbuf_new_from_file(SAMBA_IMAGE_PATH, + &error); + if (logo == NULL) { + g_print("failed to load logo from %s: %s\n", + SAMBA_IMAGE_PATH, error->message); + } + + gtk_show_about_dialog(data, + "name", "Samba", + "version", "3.2.0pre2-GIT-904a90-test", + "copyright", "Copyright Andrew Tridgell and the Samba Team 1992-2007", + "website", "http://www.samba.org", + "license", "GPLv3", + "logo", logo, + "comments", "Samba gtk domain join utility", + NULL); +} + +static int draw_main_window(struct join_state *state) +{ + GtkWidget *window; + GtkWidget *button; + GtkWidget *label; + GtkWidget *main_vbox; + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *bbox; + GtkWidget *image; + GtkWidget *table; + GtkWidget *entry; + GdkPixbuf *icon; + GError *error = NULL; + + icon = gdk_pixbuf_new_from_file(SAMBA_ICON_PATH, + &error); + if (icon == NULL) { + g_print("failed to load logo from %s : %s\n", + SAMBA_ICON_PATH, error->message); + } + +#if 1 + image = gtk_image_new_from_file(SAMBA_IMAGE_PATH); +#else + image = gtk_image_new_from_file("/usr/share/pixmaps/redhat-system_settings.png"); +#endif + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + state->window_main = window; + + gtk_window_set_title(GTK_WINDOW(window), "Samba - Join Domain dialogue"); + gtk_widget_set_size_request(GTK_WIDGET(window), 600, 600); /* breite * höhe */ + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); + + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(callback_delete_event), NULL); + + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + main_vbox = gtk_vbox_new(FALSE, 10); + gtk_container_add(GTK_CONTAINER(window), main_vbox); + +#if 0 + gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); + gtk_widget_show(image); +#endif + /* Hbox */ + hbox = gtk_hbox_new(FALSE, 10); + gtk_container_add(GTK_CONTAINER(main_vbox), hbox); + + { +/* gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); */ + gtk_misc_set_alignment(GTK_MISC(image), 0, 0); + gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 10); + gtk_widget_show(image); + + /* Label */ + label = gtk_label_new("Samba uses the following information to identify your computer on the network."); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_set_size_request(GTK_WIDGET(label), 500, 40); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + } + + gtk_widget_show(hbox); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + gtk_container_add(GTK_CONTAINER(main_vbox), vbox); + + /* Table */ + table = gtk_table_new(6, 3, TRUE); + gtk_table_set_row_spacings(GTK_TABLE(table), 5); + gtk_table_set_col_spacings(GTK_TABLE(table), 5); + gtk_container_add(GTK_CONTAINER(vbox), table); + + { + /* Label */ + label = gtk_label_new("Computer description:"); +/* gtk_misc_set_alignment(GTK_MISC(label), 0, 0); */ + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); + gtk_widget_show(label); + + state->button_apply = gtk_button_new_from_stock(GTK_STOCK_APPLY); + + /* Entry */ + entry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(entry), 256); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(callback_enter_computer_description_and_unlock), + state); + g_signal_connect(G_OBJECT(entry), "activate", + G_CALLBACK(callback_apply_continue), + (gpointer)state); + + gtk_entry_set_text(GTK_ENTRY(entry), (char *)state->comment); + gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ + gtk_table_attach_defaults(GTK_TABLE(table), entry, 1, 3, 0, 1); + gtk_widget_show(entry); + } + + /* Label */ + label = gtk_label_new("For example: \"Samba \%v\"."); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 1, 2); + gtk_widget_show(label); + + /* Label */ + label = gtk_label_new("Full computer name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); + gtk_widget_show(label); + + { + /* Label */ + char *str = NULL; + if (state->name_type_initial == NetSetupDomainName) { + asprintf(&str, "%s.%s", state->my_hostname, + state->my_dnsdomain); + } else { + asprintf(&str, "%s.", state->my_hostname); + } + + label = gtk_label_new(str); + SAFE_FREE(str); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 2, 3); + gtk_widget_show(label); + } + + /* Label */ + if (state->name_type_initial == NetSetupDomainName) { + label = gtk_label_new("Domain:"); + } else { + label = gtk_label_new("Workgroup:"); + } + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); + gtk_widget_show(label); + state->label_current_name_type = label; + + /* Label */ + label = gtk_label_new(state->name_buffer_initial); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 3, 4); + gtk_widget_show(label); + state->label_current_name_buffer = label; + + { + hbox = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + label = gtk_label_new("To rename this computer or join a domain, click Change."); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + + } + + /* bbox */ + bbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); + gtk_container_add(GTK_CONTAINER(hbox), bbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox), 10); + + button = gtk_button_new_with_mnemonic("Ch_ange"); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(callback_do_change), + (gpointer)state); + gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + /* Label (hidden) */ + state->label_reboot = gtk_label_new(NULL); + gtk_label_set_line_wrap(GTK_LABEL(state->label_reboot), TRUE); + gtk_misc_set_alignment(GTK_MISC(state->label_reboot), 0, 0); + gtk_box_pack_start(GTK_BOX(vbox), state->label_reboot, TRUE, TRUE, 0); + gtk_widget_show(state->label_reboot); + +#if 0 + gtk_box_pack_start(GTK_BOX(vbox), + create_bbox(window, TRUE, NULL, 10, 85, 20, GTK_BUTTONBOX_END), + TRUE, TRUE, 5); +#endif + { + + GtkWidget *frame; + GtkWidget *bbox2; + GtkWidget *button2; + + frame = gtk_frame_new(NULL); + bbox2 = gtk_hbutton_box_new(); + + gtk_container_set_border_width(GTK_CONTAINER(bbox2), 5); + gtk_container_add(GTK_CONTAINER(frame), bbox2); + + /* Set the appearance of the Button Box */ + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox2), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox2), 10); + /*gtk_button_box_set_child_size(GTK_BUTTON_BOX(bbox2), child_w, child_h);*/ + + button2 = gtk_button_new_from_stock(GTK_STOCK_OK); + gtk_container_add(GTK_CONTAINER(bbox2), button2); + g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(callback_do_exit), state); + + button2 = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_container_add(GTK_CONTAINER(bbox2), button2); + g_signal_connect(G_OBJECT(button2), "clicked", + G_CALLBACK(callback_delete_event), + window); + + gtk_container_add(GTK_CONTAINER(bbox2), state->button_apply); + g_signal_connect(G_OBJECT(state->button_apply), "clicked", + G_CALLBACK(callback_apply_description_change), + state); + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); + + button2 = gtk_button_new_from_stock(GTK_STOCK_ABOUT); + gtk_container_add(GTK_CONTAINER(bbox2), button2); + g_signal_connect(G_OBJECT(button2), "clicked", + G_CALLBACK(callback_do_about), + window); + + gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); + } + + gtk_widget_show_all(window); + + return 0; +} + +static int init_join_state(struct join_state **state) +{ + struct join_state *s; + + s = malloc(sizeof(struct join_state)); + if (!s) { + return -1; + } + + memset(s, '\0', sizeof(struct join_state)); + + *state = s; + + return 0; +} + +static int initialize_join_state(struct join_state *state, + const char *debug_level) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status = 0; + + status = libnetapi_init(&ctx); + if (status) { + return status; + } + + if (debug_level) { + libnetapi_set_debuglevel(ctx, debug_level); + } + + { + char my_hostname[HOST_NAME_MAX]; + const char *p = NULL; + if (gethostname(my_hostname, sizeof(my_hostname)) == -1) { + return -1; + } + + state->my_fqdn = strdup(my_hostname); + if (!state->my_fqdn) { + return -1; + } + + p = strchr(my_hostname, '.'); + if (p) { + my_hostname[strlen(my_hostname) - strlen(p)] = '\0'; + state->my_hostname = strdup(my_hostname); + if (!state->my_hostname) { + return -1; + } + p++; + state->my_dnsdomain = strdup(p); + if (!state->my_dnsdomain) { + return -1; + } + } + } + + { + const char *buffer = NULL; + uint16_t type = 0; + status = NetGetJoinInformation(NULL, &buffer, &type); + if (status) { + return status; + } + state->name_buffer_initial = (char *)buffer; + state->name_type_initial = type; + } + + { + struct srvsvc_NetSrvInfo1005 *info1005 = NULL; + uint8_t *buffer = NULL; + + status = NetServerGetInfo(NULL, 1005, &buffer); + if (status) { + return status; + } + + info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer; + + state->comment = strdup(info1005->comment); + if (!state->comment) { + return -1; + } + } +#if 0 + { + struct srvsvc_NetSrvInfo100 *info100 = NULL; + uint8_t *buffer = NULL; + + status = NetServerGetInfo(NULL, 100, &buffer); + if (status) { + return status; + } + + info100 = (struct srvsvc_NetSrvInfo100 *)buffer; + + state->comment = strdup(info100->comment); + if (!state->comment) { + return -1; + } + } +#endif + + state->ctx = ctx; + + return 0; +} + +int main(int argc, char **argv) +{ + GOptionContext *context = NULL; + static const char *debug_level = NULL; + struct join_state *state = NULL; + GError *error = NULL; + int ret = 0; + + static GOptionEntry entries[] = { + { "debug", 'd', 0, G_OPTION_ARG_STRING, &debug_level, "Debug level (for samba)", "N" }, + { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Verbose output", 0 }, + { NULL } + }; + + context = g_option_context_new("- Samba domain join utility"); + g_option_context_add_main_entries(context, entries, NULL); +/* g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); */ + g_option_context_add_group(context, gtk_get_option_group(TRUE)); + g_option_context_parse(context, &argc, &argv, &error); + + gtk_init(&argc, &argv); + g_set_application_name("Samba"); + + ret = init_join_state(&state); + if (ret) { + return ret; + } + + ret = initialize_join_state(state, debug_level); + if (ret) { + return ret; + } + + draw_main_window(state); + + gtk_main(); + + do_cleanup(state); + + return 0; +} diff --git a/source3/lib/netapi/examples/netdomjoin/netdomjoin.c b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c new file mode 100644 index 0000000000..a2bb700250 --- /dev/null +++ b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c @@ -0,0 +1,107 @@ +/* + * Unix SMB/CIFS implementation. + * Join Support (cmdline + netapi) + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include +#include +#include +#include +#include + +#include + +char *get_string_param(const char *param) +{ + char *p; + + p = strchr(param, '='); + if (!p) { + return NULL; + } + + return (p+1); +} + +int main(int argc, char **argv) +{ + NET_API_STATUS status; + const char *server_name = NULL; + const char *domain_name = NULL; + const char *account_ou = NULL; + const char *Account = NULL; + const char *password = NULL; + uint32_t join_flags = 3; + struct libnetapi_ctx *ctx = NULL; + int i; + + status = libnetapi_init(&ctx); + if (status != 0) { + return status; + } + + if (argc < 2) { + printf("usage: netdomjoin\n"); + printf("\t[hostname=HOSTNAME] [domain=DOMAIN] \n"); + return 0; + } + + if (argc > 2) { + server_name = argv[1]; + } + + for (i=0; i Date: Fri, 21 Dec 2007 17:29:15 +0100 Subject: Move gtk app to the correct location. Thanks obnox! Guenther (This used to be commit 740a2b080db56d504c4edd58bf41d72edb3d32ee) --- .../examples/netdomjoin-gui/netdomjoin-gui.c | 1347 ++++++++++++++++++++ .../netapi/examples/netdomjoin/netdomjoin-gui.c | 1347 -------------------- 2 files changed, 1347 insertions(+), 1347 deletions(-) create mode 100644 source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c delete mode 100644 source3/lib/netapi/examples/netdomjoin/netdomjoin-gui.c diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c new file mode 100644 index 0000000000..8ca6897cab --- /dev/null +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -0,0 +1,1347 @@ +/* + * Unix SMB/CIFS implementation. + * Join Support (gtk + netapi) + * Copyright (C) Guenther Deschner 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define MAX_CRED_LEN 256 +#define MAX_NETBIOS_NAME_LEN 15 + +#define SAMBA_ICON_PATH "/usr/share/pixmaps/samba/samba.ico" +#define SAMBA_IMAGE_PATH "/usr/share/pixmaps/samba/logo.png" + +#define WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED ( 0x00000020 ) +#define WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE ( 0x00000004 ) +#define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 ) +#define WKSSVC_JOIN_FLAGS_JOIN_TYPE ( 0x00000001 ) + +#define NetSetupWorkgroupName ( 2 ) +#define NetSetupDomainName ( 3 ) + +#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) + +struct srvsvc_NetSrvInfo1005 { + const char *comment;/* [unique,charset(UTF16)] */ +}; + +static gboolean verbose = FALSE; + +typedef struct join_state { + struct libnetapi_ctx *ctx; + GtkWidget *window_main; + GtkWidget *window_parent; + GtkWidget *window_do_change; + GtkWidget *window_creds_prompt; + GtkWidget *entry_account; + GtkWidget *entry_password; + GtkWidget *entry_domain; + GtkWidget *entry_workgroup; + GtkWidget *button_ok; + GtkWidget *button_apply; + GtkWidget *button_ok_creds; + GtkWidget *label_reboot; + GtkWidget *label_current_name_buffer; + GtkWidget *label_current_name_type; + GtkWidget *label_full_computer_name; + uint16_t name_type_initial; + uint16_t name_type_new; + char *name_buffer_initial; + char *name_buffer_new; + char *password; + char *account; + char *comment; + char *comment_new; + char *my_fqdn; + char *my_dnsdomain; + char *my_hostname; + uint16_t server_role; + gboolean settings_changed; + gboolean hostname_changed; +} join_state; + +static void debug(const char *format, ...) +{ + va_list args; + + if (!verbose) { + return; + } + + va_start(args, format); + g_vprintf(format, args); + va_end(args); +} + +static gboolean callback_delete_event(GtkWidget *widget, + GdkEvent *event, + gpointer data) +{ + gtk_main_quit(); + return FALSE; +} + +static void callback_do_close(GtkWidget *widget, + gpointer data) +{ + debug("Closing now...\n"); + gtk_widget_destroy(data); +} + +static void free_join_state(struct join_state *s) +{ + SAFE_FREE(s->name_buffer_initial); + SAFE_FREE(s->name_buffer_new); + SAFE_FREE(s->password); + SAFE_FREE(s->account); + SAFE_FREE(s->comment); + SAFE_FREE(s->comment_new); + SAFE_FREE(s->my_fqdn); + SAFE_FREE(s->my_dnsdomain); + SAFE_FREE(s->my_hostname); + +} + +static void do_cleanup(struct join_state *state) +{ + libnetapi_free(state->ctx); + free_join_state(state); +} + +static void callback_apply_description_change(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + NET_API_STATUS status = 0; + uint32_t parm_err = 0; + struct srvsvc_NetSrvInfo1005 info1005; + GtkWidget *dialog; + + info1005.comment = state->comment_new; + + status = NetServerSetInfo(NULL, 1005, (uint8_t *)&info1005, &parm_err); + if (status) { + debug("NetServerSetInfo failed with: %s\n", + libnetapi_errstr(state->ctx, status)); + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "Failed to change computer description: %s.", + libnetapi_errstr(state->ctx, status)); + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + return; + } + + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); +} + +static void callback_do_exit(GtkWidget *widget, + gpointer data) +{ + GtkWidget *dialog; + gint result; + struct join_state *state = (struct join_state *)data; + + if (!state->settings_changed) { + callback_delete_event(NULL, NULL, NULL); + return; + } + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "You must restart your computer before the new settings will take effect."); + result = gtk_dialog_run(GTK_DIALOG(dialog)); + switch (result) { + case GTK_RESPONSE_YES: + g_print("would reboot here\n"); + break; + case GTK_RESPONSE_NO: + default: + break; + } + gtk_widget_destroy(dialog); + gtk_widget_destroy(state->window_main); + do_cleanup(state); + exit(0); +} + + +static void callback_do_reboot(GtkWidget *widget, + gpointer data, + gpointer data2) +{ + GtkWidget *dialog; + struct join_state *state = (struct join_state *)data2; + + debug("callback_do_reboot\n"); + + state->settings_changed = TRUE; + dialog = gtk_message_dialog_new(GTK_WINDOW(data), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "You must restart this computer for the changes to take effect."); +#if 0 + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + debug("showing dialog\n"); + gtk_widget_show(dialog); +#else + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +#endif + + gtk_label_set_text(GTK_LABEL(state->label_reboot), "Changes will take effect after you restart this computer"); + + debug("destroying do_change window\n"); + gtk_widget_destroy(GTK_WIDGET(state->window_do_change)); + + { + uint32_t status; + const char *buffer; + uint16_t type; + + status = NetGetJoinInformation(NULL, &buffer, &type); + if (status != 0) { + g_print("failed to query status\n"); + return; + } + + debug("got new status: %s\n", buffer); +#if 0 + SAFE_FREE(state->name_buffer_new); + state->name_buffer_new = strdup(buffer); + SAFE_FREE(buffer); + state->name_type_new = type; +#endif + gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer), state->name_buffer_new); + if (state->name_type_new == 3) { + gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Domain:"); + } else { + gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Workgroup:"); + } + } +} + +static void callback_return_username(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_return_username: %s\n", entry_text); + SAFE_FREE(state->account); + state->account = strdup(entry_text); +} + +static void callback_return_username_and_enter(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_return_username: %s\n", entry_text); + SAFE_FREE(state->account); + state->account = strdup(entry_text); + g_signal_emit_by_name(state->button_ok_creds, "clicked"); +} + +static void callback_return_password(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); +#ifdef DEBUG_PASSWORD + debug("callback_return_password: %s\n", entry_text); +#else + debug("callback_return_password: (not printed)\n"); +#endif + SAFE_FREE(state->password); + state->password = strdup(entry_text); +} + +static void callback_return_password_and_enter(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text; + struct join_state *state = (struct join_state *)data; + if (!widget) { + return; + } + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); +#ifdef DEBUG_PASSWORD + debug("callback_return_password: %s\n", entry_text); +#else + debug("callback_return_password: (not printed)\n"); +#endif + SAFE_FREE(state->password); + state->password = strdup(entry_text); + g_signal_emit_by_name(state->button_ok_creds, "clicked"); +} + +static void callback_do_hostname_change(GtkWidget *widget, + gpointer data) +{ + GtkWidget *dialog; + const char *str = NULL; + + struct join_state *state = (struct join_state *)data; + + switch (state->name_type_initial) { + case NetSetupDomainName: + str = "To be implemented: call NetRenameMachineInDomain\n"; + break; + case NetSetupWorkgroupName: + str = "To be implemented: call SetComputerNameEx\n"; + break; + default: + break; + } + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + str); + + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + gtk_widget_show(dialog); +} + +static void callback_do_join(GtkWidget *widget, + gpointer data) +{ + GtkWidget *dialog; + + NET_API_STATUS status; + const char *err_str = NULL; + uint32_t join_flags = 0; + uint32_t unjoin_flags = 0; + gboolean domain_join = FALSE; + gboolean try_unjoin = FALSE; + const char *domain_or_workgroup = NULL; + + struct join_state *state = (struct join_state *)data; + + callback_return_username(state->entry_account, state); + callback_return_password(state->entry_password, state); + + if (state->window_creds_prompt) { + gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt)); + } + + if (state->name_type_new == NetSetupDomainName) { + domain_join = TRUE; + join_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | + WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE | + WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED; /* for testing */ + domain_or_workgroup = "domain"; + } else { + domain_or_workgroup = "workgroup"; + } + + if ((state->name_type_initial == NetSetupDomainName) && + (state->name_type_new == NetSetupWorkgroupName)) { + try_unjoin = TRUE; + unjoin_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | + WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE; + } + + debug("callback_do_join: Joining a %s named %s using join_flags 0x%08x ", + domain_or_workgroup, + state->name_buffer_new, + join_flags); + if (domain_join) { + debug("as %s ", state->account); +#ifdef DEBUG_PASSWORD + debug("with %s ", state->password); +#endif + } + debug("\n"); + if (try_unjoin) { + + debug("callback_do_join: Unjoining\n"); + + status = NetUnjoinDomain(NULL, + state->account, + state->password, + unjoin_flags); + if (status != 0) { + err_str = libnetapi_errstr(state->ctx, status); + g_print("callback_do_join: failed to unjoin (%s)\n", + err_str); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "The following error occured attempting to unjoin the %s: \"%s\": %s", + domain_or_workgroup, + state->name_buffer_new, + err_str); + + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + + return; + } + + } + status = NetJoinDomain(NULL, + state->name_buffer_new, + NULL, + state->account, + state->password, + join_flags); + if (status != 0) { + err_str = libnetapi_errstr(state->ctx, status); + g_print("callback_do_join: failed to join (%s)\n", err_str); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "The following error occured attempting to join the %s: \"%s\": %s", + domain_or_workgroup, + state->name_buffer_new, + err_str); + + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + + return; + } + + debug("callback_do_join: Successfully joined %s\n", + domain_or_workgroup); + + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Welcome to the %s %s.", + state->name_buffer_new, + domain_or_workgroup); + + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + callback_do_reboot(NULL, state->window_parent, state); +} + +static void callback_creds_prompt(GtkWidget *widget, + gpointer data) +{ + GtkWidget *window; + GtkWidget *box1; + GtkWidget *bbox; + GtkWidget *button; + GtkWidget *label; + + struct join_state *state = (struct join_state *)data; + + debug("callback_creds_prompt:\n"); + + state->window_parent = state->window_do_change; + + if (state->hostname_changed) { + return callback_do_hostname_change(NULL, state); + } + + if ((state->name_type_initial != NetSetupDomainName) && + (state->name_type_new != NetSetupDomainName)) { + return callback_do_join(NULL, state); + } + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); + gtk_widget_set_size_request(GTK_WIDGET(window), 380, 280); + gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); +/* gtk_window_set_icon_name(GTK_WIDGET(window), GTK_STOCK_DIALOG_AUTHENTICATION); */ + state->window_creds_prompt = window; + + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(callback_do_close), window); + + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + box1 = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(window), box1); + + if ((state->name_type_initial == NetSetupDomainName) && + (state->name_type_new == NetSetupWorkgroupName)) { + label = gtk_label_new("Enter the name and password of an account with permission to leave the domain.\n"); + } else { + label = gtk_label_new("Enter the name and password of an account with permission to join the domain.\n"); + } + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + + gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); + + gtk_widget_show(label); + + /* USER NAME */ + label = gtk_label_new("User name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + state->entry_account = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(state->entry_account), MAX_CRED_LEN); + g_signal_connect(G_OBJECT(state->entry_account), "activate", + G_CALLBACK(callback_return_username_and_enter), + (gpointer)state); + gtk_editable_select_region(GTK_EDITABLE(state->entry_account), + 0, GTK_ENTRY(state->entry_account)->text_length); + gtk_box_pack_start(GTK_BOX(box1), state->entry_account, TRUE, TRUE, 0); + gtk_widget_show(state->entry_account); + + /* PASSWORD */ + label = gtk_label_new("Password:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + state->entry_password = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(state->entry_password), MAX_CRED_LEN); + gtk_entry_set_visibility(GTK_ENTRY(state->entry_password), FALSE); + g_signal_connect(G_OBJECT(state->entry_password), "activate", + G_CALLBACK(callback_return_password_and_enter), + (gpointer)state); + gtk_editable_set_editable(GTK_EDITABLE(state->entry_password), TRUE); + gtk_editable_select_region(GTK_EDITABLE(state->entry_password), + 0, GTK_ENTRY(state->entry_password)->text_length); + gtk_box_pack_start(GTK_BOX(box1), state->entry_password, TRUE, TRUE, 0); + gtk_widget_show(state->entry_password); + + bbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); + gtk_container_add(GTK_CONTAINER(box1), bbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox), 10); + + state->button_ok_creds = gtk_button_new_from_stock(GTK_STOCK_OK); + gtk_widget_grab_focus(GTK_WIDGET(state->button_ok_creds)); + gtk_container_add(GTK_CONTAINER(bbox), state->button_ok_creds); + g_signal_connect(G_OBJECT(state->button_ok_creds), "clicked", + G_CALLBACK(callback_do_join), + (gpointer)state); + gtk_widget_show(state->button_ok_creds); + + button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_container_add(GTK_CONTAINER(bbox), button); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(callback_do_close), (gpointer) window); + gtk_widget_show_all(window); +} + +static void callback_enter_hostname_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + char *str = NULL; + struct join_state *state = (struct join_state *)data; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_hostname_and_unlock: %s\n", entry_text); + if (!entry_text || entry_text[0] == 0) { + state->hostname_changed = FALSE; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + if (strcasecmp(state->my_hostname, entry_text) == 0) { + state->hostname_changed = FALSE; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + state->hostname_changed = TRUE; + if (state->name_type_initial == NetSetupDomainName) { + asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); + } else { + asprintf(&str, "%s.", entry_text); + } + gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); + free(str); + + if (state->hostname_changed && str && str[0] != 0 && str[0] != '.') { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); + } +} + +static void callback_enter_computer_description_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + struct join_state *state = (struct join_state *)data; + int string_unchanged = 0; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_computer_description_and_unlock: %s\n", + entry_text); +#if 0 + if (!entry_text || entry_text[0] == 0) { + string_unchanged = 1; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), + FALSE); + return; + } +#endif + if (entry_text && strcasecmp(state->comment, entry_text) == 0) { + string_unchanged = 1; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), + FALSE); + return; + } + + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), TRUE); + SAFE_FREE(state->comment_new); + state->comment_new = strdup(entry_text); + +} + + +static void callback_enter_workgroup_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + struct join_state *state = (struct join_state *)data; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_workgroup_and_unlock: %s\n", entry_text); + if (!entry_text || entry_text[0] == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); + SAFE_FREE(state->name_buffer_new); + state->name_buffer_new = strdup(entry_text); + state->name_type_new = NetSetupWorkgroupName; +} + +static void callback_enter_domain_and_unlock(GtkWidget *widget, + gpointer data) +{ + const gchar *entry_text = NULL; + struct join_state *state = (struct join_state *)data; + + entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); + debug("callback_enter_domain_and_unlock: %s\n", entry_text); + if (!entry_text || entry_text[0] == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); + return; + } + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); + SAFE_FREE(state->name_buffer_new); + state->name_buffer_new = strdup(entry_text); + state->name_type_new = NetSetupDomainName; +} + +static void callback_continue(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + + gtk_widget_grab_focus(GTK_WIDGET(state->button_ok)); + g_signal_emit_by_name(state->button_ok, "clicked"); +} + +static void callback_apply_continue(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + + gtk_widget_grab_focus(GTK_WIDGET(state->button_apply)); + g_signal_emit_by_name(state->button_apply, "clicked"); +} + +static void callback_do_join_workgroup(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + debug("callback_do_join_workgroup choosen\n"); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); + gtk_widget_grab_focus(GTK_WIDGET(state->entry_workgroup)); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); + callback_enter_workgroup_and_unlock(state->entry_workgroup, state); /* TEST */ +} + +static void callback_do_join_domain(GtkWidget *widget, + gpointer data) +{ + struct join_state *state = (struct join_state *)data; + debug("callback_do_join_domain choosen\n"); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), TRUE); + gtk_widget_grab_focus(GTK_WIDGET(state->entry_domain)); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), FALSE); + callback_enter_domain_and_unlock(state->entry_domain, state); /* TEST */ +} + +static void callback_do_change(GtkWidget *widget, + gpointer data) +{ + GtkWidget *window; + GtkWidget *box1; + GtkWidget *bbox; + GtkWidget *button_workgroup; + GtkWidget *button_domain; + GtkWidget *button; + GtkWidget *label; + GtkWidget *frame_horz; + GtkWidget *vbox; + GtkWidget *entry; + GSList *group; + + struct join_state *state = (struct join_state *)data; + + debug("callback_do_change called\n"); + + if (state->server_role == 3) { + GtkWidget *dialog; + dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "Domain controller cannot be moved from one domain to another, they must first be demoted. Renaming this domain controller may cause it to become temporarily unavailable to users and computers. For information on renaming domain controllers, including alternate renaming methods, see Help and Support. To continue renaming this domain controller, click OK."); + g_signal_connect_swapped(dialog, "response", + G_CALLBACK(gtk_widget_destroy), + dialog); + + gtk_widget_show(dialog); + return; + } + + state->button_ok = gtk_button_new_from_stock(GTK_STOCK_OK); + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + gtk_widget_set_size_request(GTK_WIDGET(window), 480, 500); /* breite * höhe */ + gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); + + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(callback_do_close), window); + + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + box1 = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), box1); + + label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network ressources."); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + /* COMPUTER NAME */ + label = gtk_label_new("Computer name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + state->label_full_computer_name = gtk_label_new(NULL); + { + entry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(entry), MAX_NETBIOS_NAME_LEN); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(callback_enter_hostname_and_unlock), + (gpointer)state); + gtk_entry_set_text(GTK_ENTRY(entry), state->my_hostname); + gtk_editable_select_region(GTK_EDITABLE(entry), + 0, GTK_ENTRY(entry)->text_length); + + gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ + gtk_box_pack_start(GTK_BOX(box1), entry, TRUE, TRUE, 0); + gtk_widget_show(entry); + } + + /* FULL COMPUTER NAME */ + label = gtk_label_new("Full computer name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + { + const gchar *entry_text; + char *str = NULL; + entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); + if (state->name_type_initial == NetSetupDomainName) { + asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); + } else { + asprintf(&str, "%s.", entry_text); + } + gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); + free(str); + gtk_misc_set_alignment(GTK_MISC(state->label_full_computer_name), 0, 0); + gtk_box_pack_start(GTK_BOX(box1), state->label_full_computer_name, TRUE, TRUE, 0); + gtk_widget_show(state->label_full_computer_name); + } + + /* BOX */ + frame_horz = gtk_frame_new ("Member Of"); + gtk_box_pack_start(GTK_BOX(box1), frame_horz, TRUE, TRUE, 10); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + gtk_container_add(GTK_CONTAINER(frame_horz), vbox); + + /* TWO ENTRIES */ + state->entry_workgroup = gtk_entry_new(); + state->entry_domain = gtk_entry_new(); + + /* DOMAIN */ + button_domain = gtk_radio_button_new_with_label(NULL, "Domain"); + if (state->name_type_initial == NetSetupDomainName) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_domain), TRUE); + } + gtk_box_pack_start(GTK_BOX(vbox), button_domain, TRUE, TRUE, 0); + g_signal_connect(G_OBJECT(button_domain), "clicked", + G_CALLBACK(callback_do_join_domain), + (gpointer)state); + + { + gtk_entry_set_max_length(GTK_ENTRY(state->entry_domain), 50); + g_signal_connect(G_OBJECT(state->entry_domain), "changed", + G_CALLBACK(callback_enter_domain_and_unlock), + (gpointer)state); + g_signal_connect(G_OBJECT(state->entry_domain), "activate", + G_CALLBACK(callback_continue), + (gpointer)state); + if (state->name_type_initial == NetSetupDomainName) { + gtk_entry_set_text(GTK_ENTRY(state->entry_domain), state->name_buffer_initial); + gtk_widget_set_sensitive(state->entry_workgroup, FALSE); + gtk_widget_set_sensitive(state->entry_domain, TRUE); + } + gtk_editable_set_editable(GTK_EDITABLE(state->entry_domain), TRUE); + gtk_box_pack_start(GTK_BOX(vbox), state->entry_domain, TRUE, TRUE, 0); + gtk_widget_show(state->entry_domain); + } + gtk_widget_show(button_domain); + + /* WORKGROUP */ + group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button_domain)); + button_workgroup = gtk_radio_button_new_with_label(group, "Workgroup"); + if (state->name_type_initial == NetSetupWorkgroupName) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_workgroup), TRUE); + } + gtk_box_pack_start(GTK_BOX(vbox), button_workgroup, TRUE, TRUE, 0); + g_signal_connect(G_OBJECT(button_workgroup), "clicked", + G_CALLBACK(callback_do_join_workgroup), + (gpointer)state); + { + gtk_entry_set_max_length(GTK_ENTRY(state->entry_workgroup), MAX_NETBIOS_NAME_LEN); + g_signal_connect(G_OBJECT(state->entry_workgroup), "changed", + G_CALLBACK(callback_enter_workgroup_and_unlock), + (gpointer)state); + g_signal_connect(G_OBJECT(state->entry_workgroup), "activate", + G_CALLBACK(callback_continue), + (gpointer)state); + + if (state->name_type_initial == NetSetupWorkgroupName) { + gtk_entry_set_text(GTK_ENTRY(state->entry_workgroup), state->name_buffer_initial); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); + } + gtk_box_pack_start(GTK_BOX(vbox), state->entry_workgroup, TRUE, TRUE, 0); + gtk_widget_show(state->entry_workgroup); + } + gtk_widget_show(button_workgroup); + + /* BUTTONS */ + bbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); + gtk_container_add(GTK_CONTAINER(box1), bbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox), 10); + + state->window_do_change = window; + gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); /* !!! */ + gtk_container_add(GTK_CONTAINER(bbox), state->button_ok); + g_signal_connect(G_OBJECT(state->button_ok), "clicked", + G_CALLBACK(callback_creds_prompt), + (gpointer)state); + + button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_container_add(GTK_CONTAINER(bbox), button); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(callback_do_close), + (gpointer)window); + + gtk_widget_show_all(window); + +} + +static void callback_do_about(GtkWidget *widget, + gpointer data) +{ + GdkPixbuf *logo; + GError *error = NULL; + + debug("callback_do_about called\n"); + + logo = gdk_pixbuf_new_from_file(SAMBA_IMAGE_PATH, + &error); + if (logo == NULL) { + g_print("failed to load logo from %s: %s\n", + SAMBA_IMAGE_PATH, error->message); + } + + gtk_show_about_dialog(data, + "name", "Samba", + "version", "3.2.0pre2-GIT-904a90-test", + "copyright", "Copyright Andrew Tridgell and the Samba Team 1992-2007", + "website", "http://www.samba.org", + "license", "GPLv3", + "logo", logo, + "comments", "Samba gtk domain join utility", + NULL); +} + +static int draw_main_window(struct join_state *state) +{ + GtkWidget *window; + GtkWidget *button; + GtkWidget *label; + GtkWidget *main_vbox; + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *bbox; + GtkWidget *image; + GtkWidget *table; + GtkWidget *entry; + GdkPixbuf *icon; + GError *error = NULL; + + icon = gdk_pixbuf_new_from_file(SAMBA_ICON_PATH, + &error); + if (icon == NULL) { + g_print("failed to load logo from %s : %s\n", + SAMBA_ICON_PATH, error->message); + } + +#if 1 + image = gtk_image_new_from_file(SAMBA_IMAGE_PATH); +#else + image = gtk_image_new_from_file("/usr/share/pixmaps/redhat-system_settings.png"); +#endif + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + state->window_main = window; + + gtk_window_set_title(GTK_WINDOW(window), "Samba - Join Domain dialogue"); + gtk_widget_set_size_request(GTK_WIDGET(window), 600, 600); /* breite * höhe */ + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); + gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); + + g_signal_connect(G_OBJECT(window), "delete_event", + G_CALLBACK(callback_delete_event), NULL); + + gtk_container_set_border_width(GTK_CONTAINER(window), 10); + + main_vbox = gtk_vbox_new(FALSE, 10); + gtk_container_add(GTK_CONTAINER(window), main_vbox); + +#if 0 + gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); + gtk_widget_show(image); +#endif + /* Hbox */ + hbox = gtk_hbox_new(FALSE, 10); + gtk_container_add(GTK_CONTAINER(main_vbox), hbox); + + { +/* gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); */ + gtk_misc_set_alignment(GTK_MISC(image), 0, 0); + gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 10); + gtk_widget_show(image); + + /* Label */ + label = gtk_label_new("Samba uses the following information to identify your computer on the network."); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_set_size_request(GTK_WIDGET(label), 500, 40); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + } + + gtk_widget_show(hbox); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + gtk_container_add(GTK_CONTAINER(main_vbox), vbox); + + /* Table */ + table = gtk_table_new(6, 3, TRUE); + gtk_table_set_row_spacings(GTK_TABLE(table), 5); + gtk_table_set_col_spacings(GTK_TABLE(table), 5); + gtk_container_add(GTK_CONTAINER(vbox), table); + + { + /* Label */ + label = gtk_label_new("Computer description:"); +/* gtk_misc_set_alignment(GTK_MISC(label), 0, 0); */ + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); + gtk_widget_show(label); + + state->button_apply = gtk_button_new_from_stock(GTK_STOCK_APPLY); + + /* Entry */ + entry = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(entry), 256); + g_signal_connect(G_OBJECT(entry), "changed", + G_CALLBACK(callback_enter_computer_description_and_unlock), + state); + g_signal_connect(G_OBJECT(entry), "activate", + G_CALLBACK(callback_apply_continue), + (gpointer)state); + + gtk_entry_set_text(GTK_ENTRY(entry), (char *)state->comment); + gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ + gtk_table_attach_defaults(GTK_TABLE(table), entry, 1, 3, 0, 1); + gtk_widget_show(entry); + } + + /* Label */ + label = gtk_label_new("For example: \"Samba \%v\"."); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 1, 2); + gtk_widget_show(label); + + /* Label */ + label = gtk_label_new("Full computer name:"); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); + gtk_widget_show(label); + + { + /* Label */ + char *str = NULL; + if (state->name_type_initial == NetSetupDomainName) { + asprintf(&str, "%s.%s", state->my_hostname, + state->my_dnsdomain); + } else { + asprintf(&str, "%s.", state->my_hostname); + } + + label = gtk_label_new(str); + SAFE_FREE(str); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 2, 3); + gtk_widget_show(label); + } + + /* Label */ + if (state->name_type_initial == NetSetupDomainName) { + label = gtk_label_new("Domain:"); + } else { + label = gtk_label_new("Workgroup:"); + } + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); + gtk_widget_show(label); + state->label_current_name_type = label; + + /* Label */ + label = gtk_label_new(state->name_buffer_initial); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 3, 4); + gtk_widget_show(label); + state->label_current_name_buffer = label; + + { + hbox = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + label = gtk_label_new("To rename this computer or join a domain, click Change."); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + + } + + /* bbox */ + bbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); + gtk_container_add(GTK_CONTAINER(hbox), bbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox), 10); + + button = gtk_button_new_with_mnemonic("Ch_ange"); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(callback_do_change), + (gpointer)state); + gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + /* Label (hidden) */ + state->label_reboot = gtk_label_new(NULL); + gtk_label_set_line_wrap(GTK_LABEL(state->label_reboot), TRUE); + gtk_misc_set_alignment(GTK_MISC(state->label_reboot), 0, 0); + gtk_box_pack_start(GTK_BOX(vbox), state->label_reboot, TRUE, TRUE, 0); + gtk_widget_show(state->label_reboot); + +#if 0 + gtk_box_pack_start(GTK_BOX(vbox), + create_bbox(window, TRUE, NULL, 10, 85, 20, GTK_BUTTONBOX_END), + TRUE, TRUE, 5); +#endif + { + + GtkWidget *frame; + GtkWidget *bbox2; + GtkWidget *button2; + + frame = gtk_frame_new(NULL); + bbox2 = gtk_hbutton_box_new(); + + gtk_container_set_border_width(GTK_CONTAINER(bbox2), 5); + gtk_container_add(GTK_CONTAINER(frame), bbox2); + + /* Set the appearance of the Button Box */ + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox2), GTK_BUTTONBOX_END); + gtk_box_set_spacing(GTK_BOX(bbox2), 10); + /*gtk_button_box_set_child_size(GTK_BUTTON_BOX(bbox2), child_w, child_h);*/ + + button2 = gtk_button_new_from_stock(GTK_STOCK_OK); + gtk_container_add(GTK_CONTAINER(bbox2), button2); + g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(callback_do_exit), state); + + button2 = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_container_add(GTK_CONTAINER(bbox2), button2); + g_signal_connect(G_OBJECT(button2), "clicked", + G_CALLBACK(callback_delete_event), + window); + + gtk_container_add(GTK_CONTAINER(bbox2), state->button_apply); + g_signal_connect(G_OBJECT(state->button_apply), "clicked", + G_CALLBACK(callback_apply_description_change), + state); + gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); + + button2 = gtk_button_new_from_stock(GTK_STOCK_ABOUT); + gtk_container_add(GTK_CONTAINER(bbox2), button2); + g_signal_connect(G_OBJECT(button2), "clicked", + G_CALLBACK(callback_do_about), + window); + + gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); + } + + gtk_widget_show_all(window); + + return 0; +} + +static int init_join_state(struct join_state **state) +{ + struct join_state *s; + + s = malloc(sizeof(struct join_state)); + if (!s) { + return -1; + } + + memset(s, '\0', sizeof(struct join_state)); + + *state = s; + + return 0; +} + +static int initialize_join_state(struct join_state *state, + const char *debug_level) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status = 0; + + status = libnetapi_init(&ctx); + if (status) { + return status; + } + + if (debug_level) { + libnetapi_set_debuglevel(ctx, debug_level); + } + + { + char my_hostname[HOST_NAME_MAX]; + const char *p = NULL; + if (gethostname(my_hostname, sizeof(my_hostname)) == -1) { + return -1; + } + + state->my_fqdn = strdup(my_hostname); + if (!state->my_fqdn) { + return -1; + } + + p = strchr(my_hostname, '.'); + if (p) { + my_hostname[strlen(my_hostname) - strlen(p)] = '\0'; + state->my_hostname = strdup(my_hostname); + if (!state->my_hostname) { + return -1; + } + p++; + state->my_dnsdomain = strdup(p); + if (!state->my_dnsdomain) { + return -1; + } + } + } + + { + const char *buffer = NULL; + uint16_t type = 0; + status = NetGetJoinInformation(NULL, &buffer, &type); + if (status) { + return status; + } + state->name_buffer_initial = (char *)buffer; + state->name_type_initial = type; + } + + { + struct srvsvc_NetSrvInfo1005 *info1005 = NULL; + uint8_t *buffer = NULL; + + status = NetServerGetInfo(NULL, 1005, &buffer); + if (status) { + return status; + } + + info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer; + + state->comment = strdup(info1005->comment); + if (!state->comment) { + return -1; + } + } +#if 0 + { + struct srvsvc_NetSrvInfo100 *info100 = NULL; + uint8_t *buffer = NULL; + + status = NetServerGetInfo(NULL, 100, &buffer); + if (status) { + return status; + } + + info100 = (struct srvsvc_NetSrvInfo100 *)buffer; + + state->comment = strdup(info100->comment); + if (!state->comment) { + return -1; + } + } +#endif + + state->ctx = ctx; + + return 0; +} + +int main(int argc, char **argv) +{ + GOptionContext *context = NULL; + static const char *debug_level = NULL; + struct join_state *state = NULL; + GError *error = NULL; + int ret = 0; + + static GOptionEntry entries[] = { + { "debug", 'd', 0, G_OPTION_ARG_STRING, &debug_level, "Debug level (for samba)", "N" }, + { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Verbose output", 0 }, + { NULL } + }; + + context = g_option_context_new("- Samba domain join utility"); + g_option_context_add_main_entries(context, entries, NULL); +/* g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); */ + g_option_context_add_group(context, gtk_get_option_group(TRUE)); + g_option_context_parse(context, &argc, &argv, &error); + + gtk_init(&argc, &argv); + g_set_application_name("Samba"); + + ret = init_join_state(&state); + if (ret) { + return ret; + } + + ret = initialize_join_state(state, debug_level); + if (ret) { + return ret; + } + + draw_main_window(state); + + gtk_main(); + + do_cleanup(state); + + return 0; +} diff --git a/source3/lib/netapi/examples/netdomjoin/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin/netdomjoin-gui.c deleted file mode 100644 index 8ca6897cab..0000000000 --- a/source3/lib/netapi/examples/netdomjoin/netdomjoin-gui.c +++ /dev/null @@ -1,1347 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Join Support (gtk + netapi) - * Copyright (C) Guenther Deschner 2007 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#define MAX_CRED_LEN 256 -#define MAX_NETBIOS_NAME_LEN 15 - -#define SAMBA_ICON_PATH "/usr/share/pixmaps/samba/samba.ico" -#define SAMBA_IMAGE_PATH "/usr/share/pixmaps/samba/logo.png" - -#define WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED ( 0x00000020 ) -#define WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE ( 0x00000004 ) -#define WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE ( 0x00000002 ) -#define WKSSVC_JOIN_FLAGS_JOIN_TYPE ( 0x00000001 ) - -#define NetSetupWorkgroupName ( 2 ) -#define NetSetupDomainName ( 3 ) - -#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) - -struct srvsvc_NetSrvInfo1005 { - const char *comment;/* [unique,charset(UTF16)] */ -}; - -static gboolean verbose = FALSE; - -typedef struct join_state { - struct libnetapi_ctx *ctx; - GtkWidget *window_main; - GtkWidget *window_parent; - GtkWidget *window_do_change; - GtkWidget *window_creds_prompt; - GtkWidget *entry_account; - GtkWidget *entry_password; - GtkWidget *entry_domain; - GtkWidget *entry_workgroup; - GtkWidget *button_ok; - GtkWidget *button_apply; - GtkWidget *button_ok_creds; - GtkWidget *label_reboot; - GtkWidget *label_current_name_buffer; - GtkWidget *label_current_name_type; - GtkWidget *label_full_computer_name; - uint16_t name_type_initial; - uint16_t name_type_new; - char *name_buffer_initial; - char *name_buffer_new; - char *password; - char *account; - char *comment; - char *comment_new; - char *my_fqdn; - char *my_dnsdomain; - char *my_hostname; - uint16_t server_role; - gboolean settings_changed; - gboolean hostname_changed; -} join_state; - -static void debug(const char *format, ...) -{ - va_list args; - - if (!verbose) { - return; - } - - va_start(args, format); - g_vprintf(format, args); - va_end(args); -} - -static gboolean callback_delete_event(GtkWidget *widget, - GdkEvent *event, - gpointer data) -{ - gtk_main_quit(); - return FALSE; -} - -static void callback_do_close(GtkWidget *widget, - gpointer data) -{ - debug("Closing now...\n"); - gtk_widget_destroy(data); -} - -static void free_join_state(struct join_state *s) -{ - SAFE_FREE(s->name_buffer_initial); - SAFE_FREE(s->name_buffer_new); - SAFE_FREE(s->password); - SAFE_FREE(s->account); - SAFE_FREE(s->comment); - SAFE_FREE(s->comment_new); - SAFE_FREE(s->my_fqdn); - SAFE_FREE(s->my_dnsdomain); - SAFE_FREE(s->my_hostname); - -} - -static void do_cleanup(struct join_state *state) -{ - libnetapi_free(state->ctx); - free_join_state(state); -} - -static void callback_apply_description_change(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - NET_API_STATUS status = 0; - uint32_t parm_err = 0; - struct srvsvc_NetSrvInfo1005 info1005; - GtkWidget *dialog; - - info1005.comment = state->comment_new; - - status = NetServerSetInfo(NULL, 1005, (uint8_t *)&info1005, &parm_err); - if (status) { - debug("NetServerSetInfo failed with: %s\n", - libnetapi_errstr(state->ctx, status)); - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - "Failed to change computer description: %s.", - libnetapi_errstr(state->ctx, status)); - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - gtk_widget_show(dialog); - return; - } - - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); -} - -static void callback_do_exit(GtkWidget *widget, - gpointer data) -{ - GtkWidget *dialog; - gint result; - struct join_state *state = (struct join_state *)data; - - if (!state->settings_changed) { - callback_delete_event(NULL, NULL, NULL); - return; - } - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - "You must restart your computer before the new settings will take effect."); - result = gtk_dialog_run(GTK_DIALOG(dialog)); - switch (result) { - case GTK_RESPONSE_YES: - g_print("would reboot here\n"); - break; - case GTK_RESPONSE_NO: - default: - break; - } - gtk_widget_destroy(dialog); - gtk_widget_destroy(state->window_main); - do_cleanup(state); - exit(0); -} - - -static void callback_do_reboot(GtkWidget *widget, - gpointer data, - gpointer data2) -{ - GtkWidget *dialog; - struct join_state *state = (struct join_state *)data2; - - debug("callback_do_reboot\n"); - - state->settings_changed = TRUE; - dialog = gtk_message_dialog_new(GTK_WINDOW(data), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - "You must restart this computer for the changes to take effect."); -#if 0 - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - debug("showing dialog\n"); - gtk_widget_show(dialog); -#else - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); -#endif - - gtk_label_set_text(GTK_LABEL(state->label_reboot), "Changes will take effect after you restart this computer"); - - debug("destroying do_change window\n"); - gtk_widget_destroy(GTK_WIDGET(state->window_do_change)); - - { - uint32_t status; - const char *buffer; - uint16_t type; - - status = NetGetJoinInformation(NULL, &buffer, &type); - if (status != 0) { - g_print("failed to query status\n"); - return; - } - - debug("got new status: %s\n", buffer); -#if 0 - SAFE_FREE(state->name_buffer_new); - state->name_buffer_new = strdup(buffer); - SAFE_FREE(buffer); - state->name_type_new = type; -#endif - gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer), state->name_buffer_new); - if (state->name_type_new == 3) { - gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Domain:"); - } else { - gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Workgroup:"); - } - } -} - -static void callback_return_username(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text; - struct join_state *state = (struct join_state *)data; - if (!widget) { - return; - } - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_return_username: %s\n", entry_text); - SAFE_FREE(state->account); - state->account = strdup(entry_text); -} - -static void callback_return_username_and_enter(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text; - struct join_state *state = (struct join_state *)data; - if (!widget) { - return; - } - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_return_username: %s\n", entry_text); - SAFE_FREE(state->account); - state->account = strdup(entry_text); - g_signal_emit_by_name(state->button_ok_creds, "clicked"); -} - -static void callback_return_password(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text; - struct join_state *state = (struct join_state *)data; - if (!widget) { - return; - } - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); -#ifdef DEBUG_PASSWORD - debug("callback_return_password: %s\n", entry_text); -#else - debug("callback_return_password: (not printed)\n"); -#endif - SAFE_FREE(state->password); - state->password = strdup(entry_text); -} - -static void callback_return_password_and_enter(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text; - struct join_state *state = (struct join_state *)data; - if (!widget) { - return; - } - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); -#ifdef DEBUG_PASSWORD - debug("callback_return_password: %s\n", entry_text); -#else - debug("callback_return_password: (not printed)\n"); -#endif - SAFE_FREE(state->password); - state->password = strdup(entry_text); - g_signal_emit_by_name(state->button_ok_creds, "clicked"); -} - -static void callback_do_hostname_change(GtkWidget *widget, - gpointer data) -{ - GtkWidget *dialog; - const char *str = NULL; - - struct join_state *state = (struct join_state *)data; - - switch (state->name_type_initial) { - case NetSetupDomainName: - str = "To be implemented: call NetRenameMachineInDomain\n"; - break; - case NetSetupWorkgroupName: - str = "To be implemented: call SetComputerNameEx\n"; - break; - default: - break; - } - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - str); - - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - gtk_widget_show(dialog); -} - -static void callback_do_join(GtkWidget *widget, - gpointer data) -{ - GtkWidget *dialog; - - NET_API_STATUS status; - const char *err_str = NULL; - uint32_t join_flags = 0; - uint32_t unjoin_flags = 0; - gboolean domain_join = FALSE; - gboolean try_unjoin = FALSE; - const char *domain_or_workgroup = NULL; - - struct join_state *state = (struct join_state *)data; - - callback_return_username(state->entry_account, state); - callback_return_password(state->entry_password, state); - - if (state->window_creds_prompt) { - gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt)); - } - - if (state->name_type_new == NetSetupDomainName) { - domain_join = TRUE; - join_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | - WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE | - WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED; /* for testing */ - domain_or_workgroup = "domain"; - } else { - domain_or_workgroup = "workgroup"; - } - - if ((state->name_type_initial == NetSetupDomainName) && - (state->name_type_new == NetSetupWorkgroupName)) { - try_unjoin = TRUE; - unjoin_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | - WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE; - } - - debug("callback_do_join: Joining a %s named %s using join_flags 0x%08x ", - domain_or_workgroup, - state->name_buffer_new, - join_flags); - if (domain_join) { - debug("as %s ", state->account); -#ifdef DEBUG_PASSWORD - debug("with %s ", state->password); -#endif - } - debug("\n"); - if (try_unjoin) { - - debug("callback_do_join: Unjoining\n"); - - status = NetUnjoinDomain(NULL, - state->account, - state->password, - unjoin_flags); - if (status != 0) { - err_str = libnetapi_errstr(state->ctx, status); - g_print("callback_do_join: failed to unjoin (%s)\n", - err_str); - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "The following error occured attempting to unjoin the %s: \"%s\": %s", - domain_or_workgroup, - state->name_buffer_new, - err_str); - - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - gtk_widget_show(dialog); - - return; - } - - } - status = NetJoinDomain(NULL, - state->name_buffer_new, - NULL, - state->account, - state->password, - join_flags); - if (status != 0) { - err_str = libnetapi_errstr(state->ctx, status); - g_print("callback_do_join: failed to join (%s)\n", err_str); - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "The following error occured attempting to join the %s: \"%s\": %s", - domain_or_workgroup, - state->name_buffer_new, - err_str); - - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - gtk_widget_show(dialog); - - return; - } - - debug("callback_do_join: Successfully joined %s\n", - domain_or_workgroup); - - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - "Welcome to the %s %s.", - state->name_buffer_new, - domain_or_workgroup); - - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - - callback_do_reboot(NULL, state->window_parent, state); -} - -static void callback_creds_prompt(GtkWidget *widget, - gpointer data) -{ - GtkWidget *window; - GtkWidget *box1; - GtkWidget *bbox; - GtkWidget *button; - GtkWidget *label; - - struct join_state *state = (struct join_state *)data; - - debug("callback_creds_prompt:\n"); - - state->window_parent = state->window_do_change; - - if (state->hostname_changed) { - return callback_do_hostname_change(NULL, state); - } - - if ((state->name_type_initial != NetSetupDomainName) && - (state->name_type_new != NetSetupDomainName)) { - return callback_do_join(NULL, state); - } - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - - gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); - gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); - gtk_widget_set_size_request(GTK_WIDGET(window), 380, 280); - gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); -/* gtk_window_set_icon_name(GTK_WIDGET(window), GTK_STOCK_DIALOG_AUTHENTICATION); */ - state->window_creds_prompt = window; - - g_signal_connect(G_OBJECT(window), "delete_event", - G_CALLBACK(callback_do_close), window); - - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - box1 = gtk_vbox_new(FALSE, 0); - - gtk_container_add(GTK_CONTAINER(window), box1); - - if ((state->name_type_initial == NetSetupDomainName) && - (state->name_type_new == NetSetupWorkgroupName)) { - label = gtk_label_new("Enter the name and password of an account with permission to leave the domain.\n"); - } else { - label = gtk_label_new("Enter the name and password of an account with permission to join the domain.\n"); - } - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - - gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); - - gtk_widget_show(label); - - /* USER NAME */ - label = gtk_label_new("User name:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - state->entry_account = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(state->entry_account), MAX_CRED_LEN); - g_signal_connect(G_OBJECT(state->entry_account), "activate", - G_CALLBACK(callback_return_username_and_enter), - (gpointer)state); - gtk_editable_select_region(GTK_EDITABLE(state->entry_account), - 0, GTK_ENTRY(state->entry_account)->text_length); - gtk_box_pack_start(GTK_BOX(box1), state->entry_account, TRUE, TRUE, 0); - gtk_widget_show(state->entry_account); - - /* PASSWORD */ - label = gtk_label_new("Password:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - state->entry_password = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(state->entry_password), MAX_CRED_LEN); - gtk_entry_set_visibility(GTK_ENTRY(state->entry_password), FALSE); - g_signal_connect(G_OBJECT(state->entry_password), "activate", - G_CALLBACK(callback_return_password_and_enter), - (gpointer)state); - gtk_editable_set_editable(GTK_EDITABLE(state->entry_password), TRUE); - gtk_editable_select_region(GTK_EDITABLE(state->entry_password), - 0, GTK_ENTRY(state->entry_password)->text_length); - gtk_box_pack_start(GTK_BOX(box1), state->entry_password, TRUE, TRUE, 0); - gtk_widget_show(state->entry_password); - - bbox = gtk_hbutton_box_new(); - gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); - gtk_container_add(GTK_CONTAINER(box1), bbox); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(bbox), 10); - - state->button_ok_creds = gtk_button_new_from_stock(GTK_STOCK_OK); - gtk_widget_grab_focus(GTK_WIDGET(state->button_ok_creds)); - gtk_container_add(GTK_CONTAINER(bbox), state->button_ok_creds); - g_signal_connect(G_OBJECT(state->button_ok_creds), "clicked", - G_CALLBACK(callback_do_join), - (gpointer)state); - gtk_widget_show(state->button_ok_creds); - - button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - gtk_container_add(GTK_CONTAINER(bbox), button); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(callback_do_close), (gpointer) window); - gtk_widget_show_all(window); -} - -static void callback_enter_hostname_and_unlock(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text = NULL; - char *str = NULL; - struct join_state *state = (struct join_state *)data; - - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_enter_hostname_and_unlock: %s\n", entry_text); - if (!entry_text || entry_text[0] == 0) { - state->hostname_changed = FALSE; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - if (strcasecmp(state->my_hostname, entry_text) == 0) { - state->hostname_changed = FALSE; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - state->hostname_changed = TRUE; - if (state->name_type_initial == NetSetupDomainName) { - asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); - } else { - asprintf(&str, "%s.", entry_text); - } - gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); - free(str); - - if (state->hostname_changed && str && str[0] != 0 && str[0] != '.') { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); - } -} - -static void callback_enter_computer_description_and_unlock(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text = NULL; - struct join_state *state = (struct join_state *)data; - int string_unchanged = 0; - - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_enter_computer_description_and_unlock: %s\n", - entry_text); -#if 0 - if (!entry_text || entry_text[0] == 0) { - string_unchanged = 1; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), - FALSE); - return; - } -#endif - if (entry_text && strcasecmp(state->comment, entry_text) == 0) { - string_unchanged = 1; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), - FALSE); - return; - } - - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), TRUE); - SAFE_FREE(state->comment_new); - state->comment_new = strdup(entry_text); - -} - - -static void callback_enter_workgroup_and_unlock(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text = NULL; - struct join_state *state = (struct join_state *)data; - - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_enter_workgroup_and_unlock: %s\n", entry_text); - if (!entry_text || entry_text[0] == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); - SAFE_FREE(state->name_buffer_new); - state->name_buffer_new = strdup(entry_text); - state->name_type_new = NetSetupWorkgroupName; -} - -static void callback_enter_domain_and_unlock(GtkWidget *widget, - gpointer data) -{ - const gchar *entry_text = NULL; - struct join_state *state = (struct join_state *)data; - - entry_text = gtk_entry_get_text(GTK_ENTRY(widget)); - debug("callback_enter_domain_and_unlock: %s\n", entry_text); - if (!entry_text || entry_text[0] == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - if (strcasecmp(state->name_buffer_initial, entry_text) == 0) { - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); - return; - } - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), TRUE); - SAFE_FREE(state->name_buffer_new); - state->name_buffer_new = strdup(entry_text); - state->name_type_new = NetSetupDomainName; -} - -static void callback_continue(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - - gtk_widget_grab_focus(GTK_WIDGET(state->button_ok)); - g_signal_emit_by_name(state->button_ok, "clicked"); -} - -static void callback_apply_continue(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - - gtk_widget_grab_focus(GTK_WIDGET(state->button_apply)); - g_signal_emit_by_name(state->button_apply, "clicked"); -} - -static void callback_do_join_workgroup(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - debug("callback_do_join_workgroup choosen\n"); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); - gtk_widget_grab_focus(GTK_WIDGET(state->entry_workgroup)); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); - callback_enter_workgroup_and_unlock(state->entry_workgroup, state); /* TEST */ -} - -static void callback_do_join_domain(GtkWidget *widget, - gpointer data) -{ - struct join_state *state = (struct join_state *)data; - debug("callback_do_join_domain choosen\n"); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), TRUE); - gtk_widget_grab_focus(GTK_WIDGET(state->entry_domain)); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), FALSE); - callback_enter_domain_and_unlock(state->entry_domain, state); /* TEST */ -} - -static void callback_do_change(GtkWidget *widget, - gpointer data) -{ - GtkWidget *window; - GtkWidget *box1; - GtkWidget *bbox; - GtkWidget *button_workgroup; - GtkWidget *button_domain; - GtkWidget *button; - GtkWidget *label; - GtkWidget *frame_horz; - GtkWidget *vbox; - GtkWidget *entry; - GSList *group; - - struct join_state *state = (struct join_state *)data; - - debug("callback_do_change called\n"); - - if (state->server_role == 3) { - GtkWidget *dialog; - dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - "Domain controller cannot be moved from one domain to another, they must first be demoted. Renaming this domain controller may cause it to become temporarily unavailable to users and computers. For information on renaming domain controllers, including alternate renaming methods, see Help and Support. To continue renaming this domain controller, click OK."); - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - gtk_widget_show(dialog); - return; - } - - state->button_ok = gtk_button_new_from_stock(GTK_STOCK_OK); - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - - gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); - gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_widget_set_size_request(GTK_WIDGET(window), 480, 500); /* breite * höhe */ - gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); - - g_signal_connect(G_OBJECT(window), "delete_event", - G_CALLBACK(callback_do_close), window); - - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - box1 = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(window), box1); - - label = gtk_label_new("You can change the name and membership of this computer. Changes may affect access to network ressources."); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); - gtk_widget_show(label); - - /* COMPUTER NAME */ - label = gtk_label_new("Computer name:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); - gtk_widget_show(label); - - state->label_full_computer_name = gtk_label_new(NULL); - { - entry = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(entry), MAX_NETBIOS_NAME_LEN); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(callback_enter_hostname_and_unlock), - (gpointer)state); - gtk_entry_set_text(GTK_ENTRY(entry), state->my_hostname); - gtk_editable_select_region(GTK_EDITABLE(entry), - 0, GTK_ENTRY(entry)->text_length); - - gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ - gtk_box_pack_start(GTK_BOX(box1), entry, TRUE, TRUE, 0); - gtk_widget_show(entry); - } - - /* FULL COMPUTER NAME */ - label = gtk_label_new("Full computer name:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0); - gtk_widget_show(label); - - { - const gchar *entry_text; - char *str = NULL; - entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); - if (state->name_type_initial == NetSetupDomainName) { - asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); - } else { - asprintf(&str, "%s.", entry_text); - } - gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); - free(str); - gtk_misc_set_alignment(GTK_MISC(state->label_full_computer_name), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), state->label_full_computer_name, TRUE, TRUE, 0); - gtk_widget_show(state->label_full_computer_name); - } - - /* BOX */ - frame_horz = gtk_frame_new ("Member Of"); - gtk_box_pack_start(GTK_BOX(box1), frame_horz, TRUE, TRUE, 10); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - gtk_container_add(GTK_CONTAINER(frame_horz), vbox); - - /* TWO ENTRIES */ - state->entry_workgroup = gtk_entry_new(); - state->entry_domain = gtk_entry_new(); - - /* DOMAIN */ - button_domain = gtk_radio_button_new_with_label(NULL, "Domain"); - if (state->name_type_initial == NetSetupDomainName) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_domain), TRUE); - } - gtk_box_pack_start(GTK_BOX(vbox), button_domain, TRUE, TRUE, 0); - g_signal_connect(G_OBJECT(button_domain), "clicked", - G_CALLBACK(callback_do_join_domain), - (gpointer)state); - - { - gtk_entry_set_max_length(GTK_ENTRY(state->entry_domain), 50); - g_signal_connect(G_OBJECT(state->entry_domain), "changed", - G_CALLBACK(callback_enter_domain_and_unlock), - (gpointer)state); - g_signal_connect(G_OBJECT(state->entry_domain), "activate", - G_CALLBACK(callback_continue), - (gpointer)state); - if (state->name_type_initial == NetSetupDomainName) { - gtk_entry_set_text(GTK_ENTRY(state->entry_domain), state->name_buffer_initial); - gtk_widget_set_sensitive(state->entry_workgroup, FALSE); - gtk_widget_set_sensitive(state->entry_domain, TRUE); - } - gtk_editable_set_editable(GTK_EDITABLE(state->entry_domain), TRUE); - gtk_box_pack_start(GTK_BOX(vbox), state->entry_domain, TRUE, TRUE, 0); - gtk_widget_show(state->entry_domain); - } - gtk_widget_show(button_domain); - - /* WORKGROUP */ - group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button_domain)); - button_workgroup = gtk_radio_button_new_with_label(group, "Workgroup"); - if (state->name_type_initial == NetSetupWorkgroupName) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button_workgroup), TRUE); - } - gtk_box_pack_start(GTK_BOX(vbox), button_workgroup, TRUE, TRUE, 0); - g_signal_connect(G_OBJECT(button_workgroup), "clicked", - G_CALLBACK(callback_do_join_workgroup), - (gpointer)state); - { - gtk_entry_set_max_length(GTK_ENTRY(state->entry_workgroup), MAX_NETBIOS_NAME_LEN); - g_signal_connect(G_OBJECT(state->entry_workgroup), "changed", - G_CALLBACK(callback_enter_workgroup_and_unlock), - (gpointer)state); - g_signal_connect(G_OBJECT(state->entry_workgroup), "activate", - G_CALLBACK(callback_continue), - (gpointer)state); - - if (state->name_type_initial == NetSetupWorkgroupName) { - gtk_entry_set_text(GTK_ENTRY(state->entry_workgroup), state->name_buffer_initial); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); - gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); - } - gtk_box_pack_start(GTK_BOX(vbox), state->entry_workgroup, TRUE, TRUE, 0); - gtk_widget_show(state->entry_workgroup); - } - gtk_widget_show(button_workgroup); - - /* BUTTONS */ - bbox = gtk_hbutton_box_new(); - gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); - gtk_container_add(GTK_CONTAINER(box1), bbox); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(bbox), 10); - - state->window_do_change = window; - gtk_widget_set_sensitive(GTK_WIDGET(state->button_ok), FALSE); /* !!! */ - gtk_container_add(GTK_CONTAINER(bbox), state->button_ok); - g_signal_connect(G_OBJECT(state->button_ok), "clicked", - G_CALLBACK(callback_creds_prompt), - (gpointer)state); - - button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - gtk_container_add(GTK_CONTAINER(bbox), button); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(callback_do_close), - (gpointer)window); - - gtk_widget_show_all(window); - -} - -static void callback_do_about(GtkWidget *widget, - gpointer data) -{ - GdkPixbuf *logo; - GError *error = NULL; - - debug("callback_do_about called\n"); - - logo = gdk_pixbuf_new_from_file(SAMBA_IMAGE_PATH, - &error); - if (logo == NULL) { - g_print("failed to load logo from %s: %s\n", - SAMBA_IMAGE_PATH, error->message); - } - - gtk_show_about_dialog(data, - "name", "Samba", - "version", "3.2.0pre2-GIT-904a90-test", - "copyright", "Copyright Andrew Tridgell and the Samba Team 1992-2007", - "website", "http://www.samba.org", - "license", "GPLv3", - "logo", logo, - "comments", "Samba gtk domain join utility", - NULL); -} - -static int draw_main_window(struct join_state *state) -{ - GtkWidget *window; - GtkWidget *button; - GtkWidget *label; - GtkWidget *main_vbox; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *bbox; - GtkWidget *image; - GtkWidget *table; - GtkWidget *entry; - GdkPixbuf *icon; - GError *error = NULL; - - icon = gdk_pixbuf_new_from_file(SAMBA_ICON_PATH, - &error); - if (icon == NULL) { - g_print("failed to load logo from %s : %s\n", - SAMBA_ICON_PATH, error->message); - } - -#if 1 - image = gtk_image_new_from_file(SAMBA_IMAGE_PATH); -#else - image = gtk_image_new_from_file("/usr/share/pixmaps/redhat-system_settings.png"); -#endif - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - state->window_main = window; - - gtk_window_set_title(GTK_WINDOW(window), "Samba - Join Domain dialogue"); - gtk_widget_set_size_request(GTK_WIDGET(window), 600, 600); /* breite * höhe */ - gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); - - g_signal_connect(G_OBJECT(window), "delete_event", - G_CALLBACK(callback_delete_event), NULL); - - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - main_vbox = gtk_vbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(window), main_vbox); - -#if 0 - gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); - gtk_widget_show(image); -#endif - /* Hbox */ - hbox = gtk_hbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(main_vbox), hbox); - - { -/* gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); */ - gtk_misc_set_alignment(GTK_MISC(image), 0, 0); - gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 10); - gtk_widget_show(image); - - /* Label */ - label = gtk_label_new("Samba uses the following information to identify your computer on the network."); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_widget_set_size_request(GTK_WIDGET(label), 500, 40); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - } - - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); - gtk_container_add(GTK_CONTAINER(main_vbox), vbox); - - /* Table */ - table = gtk_table_new(6, 3, TRUE); - gtk_table_set_row_spacings(GTK_TABLE(table), 5); - gtk_table_set_col_spacings(GTK_TABLE(table), 5); - gtk_container_add(GTK_CONTAINER(vbox), table); - - { - /* Label */ - label = gtk_label_new("Computer description:"); -/* gtk_misc_set_alignment(GTK_MISC(label), 0, 0); */ - gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); - gtk_widget_show(label); - - state->button_apply = gtk_button_new_from_stock(GTK_STOCK_APPLY); - - /* Entry */ - entry = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(entry), 256); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(callback_enter_computer_description_and_unlock), - state); - g_signal_connect(G_OBJECT(entry), "activate", - G_CALLBACK(callback_apply_continue), - (gpointer)state); - - gtk_entry_set_text(GTK_ENTRY(entry), (char *)state->comment); - gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); /* ! */ - gtk_table_attach_defaults(GTK_TABLE(table), entry, 1, 3, 0, 1); - gtk_widget_show(entry); - } - - /* Label */ - label = gtk_label_new("For example: \"Samba \%v\"."); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 1, 2); - gtk_widget_show(label); - - /* Label */ - label = gtk_label_new("Full computer name:"); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3); - gtk_widget_show(label); - - { - /* Label */ - char *str = NULL; - if (state->name_type_initial == NetSetupDomainName) { - asprintf(&str, "%s.%s", state->my_hostname, - state->my_dnsdomain); - } else { - asprintf(&str, "%s.", state->my_hostname); - } - - label = gtk_label_new(str); - SAFE_FREE(str); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 2, 3); - gtk_widget_show(label); - } - - /* Label */ - if (state->name_type_initial == NetSetupDomainName) { - label = gtk_label_new("Domain:"); - } else { - label = gtk_label_new("Workgroup:"); - } - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4); - gtk_widget_show(label); - state->label_current_name_type = label; - - /* Label */ - label = gtk_label_new(state->name_buffer_initial); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_table_attach_defaults(GTK_TABLE(table), label, 1, 3, 3, 4); - gtk_widget_show(label); - state->label_current_name_buffer = label; - - { - hbox = gtk_hbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(vbox), hbox); - label = gtk_label_new("To rename this computer or join a domain, click Change."); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - - } - - /* bbox */ - bbox = gtk_hbutton_box_new(); - gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); - gtk_container_add(GTK_CONTAINER(hbox), bbox); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(bbox), 10); - - button = gtk_button_new_with_mnemonic("Ch_ange"); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(callback_do_change), - (gpointer)state); - gtk_box_pack_start(GTK_BOX(bbox), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - /* Label (hidden) */ - state->label_reboot = gtk_label_new(NULL); - gtk_label_set_line_wrap(GTK_LABEL(state->label_reboot), TRUE); - gtk_misc_set_alignment(GTK_MISC(state->label_reboot), 0, 0); - gtk_box_pack_start(GTK_BOX(vbox), state->label_reboot, TRUE, TRUE, 0); - gtk_widget_show(state->label_reboot); - -#if 0 - gtk_box_pack_start(GTK_BOX(vbox), - create_bbox(window, TRUE, NULL, 10, 85, 20, GTK_BUTTONBOX_END), - TRUE, TRUE, 5); -#endif - { - - GtkWidget *frame; - GtkWidget *bbox2; - GtkWidget *button2; - - frame = gtk_frame_new(NULL); - bbox2 = gtk_hbutton_box_new(); - - gtk_container_set_border_width(GTK_CONTAINER(bbox2), 5); - gtk_container_add(GTK_CONTAINER(frame), bbox2); - - /* Set the appearance of the Button Box */ - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox2), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(bbox2), 10); - /*gtk_button_box_set_child_size(GTK_BUTTON_BOX(bbox2), child_w, child_h);*/ - - button2 = gtk_button_new_from_stock(GTK_STOCK_OK); - gtk_container_add(GTK_CONTAINER(bbox2), button2); - g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(callback_do_exit), state); - - button2 = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - gtk_container_add(GTK_CONTAINER(bbox2), button2); - g_signal_connect(G_OBJECT(button2), "clicked", - G_CALLBACK(callback_delete_event), - window); - - gtk_container_add(GTK_CONTAINER(bbox2), state->button_apply); - g_signal_connect(G_OBJECT(state->button_apply), "clicked", - G_CALLBACK(callback_apply_description_change), - state); - gtk_widget_set_sensitive(GTK_WIDGET(state->button_apply), FALSE); - - button2 = gtk_button_new_from_stock(GTK_STOCK_ABOUT); - gtk_container_add(GTK_CONTAINER(bbox2), button2); - g_signal_connect(G_OBJECT(button2), "clicked", - G_CALLBACK(callback_do_about), - window); - - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); - } - - gtk_widget_show_all(window); - - return 0; -} - -static int init_join_state(struct join_state **state) -{ - struct join_state *s; - - s = malloc(sizeof(struct join_state)); - if (!s) { - return -1; - } - - memset(s, '\0', sizeof(struct join_state)); - - *state = s; - - return 0; -} - -static int initialize_join_state(struct join_state *state, - const char *debug_level) -{ - struct libnetapi_ctx *ctx = NULL; - NET_API_STATUS status = 0; - - status = libnetapi_init(&ctx); - if (status) { - return status; - } - - if (debug_level) { - libnetapi_set_debuglevel(ctx, debug_level); - } - - { - char my_hostname[HOST_NAME_MAX]; - const char *p = NULL; - if (gethostname(my_hostname, sizeof(my_hostname)) == -1) { - return -1; - } - - state->my_fqdn = strdup(my_hostname); - if (!state->my_fqdn) { - return -1; - } - - p = strchr(my_hostname, '.'); - if (p) { - my_hostname[strlen(my_hostname) - strlen(p)] = '\0'; - state->my_hostname = strdup(my_hostname); - if (!state->my_hostname) { - return -1; - } - p++; - state->my_dnsdomain = strdup(p); - if (!state->my_dnsdomain) { - return -1; - } - } - } - - { - const char *buffer = NULL; - uint16_t type = 0; - status = NetGetJoinInformation(NULL, &buffer, &type); - if (status) { - return status; - } - state->name_buffer_initial = (char *)buffer; - state->name_type_initial = type; - } - - { - struct srvsvc_NetSrvInfo1005 *info1005 = NULL; - uint8_t *buffer = NULL; - - status = NetServerGetInfo(NULL, 1005, &buffer); - if (status) { - return status; - } - - info1005 = (struct srvsvc_NetSrvInfo1005 *)buffer; - - state->comment = strdup(info1005->comment); - if (!state->comment) { - return -1; - } - } -#if 0 - { - struct srvsvc_NetSrvInfo100 *info100 = NULL; - uint8_t *buffer = NULL; - - status = NetServerGetInfo(NULL, 100, &buffer); - if (status) { - return status; - } - - info100 = (struct srvsvc_NetSrvInfo100 *)buffer; - - state->comment = strdup(info100->comment); - if (!state->comment) { - return -1; - } - } -#endif - - state->ctx = ctx; - - return 0; -} - -int main(int argc, char **argv) -{ - GOptionContext *context = NULL; - static const char *debug_level = NULL; - struct join_state *state = NULL; - GError *error = NULL; - int ret = 0; - - static GOptionEntry entries[] = { - { "debug", 'd', 0, G_OPTION_ARG_STRING, &debug_level, "Debug level (for samba)", "N" }, - { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Verbose output", 0 }, - { NULL } - }; - - context = g_option_context_new("- Samba domain join utility"); - g_option_context_add_main_entries(context, entries, NULL); -/* g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); */ - g_option_context_add_group(context, gtk_get_option_group(TRUE)); - g_option_context_parse(context, &argc, &argv, &error); - - gtk_init(&argc, &argv); - g_set_application_name("Samba"); - - ret = init_join_state(&state); - if (ret) { - return ret; - } - - ret = initialize_join_state(state, debug_level); - if (ret) { - return ret; - } - - draw_main_window(state); - - gtk_main(); - - do_cleanup(state); - - return 0; -} -- cgit From a2481eda8c29255e8580b6070ea87f46ea7b4300 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Fri, 21 Dec 2007 11:57:34 -0600 Subject: Add files for new LGPL libwbclient DSO implementing the Winbind client API (based on the winbind_struct_protocol.h). The API in incomplete, but sufficient to merge. See wbclienbt.h for the i interface functions. (This used to be commit 83d274b46078a9ace77edb822a0e336c79dcf40e) --- source3/Makefile.in | 165 ++- source3/configure.in | 22 +- source3/exports/libwbclient.syms | 4 + source3/library-versions.in | 1 + source3/nsswitch/libwbclient/Doxyfile | 1297 ++++++++++++++++++++++ source3/nsswitch/libwbclient/libwbclient.h | 46 + source3/nsswitch/libwbclient/wbc_err.h | 51 + source3/nsswitch/libwbclient/wbc_err_internal.h | 44 + source3/nsswitch/libwbclient/wbc_idmap.c | 272 +++++ source3/nsswitch/libwbclient/wbc_pam.c | 65 ++ source3/nsswitch/libwbclient/wbc_pwd.c | 374 +++++++ source3/nsswitch/libwbclient/wbc_sid.c | 420 +++++++ source3/nsswitch/libwbclient/wbc_util.c | 110 ++ source3/nsswitch/libwbclient/wbclient.c | 105 ++ source3/nsswitch/libwbclient/wbclient.h | 184 +++ source3/nsswitch/libwbclient/wbclient_internal.h | 32 + source3/script/mkproto.awk | 2 +- 17 files changed, 3136 insertions(+), 58 deletions(-) create mode 100644 source3/exports/libwbclient.syms create mode 100644 source3/nsswitch/libwbclient/Doxyfile create mode 100644 source3/nsswitch/libwbclient/libwbclient.h create mode 100644 source3/nsswitch/libwbclient/wbc_err.h create mode 100644 source3/nsswitch/libwbclient/wbc_err_internal.h create mode 100644 source3/nsswitch/libwbclient/wbc_idmap.c create mode 100644 source3/nsswitch/libwbclient/wbc_pam.c create mode 100644 source3/nsswitch/libwbclient/wbc_pwd.c create mode 100644 source3/nsswitch/libwbclient/wbc_sid.c create mode 100644 source3/nsswitch/libwbclient/wbc_util.c create mode 100644 source3/nsswitch/libwbclient/wbclient.c create mode 100644 source3/nsswitch/libwbclient/wbclient.h create mode 100644 source3/nsswitch/libwbclient/wbclient_internal.h diff --git a/source3/Makefile.in b/source3/Makefile.in index f2b0bc633e..f98672f246 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -63,6 +63,7 @@ KRB5LIBS=@KRB5_LIBS@ LDAP_LIBS=@LDAP_LIBS@ NSCD_LIBS=@NSCD_LIBS@ UUID_LIBS=@UUID_LIBS@ +WINBIND_LIBS=@WINBIND_LIBS@ DNSSD_LIBS=@DNSSD_LIBS@ INSTALLCMD=@INSTALL@ @@ -90,6 +91,7 @@ BINDIR = @bindir@ SBINDIR = @sbindir@ ROOTSBINDIR = @rootsbindir@ LIBDIR = @libdir@ +INCLUDEDIR=@includedir@ PAMMODULESDIR = @pammodulesdir@ VFSLIBDIR = $(LIBDIR)/vfs PDBLIBDIR = $(LIBDIR)/pdb @@ -141,6 +143,7 @@ PIDDIR = @piddir@ LIBSMBCLIENT=bin/libsmbclient.a @LIBSMBCLIENT_SHARED@ LIBSMBSHAREMODES=bin/libsmbsharemodes.a @LIBSMBSHAREMODES_SHARED@ LIBADDNS=bin/libaddns.a @LIBADDNS_SHARED@ +LIBWBCLIENT=@LIBWBCLIENT_SHARED@ LIBNETAPI=bin/libnetapi.a @LIBNETAPI_SHARED@ FLAGS1 = $(CFLAGS) @FLAGS1@ @SAMBA_CPPFLAGS@ $(CPPFLAGS) @@ -199,7 +202,7 @@ EVERYTHING_PROGS = bin/debug2html@EXEEXT@ bin/smbfilter@EXEEXT@ \ bin/log2pcap@EXEEXT@ bin/sharesec@EXEEXT@ bin/ndrdump@EXEEXT@ \ bin/vlp@EXEEXT@ -SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@ @LIBNETAPI@ +SHLIBS = @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ @LIBADDNS@ @LIBNETAPI@ @LIBWBCLIENT@ PAM_MODULES = @PAM_MODULES@ @@ -281,6 +284,7 @@ NSS_WRAPPER_OBJ = @NSS_WRAPPER_OBJS@ TALLOC_OBJ = lib/talloc/talloc.o +LIBSAMBAUTIL_OBJ = $(TALLOC_OBJ) $(LIBREPLACE_OBJ) LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(NSS_WRAPPER_OBJ) $(TALLOC_OBJ) \ lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \ @@ -302,7 +306,7 @@ LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \ lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \ lib/md5.o lib/hmacmd5.o lib/arc4.o lib/iconv.o \ - nsswitch/wb_client.o $(WBCOMMON_OBJ) \ + $(WBCOMMON_OBJ) \ lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \ lib/adt_tree.o lib/gencache.o $(TDB_OBJ) \ lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \ @@ -331,6 +335,15 @@ LIBADDNS_OBJ0 = libaddns/dnsrecord.o libaddns/dnsutils.o libaddns/dnssock.o \ libaddns/dnsgss.o libaddns/dnsmarshall.o LIBADDNS_OBJ = $(LIBADDNS_OBJ0) $(TALLOC_OBJ) +LIBWBCLIENT_OBJ = nsswitch/wb_common.o lib/talloc/talloc.o \ + nsswitch/libwbclient/wbclient.o \ + nsswitch/libwbclient/wbc_util.o \ + nsswitch/libwbclient/wbc_pwd.o \ + nsswitch/libwbclient/wbc_idmap.o \ + nsswitch/libwbclient/wbc_sid.o \ + nsswitch/libwbclient/wbc_pam.o + + LIBGPO_OBJ0 = libgpo/gpo_ldap.o libgpo/gpo_ini.o libgpo/gpo_util.o \ libgpo/gpo_fetch.o libgpo/gpo_filesync.o libgpo/gpo_sec.o LIBGPO_OBJ = $(LIBGPO_OBJ0) @@ -453,7 +466,7 @@ PASSDB_OBJ = $(PASSDB_GET_SET_OBJ) passdb/passdb.o passdb/pdb_interface.o \ passdb/util_unixsids.o passdb/lookup_sid.o \ passdb/login_cache.o @PDB_STATIC@ \ lib/account_pol.o lib/privileges.o lib/privileges_basic.o \ - lib/util_nscd.o + lib/util_nscd.o lib/winbind_util.o DEVEL_HELP_WEIRD_OBJ = modules/weird.o CP850_OBJ = modules/CP850.o @@ -570,6 +583,7 @@ PRINTBASE_OBJ = printing/notify.o printing/printing_db.o PRINTBACKEND_OBJ = printing/printing.o printing/nt_printing.o $(PRINTBASE_OBJ) SMBD_OBJ = $(SMBD_OBJ_BASE) $(SMBD_OBJ_MAIN) + NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \ nmbd/nmbd_become_lmb.o nmbd/nmbd_browserdb.o \ nmbd/nmbd_browsesync.o nmbd/nmbd_elections.o \ @@ -623,12 +637,13 @@ PASSWD_UTIL_OBJ = utils/passwd_util.o SMBPASSWD_OBJ = utils/smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \ $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \ $(GROUPDB_OBJ) $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \ - $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) $(LDB_OBJ) + $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) \ + $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) $(LDB_OBJ) PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) \ $(LIBSAMBA_OBJ) $(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) \ $(SECRETS_OBJ) $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) libsmb/asn1.o \ - $(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LDB_OBJ) $(ERRORMAP_OBJ) + $(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LDB_OBJ) $(ERRORMAP_OBJ) SMBGET_OBJ = utils/smbget.o $(POPT_LIB_OBJ) $(LIBSMBCLIENT_OBJ) @@ -649,7 +664,7 @@ RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \ $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \ $(READLINE_OBJ) $(GROUPDB_OBJ) $(KRBCLIENT_OBJ) \ $(LIBADS_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) \ - $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(LDB_OBJ) + $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(LDB_OBJ) PAM_WINBIND_OBJ = nsswitch/pam_winbind.o $(WBCOMMON_OBJ) \ $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) @BUILD_INIPARSER@ @@ -682,7 +697,7 @@ CLIENT_OBJ = $(CLIENT_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \ $(READLINE_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \ $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ - $(DISPLAY_SEC_OBJ) + $(DISPLAY_SEC_OBJ) UTIL_REG_OBJ = lib/util_reg.o UTIL_REG_API_OBJ = lib/util_reg_api.o @@ -731,7 +746,7 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_domain.o utils/net_help.o \ utils/netlookup.o utils/net_sam.o utils/net_rpc_shell.o \ utils/net_util.o utils/net_rpc_sh_acct.o utils/net_rpc_audit.o \ $(PASSWD_UTIL_OBJ) utils/net_dns.o utils/net_ads_gpo.o \ - utils/net_conf.o auth/token_util.o utils/net_dom.o + utils/net_conf.o auth/token_util.o utils/net_dom.o nsswitch/wb_client.o NET_OBJ = $(NET_OBJ1) $(PARAM_WITHOUT_REG_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \ $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ @@ -796,9 +811,10 @@ LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \ $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_OBJ) $(LIBSMB_OBJ) \ - $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \ - $(PASSDB_OBJ) $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(SECRETS_OBJ) \ - $(POPT_LIB_OBJ) $(DCUTIL_OBJ) $(LIBADS_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) + $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \ + $(PASSDB_OBJ) $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \ + $(SECRETS_OBJ) \ + $(POPT_LIB_OBJ) $(DCUTIL_OBJ) $(LIBADS_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) SMBCQUOTAS_OBJ = utils/smbcquotas.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(PARAM_OBJ) \ @@ -902,10 +918,11 @@ WINBINDD_OBJ = \ $(SECRETS_OBJ) $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \ $(DCUTIL_OBJ) $(IDMAP_OBJ) $(NSS_INFO_OBJ) \ $(AFS_OBJ) $(AFS_SETTOKEN_OBJ) \ - $(LIBADS_SERVER_OBJ) $(SERVER_MUTEX_OBJ) $(LDB_OBJ) + $(LIBADS_SERVER_OBJ) $(SERVER_MUTEX_OBJ) $(LDB_OBJ) WBINFO_OBJ = nsswitch/wbinfo.o $(LIBSAMBA_OBJ) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \ - $(SECRETS_OBJ) $(POPT_LIB_OBJ) $(AFS_SETTOKEN_OBJ) $(RPC_PARSE_OBJ1) $(DOSERR_OBJ) + $(SECRETS_OBJ) $(POPT_LIB_OBJ) $(AFS_SETTOKEN_OBJ) $(RPC_PARSE_OBJ1) \ + $(DOSERR_OBJ) lib/winbind_util.o WINBIND_NSS_OBJ = $(WBCOMMON_OBJ) $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) @WINBIND_NSS_EXTRA_OBJS@ @@ -935,7 +952,7 @@ LDB_CMDLINE_OBJ = $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \ $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) $(POPT_LIB_OBJ) \ $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(SERVER_MUTEX_OBJ) \ $(AFS_OBJ) $(AFS_SETTOKEN_OBJ) $(REGFIO_OBJ) $(READLINE_OBJ) \ - $(LDB_OBJ) lib/ldb/tools/cmdline.o + $(LDB_OBJ) lib/ldb/tools/cmdline.o LDBEDIT_OBJ = $(LDB_CMDLINE_OBJ) lib/ldb/tools/ldbedit.o @@ -973,7 +990,7 @@ NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \ libads/kerberos_verify.o $(SECRETS_OBJ) $(SERVER_MUTEX_OBJ) \ libads/authdata.o $(RPC_PARSE_OBJ1) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ $(SMBLDAP_OBJ) $(DOSERR_OBJ) rpc_parse/parse_net.o $(LIBNMB_OBJ) \ - $(LDB_OBJ) $(ERRORMAP_OBJ) + $(LDB_OBJ) $(ERRORMAP_OBJ) VLP_OBJ1 = ../testsuite/printing/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RPC_CLIENT_OBJ) @@ -1152,37 +1169,41 @@ bin/.dummy: dir=bin $(MAKEDIR); fi @: >> $@ || : > $@ # what a fancy emoticon! -bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @BUILD_POPT@ +bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @LIBWBCLIENT_SHARED@ @BUILD_POPT@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) \ $(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \ $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) \ - @POPTLIBS@ @SMBD_LIBS@ + @POPTLIBS@ @SMBD_LIBS@ @WINBIND_LIBS@ bin/nmbd@EXEEXT@: $(BINARY_PREREQS) $(NMBD_OBJ) @BUILD_POPT@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) + @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ + @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) -bin/swat@EXEEXT@: $(BINARY_PREREQS) $(SWAT_OBJ) @BUILD_POPT@ +bin/swat@EXEEXT@: $(BINARY_PREREQS) $(SWAT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINT_LIBS) \ - $(AUTH_LIBS) $(LIBS) $(PASSDB_LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) + $(AUTH_LIBS) $(LIBS) $(PASSDB_LIBS) @POPTLIBS@ $(KRB5LIBS) \ + $(LDAP_LIBS) @WINBIND_LIBS@ -bin/rpcclient@EXEEXT@: $(BINARY_PREREQS) $(RPCCLIENT_OBJ) @BUILD_POPT@ +bin/rpcclient@EXEEXT@: $(BINARY_PREREQS) $(RPCCLIENT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(PASSDB_LIBS) $(RPCCLIENT_OBJ) \ $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \ - $(KRB5LIBS) $(LDAP_LIBS) + $(KRB5LIBS) $(LDAP_LIBS) @WINBIND_LIBS@ -bin/smbclient@EXEEXT@: $(BINARY_PREREQS) $(CLIENT_OBJ) @BUILD_POPT@ +bin/smbclient@EXEEXT@: $(BINARY_PREREQS) $(CLIENT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(DYNEXP) \ $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \ - $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(DNSSD_LIBS) + $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(DNSSD_LIBS) @WINBIND_LIBS@ -bin/net@EXEEXT@: $(BINARY_PREREQS) $(NET_OBJ) @BUILD_POPT@ +bin/net@EXEEXT@: $(BINARY_PREREQS) $(NET_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @INIPARSERLIBS@ + @$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \ + @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) \ + $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @INIPARSERLIBS@ @WINBIND_LIBS@ bin/profiles@EXEEXT@: $(BINARY_PREREQS) $(PROFILES_OBJ) @BUILD_POPT@ @echo Linking $@ @@ -1232,22 +1253,25 @@ bin/smbcontrol@EXEEXT@: $(BINARY_PREREQS) $(SMBCONTROL_OBJ) @BUILD_POPT@ $(SMBCONTROL_OBJ) $(DYNEXP) $(LDFLAGS) \ $(LIBS) $(LDAP_LIBS) @LIBUNWIND_PTRACE@ @POPTLIBS@ -bin/smbtree@EXEEXT@: $(BINARY_PREREQS) $(SMBTREE_OBJ) @BUILD_POPT@ +bin/smbtree@EXEEXT@: $(BINARY_PREREQS) $(SMBTREE_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) + @$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(DYNEXP) \ + $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@ -bin/smbpasswd@EXEEXT@: $(BINARY_PREREQS) $(SMBPASSWD_OBJ) @BUILD_POPT@ +bin/smbpasswd@EXEEXT@: $(BINARY_PREREQS) $(SMBPASSWD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(PASSDB_LIBS) \ - $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) + $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) @WINBIND_LIBS@ -bin/pdbedit@EXEEXT@: $(BINARY_PREREQS) $(PDBEDIT_OBJ) @BUILD_POPT@ +bin/pdbedit@EXEEXT@: $(BINARY_PREREQS) $(PDBEDIT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(PASSDB_LIBS) $(LDAP_LIBS) + @$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ + @POPTLIBS@ $(PASSDB_LIBS) $(LDAP_LIBS) @WINBIND_LIBS@ -bin/smbget@EXEEXT@: $(BINARY_PREREQS) $(SMBGET_OBJ) @BUILD_POPT@ +bin/smbget@EXEEXT@: $(BINARY_PREREQS) $(SMBGET_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) + @$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ + @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@ bin/samtest@EXEEXT@: $(SAMTEST_OBJ) @BUILD_POPT@ @echo Linking $@ @@ -1279,15 +1303,15 @@ bin/msgtest@EXEEXT@: $(BINARY_PREREQS) $(MSGTEST_OBJ) @BUILD_POPT@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(MSGTEST_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@ -bin/smbcacls@EXEEXT@: $(BINARY_PREREQS) $(SMBCACLS_OBJ) @BUILD_POPT@ +bin/smbcacls@EXEEXT@: $(BINARY_PREREQS) $(SMBCACLS_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBCACLS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ \ - $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) + $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@ -bin/smbcquotas@EXEEXT@: $(BINARY_PREREQS) $(SMBCQUOTAS_OBJ) @BUILD_POPT@ +bin/smbcquotas@EXEEXT@: $(BINARY_PREREQS) $(SMBCQUOTAS_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBCQUOTAS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ \ - $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) + $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@ bin/eventlogadm@EXEEXT@: $(BINARY_PREREQS) $(EVTLOGADM_OBJ) @BUILD_POPT@ @echo Linking $@ @@ -1338,25 +1362,44 @@ bin/smbfilter@EXEEXT@: $(BINARY_PREREQS) $(SMBFILTER_OBJ) @BUILD_POPT@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBFILTER_OBJ) $(LDFLAGS) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@ -bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@ +bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBEDIT_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) + @$(CC) $(FLAGS) -o $@ $(LDBEDIT_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \ + @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ + $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@ -bin/ldbsearch: $(BINARY_PREREQS) $(LDBSEARCH_OBJ) @BUILD_POPT@ +bin/ldbsearch: $(BINARY_PREREQS) $(LDBSEARCH_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBSEARCH_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) + @$(CC) $(FLAGS) -o $@ $(LDBSEARCH_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \ + @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ + $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@ -bin/ldbadd: $(BINARY_PREREQS) $(LDBADD_OBJ) @BUILD_POPT@ +bin/ldbadd: $(BINARY_PREREQS) $(LDBADD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBADD_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) + @$(CC) $(FLAGS) -o $@ $(LDBADD_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \ + @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ + $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@ -bin/ldbmodify: $(BINARY_PREREQS) $(LDBMODIFY_OBJ) @BUILD_POPT@ +bin/ldbmodify: $(BINARY_PREREQS) $(LDBMODIFY_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBMODIFY_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) + @$(CC) $(FLAGS) -o $@ $(LDBMODIFY_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \ + @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ + $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@ -bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ +bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDBDEL_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) + @$(CC) $(FLAGS) -o $@ $(LDBDEL_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \ + @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ + $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@ + +bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) + @echo Linking shared library $@ + @$(SHLD_DSO) $(LIBWBCLIENT_OBJ) \ + @SONAMEFLAG@`basename $@`.$(SONAME_VER) + +bin/libwbclient.a: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) + @echo Linking non-shared library $@ + @-$(AR) -rc $@ $(LIBWBCLIENT_OBJ) bin/libaddns.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBADDNS_OBJ) @echo Linking shared library $@ @@ -1414,6 +1457,7 @@ bin/libbigballofmud.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBBIGBALLOFMUD_OBJ) libsmbclient: $(LIBSMBCLIENT) libsmbsharemodes: $(LIBSMBSHAREMODES) libaddns: $(LIBADDNS) +libwbclient: $(LIBWBCLIENT) libnetapi: $(LIBNETAPI) # Linker command to link a RPC, VFS, AUTH, CHARSET or PASSDB module. @@ -1480,10 +1524,11 @@ bin/librpc_echo.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_ECHO_OBJ) @echo "Linking $@" @$(SHLD_MODULE) $(RPC_ECHO_OBJ) -bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ +bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo "Linking $@" @$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ - @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) + @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ + @WINBIND_LIBS@ bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @echo "Linking $@" @@ -1704,16 +1749,17 @@ bin/fileid.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_FILEID_OBJ) ## None here right now ######################################################### -bin/wbinfo@EXEEXT@: $(BINARY_PREREQS) $(WBINFO_OBJ) @BUILD_POPT@ +bin/wbinfo@EXEEXT@: $(BINARY_PREREQS) $(WBINFO_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(WBINFO_OBJ) $(DYNEXP) $(LIBS) $(LDAP_LIBS) @POPTLIBS@ + @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(WBINFO_OBJ) $(DYNEXP) $(LIBS) \ + $(LDAP_LIBS) @POPTLIBS@ @WINBIND_LIBS@ bin/ntlm_auth@EXEEXT@: $(BINARY_PREREQS) $(NTLM_AUTH_OBJ) $(PARAM_OBJ) \ - $(LIB_NONSMBD_OBJ) @BUILD_POPT@ + $(LIB_NONSMBD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(DYNEXP) $(NTLM_AUTH_OBJ) \ $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(LIBS) \ - @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) + @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @WINBIND_LIBS@ bin/pam_smbpass.@SHLIBEXT@: $(BINARY_PREREQS) $(PAM_SMBPASS_OBJ) @echo "Linking shared library $@" @@ -1751,8 +1797,10 @@ bin/timelimit@EXEEXT@: script/tests/timelimit.o @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(DYNEXP) script/tests/timelimit.o -install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSSPNEGO@ installman installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ @INSTALL_LIBSMBCLIENT@ @INSTALL_PAM_MODULES@ @INSTALL_LIBSMBSHAREMODES@ @INSTALL_LIBNETAPI@ - +install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSSPNEGO@ installman \ + installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ \ + @INSTALL_LIBSMBCLIENT@ @INSTALL_PAM_MODULES@ \ + @INSTALL_LIBSMBSHAREMODES@ @INSTALL_LIBWBCLIENT@ @INSTALL_LIBNETAPI@ install-everything: install installmodules @@ -1830,6 +1878,11 @@ installlibaddns: installdirs libaddns -$(INSTALLLIBCMD_SH) bin/libaddns.@SHLIBEXT@ $(DESTDIR)$(LIBDIR) -$(INSTALLLIBCMD_A) bin/libaddns.a $(DESTDIR)$(LIBDIR) +installlibwbclient: installdirs libwbclient + @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) $(INCLUDEDIR)/samba + -$(INSTALLLIBCMD_SH) bin/libwbclient.@SHLIBEXT@ $(DESTDIR)$(LIBDIR) + -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/nsswitch/libwbclient/wbclient.h $(DESTDIR)${prefix}/include/samba + installlibnetapi: installdirs libnetapi @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) -$(INSTALLLIBCMD_SH) bin/libnetapi.@SHLIBEXT@ $(DESTDIR)$(LIBDIR) diff --git a/source3/configure.in b/source3/configure.in index a9053d9a08..d077d9b956 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -318,6 +318,15 @@ AC_SUBST(INSTALL_LIBADDNS) AC_SUBST(UNINSTALL_LIBADDNS) AC_SUBST(LIBADDNS_SHARED) AC_SUBST(LIBADDNS) + +AC_SUBST(INSTALL_LIBWBCLIENT) +AC_SUBST(UNINSTALL_LIBWBCLIENT) +AC_SUBST(LIBWBCLIENT_SHARED) +AC_SUBST(LIBWBCLIENT) +AC_SUBST(WINBIND_LIBS) + +AC_SUBST(LIBSAMBAUTIL_SHARED) + AC_SUBST(INSTALL_LIBSMBCLIENT) AC_SUBST(UNINSTALL_LIBSMBCLIENT) AC_SUBST(LIBSMBCLIENT_SHARED) @@ -5143,11 +5152,13 @@ AC_ARG_WITH(libaddns, INSTALL_LIBADDNS=installlibaddns UNINSTALL_LIBADDNS=uninstalllibaddns ;; - esac ] + esac ], +[AC_MSG_RESULT(no)] ) ################################################# # should we build libsmbclient? + INSTALL_LIBSMBCLIENT= UNINSTALL_LIBSMBCLIENT= LIBSMBCLIENT_SHARED= @@ -5234,6 +5245,7 @@ AC_ARG_WITH(libsmbsharemodes, INSTALL_LIBSMBSHAREMODES=installlibsmbsharemodes ) + ################################################# # these tests are taken from the GNU fileutils package AC_CHECKING(how to get filesystem space usage) @@ -6133,6 +6145,14 @@ fi if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes"; then NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}" + ## Only worry about libwbclient if we have shared library support + ## and winbindd + LIBWBCLIENT_SHARED=bin/libwbclient.$SHLIBEXT + LIBWBCLIENT=libwbclient + INSTALL_LIBWBCLIENT=installlibwbclient + UNINSTALL_LIBWBCLIENT=uninstalllibwbclient + WINBIND_LIBS="-lwbclient" + LDFLAGS="$LDFLAGS -L./bin" fi if test x"$HAVE_WINBIND" = x"yes"; then diff --git a/source3/exports/libwbclient.syms b/source3/exports/libwbclient.syms new file mode 100644 index 0000000000..f1e68b42a9 --- /dev/null +++ b/source3/exports/libwbclient.syms @@ -0,0 +1,4 @@ +{ + global: wbc*; + local: *; +}; diff --git a/source3/library-versions.in b/source3/library-versions.in index cd4d621dd5..ad6ecc4667 100644 --- a/source3/library-versions.in +++ b/source3/library-versions.in @@ -6,4 +6,5 @@ bin/libsmbclient.@SHLIBEXT@:0:1 bin/libsmbsharemodes.@SHLIBEXT@:0:2 bin/libaddns.@SHLIBEXT@:0:1 bin/libmsrpc.@SHLIBEXT@:0:1 +bin/libwbclient.@SHLIBEXT@:0:1 diff --git a/source3/nsswitch/libwbclient/Doxyfile b/source3/nsswitch/libwbclient/Doxyfile new file mode 100644 index 0000000000..e12c2b06f0 --- /dev/null +++ b/source3/nsswitch/libwbclient/Doxyfile @@ -0,0 +1,1297 @@ +# Doxyfile 1.5.3 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = Samba + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = HEAD + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = dox + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = $(PWD)/ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be extracted +# and appear in the documentation as a namespace called 'anonymous_namespace{file}', +# where file will be replaced with the base name of the file that contains the anonymous +# namespace. By default anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = NO + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = NO + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text " + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = . + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = *.c \ + *.h \ + *.idl + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = include/includes.h \ + include/proto.h + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH +# then you must also enable this option. If you don't then doxygen will produce +# a warning and turn it on anyway + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = YES + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 1 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = . + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 3 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = YES + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = NO + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to +# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to +# specify the directory where the mscgen tool resides. If left empty the tool is assumed to +# be found in the default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the number +# of direct children of the root node in a graph is already larger than +# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/source3/nsswitch/libwbclient/libwbclient.h b/source3/nsswitch/libwbclient/libwbclient.h new file mode 100644 index 0000000000..74cba7e796 --- /dev/null +++ b/source3/nsswitch/libwbclient/libwbclient.h @@ -0,0 +1,46 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef _LIBWBCLIENT_H +#define _LIBWBCLIENT_H + +/* Super header including necessary public and private header files + for building the wbclient library. __DO NOT__ define anything + in this file. Only include other headers. */ + +/* Winbind headers */ + +#include "nsswitch/winbind_nss_config.h" +#include "nsswitch/winbind_struct_protocol.h" + +#include + +/* Public headers */ + +#include "wbclient.h" + +/* Private headers */ + +#include "wbc_err_internal.h" +#include "wbclient_internal.h" + + +#endif /* _LIBWBCLIENT_H */ diff --git a/source3/nsswitch/libwbclient/wbc_err.h b/source3/nsswitch/libwbclient/wbc_err.h new file mode 100644 index 0000000000..069f68f189 --- /dev/null +++ b/source3/nsswitch/libwbclient/wbc_err.h @@ -0,0 +1,51 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef _WBC_ERR_H +#define _WBC_ERR_H + + +/* Define error types */ + +/** + * @brief Status codes returned from wbc functions + **/ + +enum _wbcErrType { + WBC_ERR_SUCCESS = 0, /**< Successful completion **/ + WBC_ERR_NOT_IMPLEMENTED,/**< Function not implemented **/ + WBC_ERR_UNKNOWN_FAILURE,/**< General failure **/ + WBC_ERR_NO_MEMORY, /**< Memory allocation error **/ + WBC_ERR_INVALID_SID, /**< Invalid SID format **/ + WBC_ERR_INVALID_PARAM, /**< An Invalid parameter was supplied **/ + WBC_ERR_WINBIND_NOT_AVAILABLE, /**< Winbind daemon is not available **/ + WBC_ERR_DOMAIN_NOT_FOUND, /**< Domain is not trusted or cannot be found **/ + WBC_INVALID_RESPONSE, /**< Winbind returned an invalid response **/ + WBC_ERR_NSS_ERROR /**< NSS_STATUS error **/ +}; + +typedef enum _wbcErrType wbcErr; + +#define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS) + +char *wbcErrorString(wbcErr error); + +#endif /* _WBC_ERR_H */ diff --git a/source3/nsswitch/libwbclient/wbc_err_internal.h b/source3/nsswitch/libwbclient/wbc_err_internal.h new file mode 100644 index 0000000000..ea501cba31 --- /dev/null +++ b/source3/nsswitch/libwbclient/wbc_err_internal.h @@ -0,0 +1,44 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef _WBC_ERR_INTERNAL_H +#define _WBC_ERR_INTERNAL_H + +/* Private macros */ + +#define BAIL_ON_WBC_ERROR(x) \ + do { \ + if ((x) != WBC_ERR_SUCCESS) \ + goto done; \ + } while(0); + +#define BAIL_ON_PTR_ERROR(x, status) \ + do { \ + if ((x) == NULL) { \ + status = WBC_ERR_NO_MEMORY; \ + goto done; \ + } else { \ + status = WBC_ERR_SUCCESS; \ + } \ + } while (0); + + +#endif /* _WBC_ERR_INTERNAL_H */ diff --git a/source3/nsswitch/libwbclient/wbc_idmap.c b/source3/nsswitch/libwbclient/wbc_idmap.c new file mode 100644 index 0000000000..651c270a57 --- /dev/null +++ b/source3/nsswitch/libwbclient/wbc_idmap.c @@ -0,0 +1,272 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +/* Required Headers */ + +#include "libwbclient.h" + +/** @brief Convert a Windows SID to a Unix uid + * + * @param *sid Pointer to the domain SID to be resolved + * @param *puid Pointer to the resolved uid_t value + * + * @return #wbcErr + * + **/ + +wbcErr wbcSidToUid(const struct wbcDomainSid *sid, uid_t *puid) +{ + struct winbindd_request request; + struct winbindd_response response; + char *sid_string = NULL; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + if (!sid || !puid) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + wbc_status = wbcSidToString(sid, &sid_string); + BAIL_ON_WBC_ERROR(wbc_status); + + strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1); + wbcFreeMemory(sid_string); + + /* Make request */ + + wbc_status = wbcRequestResponse(WINBINDD_SID_TO_UID, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + *puid = response.data.uid; + + wbc_status = WBC_ERR_SUCCESS; + + done: + return wbc_status; +} + +/** @brief Convert a Unix uid to a Windows SID + * + * @param uid Unix uid to be resolved + * @param *sid Pointer to the resolved domain SID + * + * @return #wbcErr + * + **/ + +wbcErr wbcUidToSid(uid_t uid, struct wbcDomainSid *sid) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct winbindd_request request; + struct winbindd_response response; + + if (!sid) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + request.data.uid = uid; + + /* Make request */ + + wbc_status = wbcRequestResponse(WINBINDD_UID_TO_SID, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + wbc_status = wbcStringToSid(response.data.sid.sid, sid); + BAIL_ON_WBC_ERROR(wbc_status); + +done: + return wbc_status; +} + +/** @brief Convert a Windows SID to a Unix gid + * + * @param *sid Pointer to the domain SID to be resolved + * @param *pgid Pointer to the resolved gid_t value + * + * @return #wbcErr + * + **/ + +wbcErr wbcSidToGid(const struct wbcDomainSid *sid, gid_t *pgid) +{ + struct winbindd_request request; + struct winbindd_response response; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + char *sid_string = NULL; + + if (!sid || !pgid) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + wbc_status = wbcSidToString(sid, &sid_string); + BAIL_ON_WBC_ERROR(wbc_status); + + strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1); + wbcFreeMemory(sid_string); + + /* Make request */ + + wbc_status = wbcRequestResponse(WINBINDD_SID_TO_GID, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + *pgid = response.data.gid; + + wbc_status = WBC_ERR_SUCCESS; + + done: + return wbc_status; +} + +/** @brief Convert a Unix uid to a Windows SID + * + * @param gid Unix gid to be resolved + * @param *sid Pointer to the resolved domain SID + * + * @return #wbcErr + * + **/ + +wbcErr wbcGidToSid(gid_t gid, struct wbcDomainSid *sid) +{ + struct winbindd_request request; + struct winbindd_response response; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + if (!sid) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + request.data.gid = gid; + + /* Make request */ + + wbc_status = wbcRequestResponse(WINBINDD_GID_TO_SID, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + wbc_status = wbcStringToSid(response.data.sid.sid, sid); + BAIL_ON_WBC_ERROR(wbc_status); + +done: + return wbc_status; +} + +/** @brief Obtain a new uid from Winbind + * + * @param *puid *pointer to the allocated uid + * + * @return #wbcErr + **/ + +wbcErr wbcAllocateUid(uid_t *puid) +{ + struct winbindd_request request; + struct winbindd_response response; + NSS_STATUS result; + + if (!puid) + return WBC_ERR_INVALID_PARAM; + + /* Initialise request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + /* Make request */ + + result = wbcRequestResponse(WINBINDD_ALLOCATE_UID, + &request, &response); + + if (result != NSS_STATUS_SUCCESS) + return WBC_ERR_UNKNOWN_FAILURE; + + /* Copy out result */ + *puid = response.data.uid; + + return WBC_ERR_SUCCESS; +} + +/** @brief Obtain a new gid from Winbind + * + * @param *pgid Pointer to the allocated gid + * + * @return #wbcErr + **/ + +wbcErr wbcAllocateGid(uid_t *pgid) +{ + struct winbindd_request request; + struct winbindd_response response; + NSS_STATUS result; + + if (!pgid) + return WBC_ERR_INVALID_PARAM; + + /* Initialise request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + /* Make request */ + + result = wbcRequestResponse(WINBINDD_ALLOCATE_GID, + &request, &response); + + if (result != NSS_STATUS_SUCCESS) + return WBC_ERR_UNKNOWN_FAILURE; + + /* Copy out result */ + *pgid = response.data.gid; + + return WBC_ERR_SUCCESS; +} + diff --git a/source3/nsswitch/libwbclient/wbc_pam.c b/source3/nsswitch/libwbclient/wbc_pam.c new file mode 100644 index 0000000000..1548c3344a --- /dev/null +++ b/source3/nsswitch/libwbclient/wbc_pam.c @@ -0,0 +1,65 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +/* Required Headers */ + +#include "libwbclient.h" + +/** @brief Authenticate a username/password pair + * + * @param username Name of user to authenticate + * @param password Clear text password os user + * + * @return #wbcErr + **/ + +wbcErr wbcAuthenticateUser(const char *username, + const char *password) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct winbindd_request request; + struct winbindd_response response; + + if (!username) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + /* dst is already null terminated from the memset above */ + + strncpy(request.data.auth.user, username, + sizeof(request.data.auth.user)-1); + strncpy(request.data.auth.pass, password, + sizeof(request.data.auth.user)-1); + + wbc_status = wbcRequestResponse(WINBINDD_PAM_AUTH, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + +done: + return wbc_status; +} diff --git a/source3/nsswitch/libwbclient/wbc_pwd.c b/source3/nsswitch/libwbclient/wbc_pwd.c new file mode 100644 index 0000000000..4e3b0d3967 --- /dev/null +++ b/source3/nsswitch/libwbclient/wbc_pwd.c @@ -0,0 +1,374 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +/* Required Headers */ + +#include "libwbclient.h" + +/** + * + **/ + +static struct passwd *copy_passwd_entry(struct winbindd_pw *p) +{ + struct passwd *pwd = NULL; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + pwd = talloc(NULL, struct passwd); + BAIL_ON_PTR_ERROR(pwd, wbc_status); + + pwd->pw_name = talloc_strdup(pwd,p->pw_name); + BAIL_ON_PTR_ERROR(pwd->pw_name, wbc_status); + + pwd->pw_passwd = talloc_strdup(pwd, p->pw_passwd); + BAIL_ON_PTR_ERROR(pwd->pw_passwd, wbc_status); + + pwd->pw_gecos = talloc_strdup(pwd, p->pw_gecos); + BAIL_ON_PTR_ERROR(pwd->pw_gecos, wbc_status); + + pwd->pw_shell = talloc_strdup(pwd, p->pw_shell); + BAIL_ON_PTR_ERROR(pwd->pw_shell, wbc_status); + + pwd->pw_dir = talloc_strdup(pwd, p->pw_dir); + BAIL_ON_PTR_ERROR(pwd->pw_dir, wbc_status); + + pwd->pw_uid = p->pw_uid; + pwd->pw_gid = p->pw_gid; + +done: + if (!WBC_ERROR_IS_OK(wbc_status)) { + talloc_free(pwd); + pwd = NULL; + } + + return pwd; +} + +/** + * + **/ + +static struct group *copy_group_entry(struct winbindd_gr *g, + char *mem_buf) +{ + struct group *grp = NULL; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + int i; + char *mem_p, *mem_q; + + grp = talloc(NULL, struct group); + BAIL_ON_PTR_ERROR(grp, wbc_status); + + grp->gr_name = talloc_strdup(grp, g->gr_name); + BAIL_ON_PTR_ERROR(grp->gr_name, wbc_status); + + grp->gr_passwd = talloc_strdup(grp, g->gr_passwd); + BAIL_ON_PTR_ERROR(grp->gr_passwd, wbc_status); + + grp->gr_gid = g->gr_gid; + + grp->gr_mem = talloc_array(grp, char*, g->num_gr_mem+1); + + mem_p = mem_q = mem_buf; + for (i=0; inum_gr_mem && mem_p; i++) { + if ((mem_q = strchr(mem_p, ',')) != NULL) { + *mem_q = '\0'; + } + + grp->gr_mem[i] = talloc_strdup(grp, mem_p); + BAIL_ON_PTR_ERROR(grp->gr_mem[i], wbc_status); + + *mem_q = ','; + mem_p++; + mem_p = mem_q; + } + grp->gr_mem[g->num_gr_mem] = NULL; + + wbc_status = WBC_ERR_SUCCESS; + +done: + if (!WBC_ERROR_IS_OK(wbc_status)) { + talloc_free(grp); + grp = NULL; + } + + return grp; +} + +/** @brief Fill in a struct passwd* for a domain user based + * on username + * + * @param *name Username to lookup + * @param **pwd Pointer to resulting struct passwd* from the query. + * + * @return #wbcErr + **/ + +wbcErr wbcGetpwnam(const char *name, struct passwd **pwd) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct winbindd_request request; + struct winbindd_response response; + + if (!name || !pwd) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + /* dst is already null terminated from the memset above */ + + strncpy(request.data.username, name, sizeof(request.data.username)-1); + + wbc_status = wbcRequestResponse(WINBINDD_GETPWNAM, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + *pwd = copy_passwd_entry(&response.data.pw); + BAIL_ON_PTR_ERROR(*pwd, wbc_status); + + done: + return wbc_status; +} + +/** @brief Fill in a struct passwd* for a domain user based + * on uid + * + * @param uid Uid to lookup + * @param **pwd Pointer to resulting struct passwd* from the query. + * + * @return #wbcErr + **/ + +wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct winbindd_request request; + struct winbindd_response response; + + if (!pwd) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + request.data.uid = uid; + + wbc_status = wbcRequestResponse(WINBINDD_GETPWUID, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + *pwd = copy_passwd_entry(&response.data.pw); + BAIL_ON_PTR_ERROR(*pwd, wbc_status); + + done: + return wbc_status; +} + +/** @brief Fill in a struct passwd* for a domain user based + * on username + * + * @param *name Username to lookup + * @param **grp Pointer to resulting struct group* from the query. + * + * @return #wbcErr + **/ + +wbcErr wbcGetgrnam(const char *name, struct group **grp) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct winbindd_request request; + struct winbindd_response response; + + if (!name || !grp) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + /* dst is already null terminated from the memset above */ + + strncpy(request.data.groupname, name, sizeof(request.data.groupname)-1); + + wbc_status = wbcRequestResponse(WINBINDD_GETGRNAM, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + *grp = copy_group_entry(&response.data.gr, response.extra_data.data); + BAIL_ON_PTR_ERROR(*grp, wbc_status); + + done: + if (response.extra_data.data) + free(response.extra_data.data); + + return wbc_status; +} + +/** @brief Fill in a struct passwd* for a domain user based + * on uid + * + * @param gid Uid to lookup + * @param **grp Pointer to resulting struct group* from the query. + * + * @return #wbcErr + **/ + +wbcErr wbcGetgrgid(gid_t gid, struct group **grp) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct winbindd_request request; + struct winbindd_response response; + + if (!grp) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + request.data.gid = gid; + + wbc_status = wbcRequestResponse(WINBINDD_GETGRGID, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + *grp = copy_group_entry(&response.data.gr, response.extra_data.data); + BAIL_ON_PTR_ERROR(*grp, wbc_status); + + done: + if (response.extra_data.data) + free(response.extra_data.data); + + return wbc_status; +} + +/** @brief Reset the passwd iterator + * + * @return #wbcErr + **/ + +wbcErr wbcSetpwent(void) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + wbc_status = wbcRequestResponse(WINBINDD_SETPWENT, + NULL, NULL); + BAIL_ON_WBC_ERROR(wbc_status); + + done: + return wbc_status; +} + +/** @brief Close the passwd iterator + * + * @return #wbcErr + **/ + +wbcErr wbcEndpwent(void) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + wbc_status = wbcRequestResponse(WINBINDD_ENDPWENT, + NULL, NULL); + BAIL_ON_WBC_ERROR(wbc_status); + + done: + return wbc_status; +} + +/** @brief Return the next struct passwd* entry from the pwent iterator + * + * @param **pwd Pointer to resulting struct group* from the query. + * + * @return #wbcErr + **/ + +wbcErr wbcGetpwent(struct passwd **pwd) +{ + return WBC_ERR_NOT_IMPLEMENTED; +} + +/** @brief Reset the group iterator + * + * @return #wbcErr + **/ + +wbcErr wbcSetgrent(void) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + wbc_status = wbcRequestResponse(WINBINDD_SETGRENT, + NULL, NULL); + BAIL_ON_WBC_ERROR(wbc_status); + + done: + return wbc_status; +} + +/** @brief Close the group iterator + * + * @return #wbcErr + **/ + +wbcErr wbcEndgrent(void) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + wbc_status = wbcRequestResponse(WINBINDD_ENDGRENT, + NULL, NULL); + BAIL_ON_WBC_ERROR(wbc_status); + + done: + return wbc_status; +} + +/** @brief Return the next struct passwd* entry from the pwent iterator + * + * @param **grp Pointer to resulting struct group* from the query. + * + * @return #wbcErr + **/ + +wbcErr wbcGetgrent(struct group **grp) +{ + return WBC_ERR_NOT_IMPLEMENTED; +} + diff --git a/source3/nsswitch/libwbclient/wbc_sid.c b/source3/nsswitch/libwbclient/wbc_sid.c new file mode 100644 index 0000000000..5e7cb9a61b --- /dev/null +++ b/source3/nsswitch/libwbclient/wbc_sid.c @@ -0,0 +1,420 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +/* Required Headers */ + +#include "libwbclient.h" + + +/** @brief Convert a binary SID to a character string + * + * @param sid Binary Security Identifier + * @param **sid_string Resulting character string + * + * @return #wbcErr + **/ + +wbcErr wbcSidToString(const struct wbcDomainSid *sid, + char **sid_string) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + uint32_t id_auth; + int i; + char *tmp = NULL; + TALLOC_CTX *ctx = NULL; + + if (!sid) { + wbc_status = WBC_ERR_INVALID_SID; + BAIL_ON_WBC_ERROR(wbc_status); + } + + ctx = talloc_init("wbcSidToString"); + BAIL_ON_PTR_ERROR(ctx, wbc_status); + + id_auth = sid->id_auth[5] + + (sid->id_auth[4] << 8) + + (sid->id_auth[3] << 16) + + (sid->id_auth[2] << 24); + + tmp = talloc_asprintf(ctx, "S-%d-%d", sid->sid_rev_num, id_auth); + BAIL_ON_PTR_ERROR(tmp, wbc_status); + + for (i=0; inum_auths; i++) { + char *tmp2 = + tmp2 = talloc_asprintf_append(tmp, "-%u", sid->sub_auths[i]); + BAIL_ON_PTR_ERROR(tmp2, wbc_status); + + tmp = tmp2; + } + + *sid_string=talloc_strdup(NULL, tmp); + BAIL_ON_PTR_ERROR((*sid_string), wbc_status); + + wbc_status = WBC_ERR_SUCCESS; + +done: + talloc_free(ctx); + + return wbc_status; +} + +/** @brief Convert a character string to a binary SID + * + * @param *str Character string in the form of S-... + * @param sid Resulting binary SID + * + * @return #wbcErr + **/ + +wbcErr wbcStringToSid(const char *str, + struct wbcDomainSid *sid) +{ + const char *p; + char *q; + uint32_t x; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + if (!sid) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Sanity check for either "S-" or "s-" */ + + if (!str + || (str[0]!='S' && str[0]!='s') + || (str[1]!='-') + || (strlen(str)<2)) + { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Get the SID revision number */ + + p = str+2; + x = (uint32_t)strtol(p, &q, 10); + if (x==0 || !q || *q!='-') { + wbc_status = WBC_ERR_INVALID_SID; + BAIL_ON_WBC_ERROR(wbc_status); + } + sid->sid_rev_num = (uint8_t)x; + + /* Next the Identifier Authority. This is stored in big-endian + in a 6 byte array. */ + + p = q+1; + x = (uint32_t)strtol(p, &q, 10); + if (x==0 || !q || *q!='-') { + wbc_status = WBC_ERR_INVALID_SID; + BAIL_ON_WBC_ERROR(wbc_status); + } + sid->id_auth[5] = (x & 0x000000ff); + sid->id_auth[4] = (x & 0x0000ff00) >> 8; + sid->id_auth[3] = (x & 0x00ff0000) >> 16; + sid->id_auth[2] = (x & 0xff000000) >> 24; + sid->id_auth[1] = 0; + sid->id_auth[0] = 0; + + /* now read the the subauthorities */ + + p = q +1; + sid->num_auths = 0; + while (sid->num_auths < MAXSUBAUTHS) { + if ((x=(uint32_t)strtoul(p, &q, 10)) == 0) + break; + sid->sub_auths[sid->num_auths++] = x; + + if (q && ((*q!='-') || (*q=='\0'))) + break; + p = q + 1; + } + + /* IF we ended early, then the SID could not be converted */ + + if (q && *q!='\0') { + wbc_status = WBC_ERR_INVALID_SID; + BAIL_ON_WBC_ERROR(wbc_status); + } + + wbc_status = WBC_ERR_SUCCESS; + +done: + return wbc_status; + +} + +/** @brief Convert a domain and name to SID + * + * @param domain Domain name (possibly "") + * @param name User or group name + * @param *sid Pointer to the resolved domain SID + * @param *name_type Pointet to the SID type + * + * @return #wbcErr + * + **/ + +wbcErr wbcLookupName(const char *domain, + const char *name, + struct wbcDomainSid *sid, + enum wbcSidType *name_type) +{ + struct winbindd_request request; + struct winbindd_response response; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + if (!sid || !name_type) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + /* dst is already null terminated from the memset above */ + + strncpy(request.data.name.dom_name, domain, + sizeof(request.data.name.dom_name)-1); + strncpy(request.data.name.name, name, + sizeof(request.data.name.name)-1); + + wbc_status = wbcRequestResponse(WINBINDD_LOOKUPNAME, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + wbc_status = wbcStringToSid(response.data.sid.sid, sid); + BAIL_ON_WBC_ERROR(wbc_status); + + *name_type = (enum wbcSidType)response.data.sid.type; + + wbc_status = WBC_ERR_SUCCESS; + + done: + return wbc_status; +} + +/** @brief Convert a SID to a domain and name + * + * @param *sid Pointer to the domain SID to be resolved + * @param domain Resolved Domain name (possibly "") + * @param name Resolved User or group name + * @param *name_type Pointet to the resolved SID type + * + * @return #wbcErr + * + **/ + +wbcErr wbcLookupSid(const struct wbcDomainSid *sid, + char **domain, + char **name, + enum wbcSidType *name_type) +{ + struct winbindd_request request; + struct winbindd_response response; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + char *sid_string = NULL; + + if (!sid) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + /* dst is already null terminated from the memset above */ + + wbc_status = wbcSidToString(sid, &sid_string); + BAIL_ON_WBC_ERROR(wbc_status); + + strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1); + wbcFreeMemory(sid_string); + + /* Make request */ + + wbc_status = wbcRequestResponse(WINBINDD_LOOKUPSID, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + /* Copy out result */ + + if (domain != NULL) { + *domain = strdup(response.data.name.dom_name); + BAIL_ON_PTR_ERROR((*domain), wbc_status); + } + + if (name != NULL) { + *name = strdup(response.data.name.name); + BAIL_ON_PTR_ERROR((*name), wbc_status); + } + + if (name_type) { + *name_type = (enum wbcSidType)response.data.name.type; + } + + wbc_status = WBC_ERR_SUCCESS; + + done: + if (!WBC_ERROR_IS_OK(wbc_status)) { + if (*domain) + free(*domain); + if (*name) + free(*name); + } + + return wbc_status; +} + +/** @brief Translate a collection of RIDs within a domain to names + * + **/ + +wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, + int num_rids, + uint32_t *rids, + const char **domain_name, + const char ***names, + enum wbcSidType **types) +{ + size_t i, len, ridbuf_size; + char *ridlist; + char *p; + struct winbindd_request request; + struct winbindd_response response; + char *sid_string = NULL; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + + if (!dom_sid || (num_rids == 0)) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialise request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + wbc_status = wbcSidToString(dom_sid, &sid_string); + BAIL_ON_WBC_ERROR(wbc_status); + + strncpy(request.data.sid, sid_string, sizeof(request.data.sid)-1); + wbcFreeMemory(sid_string); + + /* Even if all the Rids were of maximum 32bit values, + we would only have 11 bytes per rid in the final array + ("4294967296" + \n). Add one more byte for the + terminating '\0' */ + + ridbuf_size = (sizeof(char)*11) * num_rids + 1; + + ridlist = malloc(ridbuf_size); + BAIL_ON_PTR_ERROR(ridlist, wbc_status); + + memset(ridlist, 0x0, ridbuf_size); + + len = 0; + for (i=0; i0; i++) { + char ridstr[12]; + + len = strlen(ridlist); + p = ridlist + len; + + snprintf( ridstr, sizeof(ridstr)-1, "%u\n", rids[i]); + strncat(p, ridstr, ridbuf_size-len-1); + } + + request.extra_data.data = ridlist; + request.extra_len = strlen(ridlist)+1; + + wbc_status = wbcRequestResponse(WINBINDD_LOOKUPRIDS, + &request, + &response); + free(ridlist); + + *domain_name = strdup(response.data.domain_name); + BAIL_ON_PTR_ERROR((*domain_name), wbc_status); + + *names = (const char**)malloc(sizeof(char*) * num_rids); + BAIL_ON_PTR_ERROR((*names), wbc_status); + + *types = (enum wbcSidType*)malloc(sizeof(enum wbcSidType) * num_rids); + BAIL_ON_PTR_ERROR((*types), wbc_status); + + p = (char *)response.extra_data.data; + + for (i=0; i. +*/ + +/* Required Headers */ + +#include "libwbclient.h" + + + +/** @brief Ping winbindd to see if the daemon is running + * + * @return #wbcErr + **/ + +wbcErr wbcPing(void) +{ + return wbcRequestResponse(WINBINDD_PING, NULL, NULL); +} + +/** @brief Lookup the current status of a trusted domain + * + * @param domain Domain to query + * @param *info Pointer to returned domain_info struct + * + * @return #wbcErr + * + * The char* members of the struct wbcDomainInfo* are malloc()'d + * and it the the responsibility of the caller to free the members + * before discarding the struct. + * + **/ + + +wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo) +{ + struct winbindd_request request; + struct winbindd_response response; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct wbcDomainInfo *info = NULL; + + if (!domain || !dinfo) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + strncpy(request.domain_name, domain, + sizeof(request.domain_name)-1); + + wbc_status = wbcRequestResponse(WINBINDD_DOMAIN_INFO, + &request, + &response); + BAIL_ON_WBC_ERROR(wbc_status); + + info = talloc(NULL, struct wbcDomainInfo); + BAIL_ON_PTR_ERROR(info, wbc_status); + + info->short_name = talloc_strdup(info, + response.data.domain_info.name); + BAIL_ON_PTR_ERROR(info->short_name, wbc_status); + + info->dns_name = talloc_strdup(info, + response.data.domain_info.alt_name); + BAIL_ON_PTR_ERROR(info->dns_name, wbc_status); + + wbc_status = wbcStringToSid(response.data.domain_info.sid, + &info->sid); + BAIL_ON_WBC_ERROR(wbc_status); + + if (response.data.domain_info.native_mode) + info->flags |= WBC_DOMINFO_NATIVE; + if (response.data.domain_info.active_directory) + info->flags |= WBC_DOMINFO_AD; + if (response.data.domain_info.primary) + info->flags |= WBC_DOMINFO_PRIMARY; + + *dinfo = info; + + wbc_status = WBC_ERR_SUCCESS; + + done: + if (!WBC_ERROR_IS_OK(wbc_status)) { + talloc_free(info); + } + + return wbc_status; +} diff --git a/source3/nsswitch/libwbclient/wbclient.c b/source3/nsswitch/libwbclient/wbclient.c new file mode 100644 index 0000000000..321a7db669 --- /dev/null +++ b/source3/nsswitch/libwbclient/wbclient.c @@ -0,0 +1,105 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +/* Required Headers */ + +#include "libwbclient.h" + +/* From wb_common.c */ + +NSS_STATUS winbindd_request_response(int req_type, + struct winbindd_request *request, + struct winbindd_response *response); + +/** @brief Wrapper around Winbind's send/receive API call + * + * @param cmd Winbind command operation to perform + * @param request Send structure + * @param response Receive structure + * + * @return #wbcErr + **/ + +/********************************************************************** + result == NSS_STATUS_UNAVAIL: winbind not around + result == NSS_STATUS_NOTFOUND: winbind around, but domain missing + + Due to a bad API NSS_STATUS_NOTFOUND is returned both when winbind_off + and when winbind return WINBINDD_ERROR. So the semantics of this + routine depends on winbind_on. Grepping for winbind_off I just + found 3 places where winbind is turned off, and this does not conflict + (as far as I have seen) with the callers of is_trusted_domains. + + --Volker +**********************************************************************/ + +wbcErr wbcRequestResponse(int cmd, + struct winbindd_request *request, + struct winbindd_response *response) +{ + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + NSS_STATUS nss_status; + + if (!request || !response) { + wbc_status = WBC_ERR_INVALID_PARAM; + BAIL_ON_WBC_ERROR(wbc_status); + } + + + nss_status = winbindd_request_response(cmd, request, response); + + switch (nss_status) { + case NSS_STATUS_SUCCESS: + wbc_status = WBC_ERR_SUCCESS; + break; + case NSS_STATUS_UNAVAIL: + return WBC_ERR_WINBIND_NOT_AVAILABLE; + break; + case NSS_STATUS_NOTFOUND: + return WBC_ERR_DOMAIN_NOT_FOUND; + break; + default: + wbc_status = WBC_ERR_NSS_ERROR; + break; + } + +done: + return wbc_status; +} + +/** @brief Free library allocated memory + * + * @param *p Pointer to free + * + * @return void + **/ + +void wbcFreeMemory(void *p) +{ + if (p) + talloc_free(p); + + return; +} + + + diff --git a/source3/nsswitch/libwbclient/wbclient.h b/source3/nsswitch/libwbclient/wbclient.h new file mode 100644 index 0000000000..2867aad69e --- /dev/null +++ b/source3/nsswitch/libwbclient/wbclient.h @@ -0,0 +1,184 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef _WBCLIENT_H +#define _WBCLIENT_H + +#include +#include + +/* + * Data types used by the Winbind Client API + */ + +#ifndef MAXSUBAUTHS +#define MAXSUBAUTHS 15 /* max sub authorities in a SID */ +#endif + +/** + * @brief Windows Security Identifier + * + **/ + +struct wbcDomainSid { + uint8_t sid_rev_num; + uint8_t num_auths; + uint8_t id_auth[6]; + uint32_t sub_auths[MAXSUBAUTHS]; +}; + +/** + * @brief Security Identifier type + **/ + +enum wbcSidType { + WBC_SID_NAME_USE_NONE=0, + WBC_SID_NAME_USER=1, + WBC_SID_NAME_DOM_GRP=2, + WBC_SID_NAME_DOMAIN=3, + WBC_SID_NAME_ALIAS=4, + WBC_SID_NAME_WKN_GRP=5, + WBC_SID_NAME_DELETED=6, + WBC_SID_NAME_INVALID=7, + WBC_SID_NAME_UNKNOWN=8, + WBC_SID_NAME_COMPUTER=9 +}; + +/** + * @brief Domain Information + **/ + +struct wbcDomainInfo { + char *short_name; + char *dns_name; + struct wbcDomainSid sid; + uint32_t flags; +}; + +/* wbcDomainInfo->flags */ + +#define WBC_DOMINFO_NATIVE 0x00000001 +#define WBC_DOMINFO_AD 0x00000002 +#define WBC_DOMINFO_PRIMARY 0x00000004 + +/* + * Memory Management + */ + +void wbcFreeMemory(void*); + + +/* + * Utility functions for dealing with SIDs + */ + +wbcErr wbcSidToString(const struct wbcDomainSid *sid, + char **sid_string); + +wbcErr wbcStringToSid(const char *sid_string, + struct wbcDomainSid *sid); + +wbcErr wbcPing(void); + +/* + * Name/SID conversion + */ + +wbcErr wbcLookupName(const char *dom_name, + const char *name, + struct wbcDomainSid *sid, + enum wbcSidType *name_type); + +wbcErr wbcLookupSid(const struct wbcDomainSid *sid, + char **domain, + char **name, + enum wbcSidType *name_type); + +wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, + int num_rids, + uint32_t *rids, + const char **domain_name, + const char ***names, + enum wbcSidType **types); + +/* + * SID/uid/gid Mappings + */ + +wbcErr wbcSidToUid(const struct wbcDomainSid *sid, + uid_t *puid); + +wbcErr wbcUidToSid(uid_t uid, + struct wbcDomainSid *sid); + +wbcErr wbcSidToGid(const struct wbcDomainSid *sid, + gid_t *pgid); + +wbcErr wbcGidToSid(gid_t gid, + struct wbcDomainSid *sid); + +wbcErr wbcAllocateUid(uid_t *puid); + +wbcErr wbcAllocateGid(uid_t *pgid); + +/* + * NSS Lookup User/Group details + */ + +wbcErr wbcGetpwnam(const char *name, struct passwd **pwd); + +wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd); + +wbcErr wbcGetgrnam(const char *name, struct group **grp); + +wbcErr wbcGetgrgid(gid_t gid, struct group **grp); + +wbcErr wbcSetpwent(void); + +wbcErr wbcEndpwent(void); + +wbcErr wbcGetpwent(struct passwd **pwd); + +wbcErr wbcSetgrent(void); + +wbcErr wbcEndgrent(void); + +wbcErr wbcGetgrent(struct group **grp); + + +/* + * Lookup Domain information + */ + +wbcErr wbcDomainInfo(const char *domain, + struct wbcDomainInfo **info); + +wbcErr wbcDomainSequenceNumbers(void); + +/* + * Athenticate functions + */ + +wbcErr wbcAuthenticateUser(const char *username, + const char *password); + + +#endif /* _WBCLIENT_H */ diff --git a/source3/nsswitch/libwbclient/wbclient_internal.h b/source3/nsswitch/libwbclient/wbclient_internal.h new file mode 100644 index 0000000000..fc03c5409b --- /dev/null +++ b/source3/nsswitch/libwbclient/wbclient_internal.h @@ -0,0 +1,32 @@ +/* + Unix SMB/CIFS implementation. + + Winbind client API + + Copyright (C) Gerald (Jerry) Carter 2007 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . +*/ + +#ifndef _WBCLIENT_INTERNAL_H +#define _WBCLIENT_INTERNAL_H + +/* Private functions */ + +wbcErr wbcRequestResponse(int cmd, + struct winbindd_request *request, + struct winbindd_response *response); + + +#endif /* _WBCLIENT_INTERNAL_H */ diff --git a/source3/script/mkproto.awk b/source3/script/mkproto.awk index ff266321ff..e9839fe498 100644 --- a/source3/script/mkproto.awk +++ b/source3/script/mkproto.awk @@ -151,7 +151,7 @@ END { gotstart = 1; } - if( $0 ~ /^NODE_STATUS_STRUCT|^SMB_STRUCT_DIR|^ELOG_TDB|^codepoint_t|^_PUBLIC_/ ) { + if( $0 ~ /^NODE_STATUS_STRUCT|^SMB_STRUCT_DIR|^ELOG_TDB|^codepoint_t|^_PUBLIC_|^wbcErr/ ) { gotstart = 1; } -- cgit From 59ce7650f24eb7c35b8d3ee9f830711a4af8f8e9 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Fri, 21 Dec 2007 11:59:56 -0600 Subject: De-couple smbd from staticly linking against winbindd client files. Implements a wrapper layer in winbind_util.c which are just stubs if compiled --without-winbind. When building with winbindd, it is now required to build the libwbclient DSO first (in the Makefile) and then either set LD_LIBRARY_PATH or /etc/ld.so.conf to pick up the library PATH. (This used to be commit 42787bccff4fcffafc7aae6a678e792604ecaaa5) --- source3/auth/auth_util.c | 6 +- source3/include/includes.h | 1 + source3/lib/winbind_util.c | 325 +++++++++++++++++++++++++++++ source3/nsswitch/wb_client.c | 472 +------------------------------------------ source3/nsswitch/wbinfo.c | 138 ++++++------- 5 files changed, 393 insertions(+), 549 deletions(-) create mode 100644 source3/lib/winbind_util.c diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 1e33869ea9..373a2a375f 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -1731,17 +1731,17 @@ bool is_trusted_domain(const char* dom_name) return True; } else { - NSS_STATUS result; + wbcErr result; /* If winbind is around, ask it */ result = wb_is_trusted_domain(dom_name); - if (result == NSS_STATUS_SUCCESS) { + if (result == WBC_ERR_SUCCESS) { return True; } - if (result == NSS_STATUS_NOTFOUND) { + if (result == WBC_ERR_DOMAIN_NOT_FOUND) { /* winbind could not find the domain */ return False; } diff --git a/source3/include/includes.h b/source3/include/includes.h index fdeff346e5..14ef2258e6 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -784,6 +784,7 @@ enum flush_reason_enum { NUM_FLUSH_REASONS}; #include "nss_info.h" +#include "nsswitch/libwbclient/wbclient.h" /* generated rpc server implementation functions */ #include "librpc/gen_ndr/srv_echo.h" diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c new file mode 100644 index 0000000000..4983b9ced0 --- /dev/null +++ b/source3/lib/winbind_util.c @@ -0,0 +1,325 @@ +/* + Unix SMB/CIFS implementation. + Winbind Utility functions + + Copyright (C) Gerald (Jerry) Carter 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" + +#if defined(WITH_WINBIND) + +#include "nsswitch/libwbclient/wbclient.h" + +/* Call winbindd to convert a name to a sid */ + +bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, + enum lsa_SidType *name_type) +{ + struct wbcDomainSid dom_sid; + wbcErr result; + enum wbcSidType type; + + result = wbcLookupName(dom_name, name, &dom_sid, &type); + if (result != WBC_ERR_SUCCESS) + return False; + + memcpy(sid, &dom_sid, sizeof(DOM_SID)); + *name_type = (enum lsa_SidType)type; + + return True; +} + +/* Call winbindd to convert sid to name */ + +bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + const char **domain, const char **name, + enum lsa_SidType *name_type) +{ + struct wbcDomainSid dom_sid; + wbcErr result; + enum wbcSidType type; + char *domain_name = NULL; + char *account_name = NULL; + + memcpy(&dom_sid, sid, sizeof(dom_sid)); + + result = wbcLookupSid(&dom_sid, &domain_name, &account_name, &type); + if (result != WBC_ERR_SUCCESS) + return False; + + /* Copy out result */ + + if (domain) { + *domain = talloc_strdup(mem_ctx, domain_name); + } + if (name) { + *name = talloc_strdup(mem_ctx, account_name); + } + *name_type = (enum lsa_SidType)type; + + DEBUG(10, ("winbind_lookup_sid: SUCCESS: SID %s -> %s %s\n", + sid_string_dbg(sid), domain_name, account_name)); + + SAFE_FREE(domain_name); + SAFE_FREE(account_name); + + if ((domain && !*domain) || (name && !*name)) { + DEBUG(0,("winbind_lookup_sid: talloc() failed!\n")); + return False; + } + + + return True; +} + +/* Ping winbindd to see it is alive */ + +bool winbind_ping(void) +{ + wbcErr result = wbcPing(); + + return (result == WBC_ERR_SUCCESS); +} + +/* Call winbindd to convert SID to uid */ + +bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid) +{ + struct wbcDomainSid dom_sid; + wbcErr result; + + memcpy(&dom_sid, sid, sizeof(dom_sid)); + + result = wbcSidToUid(&dom_sid, puid); + if (result != WBC_ERR_SUCCESS) + return False; + + return (result == WBC_ERR_SUCCESS); +} + +/* Call winbindd to convert uid to sid */ + +bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid) +{ + struct wbcDomainSid dom_sid; + wbcErr result; + + result = wbcUidToSid(uid, &dom_sid); + if (result == WBC_ERR_SUCCESS) { + memcpy(sid, &dom_sid, sizeof(DOM_SID)); + } else { + sid_copy(sid, &global_sid_NULL); + } + + return (result == WBC_ERR_SUCCESS); +} + +/* Call winbindd to convert SID to gid */ + +bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid) +{ + struct wbcDomainSid dom_sid; + wbcErr result; + + memcpy(&dom_sid, sid, sizeof(dom_sid)); + + result = wbcSidToGid(&dom_sid, pgid); + if (result != WBC_ERR_SUCCESS) + return False; + + return (result == WBC_ERR_SUCCESS); +} + +/* Call winbindd to convert gid to sid */ + +bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid) +{ + struct wbcDomainSid dom_sid; + wbcErr result; + + result = wbcGidToSid(gid, &dom_sid); + if (result == WBC_ERR_SUCCESS) { + memcpy(sid, &dom_sid, sizeof(DOM_SID)); + } else { + sid_copy(sid, &global_sid_NULL); + } + + return (result == WBC_ERR_SUCCESS); +} + +/* Check for a trusted domain */ + +wbcErr wb_is_trusted_domain(const char *domain) +{ + wbcErr result; + struct wbcDomainInfo info; + + result = wbcDomainInfo(domain, &info); + + if (result == WBC_ERR_SUCCESS) { + SAFE_FREE(info.short_name); + SAFE_FREE(info.dns_name); + } + + return result; +} + +/* Lookup a set of rids in a given domain */ + +bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + int num_rids, uint32 *rids, + const char **domain_name, + const char ***names, enum lsa_SidType **types) +{ + const char *dom_name = NULL; + const char **namelist = NULL; + enum wbcSidType *name_types = NULL; + struct wbcDomainSid dom_sid; + wbcErr ret; + int i; + + memcpy(&dom_sid, domain_sid, sizeof(struct wbcDomainSid)); + + ret = wbcLookupRids(&dom_sid, num_rids, rids, + &dom_name, &namelist, &name_types); + if (ret != WBC_ERR_SUCCESS) + return False; + + *domain_name = talloc_strdup(mem_ctx, dom_name); + *names = TALLOC_ARRAY(mem_ctx, const char*, num_rids); + *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); + + for(i=0; i %s %s\n", - sid_string_dbg(sid), response.data.name.dom_name, - response.data.name.name)); - return True; -} - -bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, - const DOM_SID *domain_sid, - int num_rids, uint32 *rids, - const char **domain_name, - const char ***names, enum lsa_SidType **types) -{ - size_t i, buflen; - ssize_t len; - char *ridlist; - char *p; - struct winbindd_request request; - struct winbindd_response response; - NSS_STATUS result; - - if (num_rids == 0) { - return False; - } - - /* Initialise request */ - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - sid_to_fstring(request.data.sid, domain_sid); - - len = 0; - buflen = 0; - ridlist = NULL; - - for (i=0; ishort_name); - return winbind_domain; + wbcFreeMemory(dinfo); + return winbind_domain; } /* Copy of parse_domain_user from winbindd_util.c. Parse a string of the @@ -128,61 +130,47 @@ static bool parse_wbinfo_domain_user(const char *domuser, fstring domain, static bool wbinfo_get_userinfo(char *user) { - struct winbindd_request request; - struct winbindd_response response; - NSS_STATUS result; - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - /* Send request */ - - fstrcpy(request.data.username, user); + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct passwd *pwd = NULL; - result = winbindd_request_response(WINBINDD_GETPWNAM, &request, &response); - - if (result != NSS_STATUS_SUCCESS) - return False; + wbc_status = wbcGetpwnam(user, &pwd); + if (!WBC_ERROR_IS_OK(wbc_status)) { + return false; + } - d_printf( "%s:%s:%d:%d:%s:%s:%s\n", - response.data.pw.pw_name, - response.data.pw.pw_passwd, - response.data.pw.pw_uid, - response.data.pw.pw_gid, - response.data.pw.pw_gecos, - response.data.pw.pw_dir, - response.data.pw.pw_shell ); + d_printf("%s:%s:%d:%d:%s:%s:%s\n", + pwd->pw_name, + pwd->pw_passwd, + pwd->pw_uid, + pwd->pw_gid, + pwd->pw_gecos, + pwd->pw_dir, + pwd->pw_shell); - return True; + return true; } /* pull pwent info for a given uid */ static bool wbinfo_get_uidinfo(int uid) { - struct winbindd_request request; - struct winbindd_response response; - NSS_STATUS result; - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - request.data.uid = uid; - - result = winbindd_request_response(WINBINDD_GETPWUID, &request, &response); + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + struct passwd *pwd = NULL; - if (result != NSS_STATUS_SUCCESS) - return False; - - d_printf( "%s:%s:%d:%d:%s:%s:%s\n", - response.data.pw.pw_name, - response.data.pw.pw_passwd, - response.data.pw.pw_uid, - response.data.pw.pw_gid, - response.data.pw.pw_gecos, - response.data.pw.pw_dir, - response.data.pw.pw_shell ); - - return True; + wbc_status = wbcGetpwuid(uid, &pwd); + if (!WBC_ERROR_IS_OK(wbc_status)) { + return false; + } + + d_printf("%s:%s:%d:%d:%s:%s:%s\n", + pwd->pw_name, + pwd->pw_passwd, + pwd->pw_uid, + pwd->pw_gid, + pwd->pw_gecos, + pwd->pw_dir, + pwd->pw_shell); + + return true; } /* pull grent for a given group */ @@ -874,40 +862,40 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags) static bool wbinfo_auth(char *username) { - struct winbindd_request request; - struct winbindd_response response; - NSS_STATUS result; - char *p; - - /* Send off request */ - - ZERO_STRUCT(request); - ZERO_STRUCT(response); - - p = strchr(username, '%'); + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + char *s = NULL; + char *p = NULL; + char *password = NULL; + char *name = NULL; + + if ((s = SMB_STRDUP(username)) == NULL) { + return false; + } - if (p) { + if ((p = strchr(s, '%')) != NULL) { *p = 0; - fstrcpy(request.data.auth.user, username); - fstrcpy(request.data.auth.pass, p + 1); - *p = '%'; - } else - fstrcpy(request.data.auth.user, username); + p++; + } - result = winbindd_request_response(WINBINDD_PAM_AUTH, &request, &response); + name = s; + password = p; - /* Display response */ + wbc_status = wbcAuthenticateUser(name, password); d_printf("plaintext password authentication %s\n", - (result == NSS_STATUS_SUCCESS) ? "succeeded" : "failed"); + WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed"); +#if 0 if (response.data.auth.nt_status) d_fprintf(stderr, "error code was %s (0x%x)\nerror messsage was: %s\n", response.data.auth.nt_status_string, response.data.auth.nt_status, response.data.auth.error_string); +#endif - return result == NSS_STATUS_SUCCESS; + SAFE_FREE(s); + + return WBC_ERROR_IS_OK(wbc_status); } /* Authenticate a user with a challenge/response */ -- cgit From 387288e9501cd211500b1c5cf1bc0a339017a4a4 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Fri, 21 Dec 2007 13:47:45 -0600 Subject: Compile fix: Correct use of wbcDomainInfo() after function signature change. Also fixes a doxygen warngin about an undocumented parameter in the same function. (This used to be commit 290ab64e9e5fb2a28e14a5f344f22119d5304563) --- source3/lib/winbind_util.c | 7 +++---- source3/nsswitch/libwbclient/wbc_util.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 4983b9ced0..f4e7ab19e8 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -166,13 +166,12 @@ bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid) wbcErr wb_is_trusted_domain(const char *domain) { wbcErr result; - struct wbcDomainInfo info; + struct wbcDomainInfo *info = NULL; result = wbcDomainInfo(domain, &info); - if (result == WBC_ERR_SUCCESS) { - SAFE_FREE(info.short_name); - SAFE_FREE(info.dns_name); + if (WBC_ERROR_IS_OK(result)) { + wbcFreeMemory(info); } return result; diff --git a/source3/nsswitch/libwbclient/wbc_util.c b/source3/nsswitch/libwbclient/wbc_util.c index 2d7cc7bcbd..b0adaad318 100644 --- a/source3/nsswitch/libwbclient/wbc_util.c +++ b/source3/nsswitch/libwbclient/wbc_util.c @@ -39,7 +39,7 @@ wbcErr wbcPing(void) /** @brief Lookup the current status of a trusted domain * * @param domain Domain to query - * @param *info Pointer to returned domain_info struct + * @param *dinfo Pointer to returned domain_info struct * * @return #wbcErr * -- cgit From 98b21126a76991a011ccbfd9553e653ea6304cec Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Fri, 21 Dec 2007 13:50:13 -0600 Subject: Fix "make test" using the LD_LIBRARY_PATH for selftest script so smbd can locate the libwbclient library (if neccessary). (This used to be commit 481cc9ab6a6608e13710c93783ea4e62363e78be) --- source3/Makefile.in | 5 +++-- source3/script/tests/selftest.sh | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index f98672f246..5c41a5b66c 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1331,11 +1331,11 @@ bin/nsstest@EXEEXT@: $(BINARY_PREREQS) $(NSSTEST_OBJ) @BUILD_POPT@ bin/pdbtest@EXEEXT@: $(BINARY_PREREQS) $(PDBTEST_OBJ) @BUILD_POPT@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(PDBTEST_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(LIBS) @POPTLIBS@ + @$(CC) $(FLAGS) -o $@ $(PDBTEST_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) $(LIBS) @POPTLIBS@ @LIBWBCLIENT_SHARED@ bin/vfstest@EXEEXT@: $(BINARY_PREREQS) $(VFSTEST_OBJ) @BUILD_POPT@ @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) $(ACL_LIBS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) @SMBD_LIBS@ $(NSCD_LIBS) + @$(CC) $(FLAGS) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) $(ACL_LIBS) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) @SMBD_LIBS@ $(NSCD_LIBS) @LIBWBCLIENT_SHARED@ bin/smbiconv@EXEEXT@: $(BINARY_PREREQS) $(SMBICONV_OBJ) @BUILD_POPT@ @echo Linking $@ @@ -1396,6 +1396,7 @@ bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) @echo Linking shared library $@ @$(SHLD_DSO) $(LIBWBCLIENT_OBJ) \ @SONAMEFLAG@`basename $@`.$(SONAME_VER) + @ln -s `basename $@` $@.$(SONAME_VER) bin/libwbclient.a: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) @echo Linking non-shared library $@ diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index 2250a81245..0ad0639cb9 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -70,6 +70,10 @@ export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR PATH=bin:$PATH export PATH +LD_LIBRARY_PATH=$BINDIR +echo "LD_LIBRRARY_PATH=$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH + ## ## verify that we were built with --enable-socket-wrapper ## -- cgit From b3e50fecbc5a3b510a43d739c036469460201c1a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Dec 2007 12:06:37 -0800 Subject: Fix making the new proto file after a distclean. Jeremy. (This used to be commit 35a450b59501c6545083efc9f913cb626188f329) --- source3/Makefile.in | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/Makefile.in b/source3/Makefile.in index 5c41a5b66c..7ca5123aff 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -2005,6 +2005,7 @@ clean: delheaders # afterwards. proto_exists: include/proto.h include/build_env.h \ winbindd/winbindd_proto.h web/swat_proto.h \ + libnet/libnet_proto.h \ client/client_proto.h utils/net_proto.h utils/ntlm_auth_proto.h smbd/build_options.c @touch proto_exists -- cgit From 0c3f431abaf2f33e11f74cbc868b5e1da255bfff Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Dec 2007 12:11:23 -0800 Subject: Fix initialization warnings. Jeremy. (This used to be commit 832c093830cb3978641be3d87670fa900105da25) --- source3/lib/socket_wrapper/socket_wrapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/socket_wrapper/socket_wrapper.c b/source3/lib/socket_wrapper/socket_wrapper.c index a84c460114..5b8052e5ed 100644 --- a/source3/lib/socket_wrapper/socket_wrapper.c +++ b/source3/lib/socket_wrapper/socket_wrapper.c @@ -572,7 +572,7 @@ static const char *socket_wrapper_pcap_file(void) static int initialized = 0; static const char *s = NULL; static const struct swrap_file_hdr h = { 0, }; - static const struct swrap_packet p = { 0, }; + static const struct swrap_packet p = { { 0, }, { { 0, }, { { 0, } } } }; if (initialized == 1) { return s; -- cgit From e0a054ded334ce5ddeafdfbbdf1ee99e526386f5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Dec 2007 12:18:17 -0800 Subject: Fix const warning. Jeremy. (This used to be commit 5159f897ddaad1878fff629cc074dd71b2b3f4ab) --- source3/nsswitch/libwbclient/wbc_sid.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source3/nsswitch/libwbclient/wbc_sid.c b/source3/nsswitch/libwbclient/wbc_sid.c index 5e7cb9a61b..c877e1d9d4 100644 --- a/source3/nsswitch/libwbclient/wbc_sid.c +++ b/source3/nsswitch/libwbclient/wbc_sid.c @@ -298,7 +298,7 @@ wbcErr wbcLookupSid(const struct wbcDomainSid *sid, wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, int num_rids, uint32_t *rids, - const char **domain_name, + const char **pp_domain_name, const char ***names, enum wbcSidType **types) { @@ -308,6 +308,7 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, struct winbindd_request request; struct winbindd_response response; char *sid_string = NULL; + char *domain_name = NULL; wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; if (!dom_sid || (num_rids == 0)) { @@ -357,8 +358,8 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, &response); free(ridlist); - *domain_name = strdup(response.data.domain_name); - BAIL_ON_PTR_ERROR((*domain_name), wbc_status); + domain_name = strdup(response.data.domain_name); + BAIL_ON_PTR_ERROR(domain_name, wbc_status); *names = (const char**)malloc(sizeof(char*) * num_rids); BAIL_ON_PTR_ERROR((*names), wbc_status); @@ -408,12 +409,14 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, done: if (!WBC_ERROR_IS_OK(wbc_status)) { - if (*domain_name) - free(*domain_name); + if (domain_name) + free(domain_name); if (*names) free(*names); if (*types) free(*types); + } else { + *pp_domain_name = domain_name; } return wbc_status; -- cgit From 6f970837d025e56e1e033e7922d6d5d1539a97eb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Dec 2007 12:18:35 -0800 Subject: Fix build failure if symlink already exists. Jeremy. (This used to be commit b8310f427277640c7b2526d0c5cd84deecfd3e99) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 7ca5123aff..e1f516f891 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1396,7 +1396,7 @@ bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) @echo Linking shared library $@ @$(SHLD_DSO) $(LIBWBCLIENT_OBJ) \ @SONAMEFLAG@`basename $@`.$(SONAME_VER) - @ln -s `basename $@` $@.$(SONAME_VER) + @ln -s -f `basename $@` $@.$(SONAME_VER) bin/libwbclient.a: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) @echo Linking non-shared library $@ -- cgit From 26e36db607caef8d7432d80322377c20911912ef Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 21:25:39 +0100 Subject: Make sure libnet/libnet_proto.h exists. Guenther (This used to be commit d6703f6d4e6a5256980188f6a840e6aaf07bc607) --- source3/Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index f2b0bc633e..b0b5c7cb1a 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1951,7 +1951,8 @@ clean: delheaders # afterwards. proto_exists: include/proto.h include/build_env.h \ winbindd/winbindd_proto.h web/swat_proto.h \ - client/client_proto.h utils/net_proto.h utils/ntlm_auth_proto.h smbd/build_options.c + client/client_proto.h utils/net_proto.h utils/ntlm_auth_proto.h smbd/build_options.c \ + libnet/libnet_proto.h @touch proto_exists delheaders: -- cgit From b775fe0a170f9b6043aaea2c025fd70528c7e7e8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Dec 2007 12:50:39 -0800 Subject: Actually fix the merge. Jeremy. (This used to be commit c855de0c05e2e271e2610de67a6d7e3aba52390f) --- source3/Makefile.in | 5 ----- 1 file changed, 5 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 42bea8bfbc..e1f516f891 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -2005,13 +2005,8 @@ clean: delheaders # afterwards. proto_exists: include/proto.h include/build_env.h \ winbindd/winbindd_proto.h web/swat_proto.h \ -<<<<<<< HEAD:source/Makefile.in libnet/libnet_proto.h \ client/client_proto.h utils/net_proto.h utils/ntlm_auth_proto.h smbd/build_options.c -======= - client/client_proto.h utils/net_proto.h utils/ntlm_auth_proto.h smbd/build_options.c \ - libnet/libnet_proto.h ->>>>>>> d6703f6d4e6a5256980188f6a840e6aaf07bc607:source/Makefile.in @touch proto_exists delheaders: -- cgit From f2ebf076a41cf96b0367049ee979d5b98052b3db Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 22:05:17 +0100 Subject: Generate pkgconfig files for at least lib{smbclient,smbsharemodes,netapi}. Guenther (This used to be commit ad87786c91709d62ee2cbd02c87e59b855e050cc) --- source3/configure.in | 1 + source3/library-versions.in | 3 +-- source3/pkgconfig/netapi.pc.in | 14 ++++++++++++++ source3/pkgconfig/smbclient.pc.in | 14 ++++++++++++++ source3/pkgconfig/smbsharemodes.pc.in | 14 ++++++++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 source3/pkgconfig/netapi.pc.in create mode 100644 source3/pkgconfig/smbclient.pc.in create mode 100644 source3/pkgconfig/smbsharemodes.pc.in diff --git a/source3/configure.in b/source3/configure.in index a9053d9a08..04891ae4be 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -6606,6 +6606,7 @@ AC_SUBST(SMBD_LIBS) AC_OUTPUT(Makefile library-versions script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh lib/netapi/examples/Makefile + pkgconfig/smbclient.pc pkgconfig/netapi.pc pkgconfig/smbsharemodes.pc ) ################################################# diff --git a/source3/library-versions.in b/source3/library-versions.in index cd4d621dd5..9c10da525f 100644 --- a/source3/library-versions.in +++ b/source3/library-versions.in @@ -5,5 +5,4 @@ bin/libsmbclient.@SHLIBEXT@:0:1 bin/libsmbsharemodes.@SHLIBEXT@:0:2 bin/libaddns.@SHLIBEXT@:0:1 -bin/libmsrpc.@SHLIBEXT@:0:1 - +bin/libnetapi.@SHLIBEXT@:0:1 diff --git a/source3/pkgconfig/netapi.pc.in b/source3/pkgconfig/netapi.pc.in new file mode 100644 index 0000000000..b1f60b240e --- /dev/null +++ b/source3/pkgconfig/netapi.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Samba libnetapi +Description: A library to control CIFS servers +Version: 0 +URL: http://www.samba.org/ +#Libs: -L@libdir@ -lnetapi +Libs: -lnetapi +Libs.private: -lnetapi @KRB5_LIBS@ @LDAP_LIBS@ @LIBS@ +Cflags: -I@includedir@ + diff --git a/source3/pkgconfig/smbclient.pc.in b/source3/pkgconfig/smbclient.pc.in new file mode 100644 index 0000000000..969abbe1ff --- /dev/null +++ b/source3/pkgconfig/smbclient.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Samba libsmbclient +Description: A library to access CIFS servers +Version: 0 +URL: http://www.samba.org/ +#Libs: -L@libdir@ -lsmbclient +Libs: -lsmbclient +Libs.private: -lsmbclient @KRB5_LIBS@ @LDAP_LIBS@ @LIBS@ +Cflags: -I@includedir@ + diff --git a/source3/pkgconfig/smbsharemodes.pc.in b/source3/pkgconfig/smbsharemodes.pc.in new file mode 100644 index 0000000000..dcb0d2eeda --- /dev/null +++ b/source3/pkgconfig/smbsharemodes.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Samba libsmbsharemodes +Description: A library +Version: 0 +URL: http://www.samba.org/ +#Libs: -L@libdir@ -lsmbsharemodes +Libs: -lsmbsharemodes +Libs.private: -lsmbsharemodes @KRB5_LIBS@ @LDAP_LIBS@ @LIBS@ +Cflags: -I@includedir@ + -- cgit From 9df2075170769bcbdb0290eec5ea98d922cfb823 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Dec 2007 13:42:47 -0800 Subject: Fix make test by adding winbind libs to vlp. Jeremy. (This used to be commit abba6717b5da709ae9cf3097042228ddbe630cca) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index e1f516f891..74bae8928e 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1534,7 +1534,7 @@ bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ @LIBWBCLIEN bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @echo "Linking $@" @$(CC) $(FLAGS) -o $@ $(VLP_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \ - $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) + $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @LIBWBCLIENT_SHARED@ @WINBIND_NSS@: $(BINARY_PREREQS) $(WINBIND_NSS_OBJ) @echo "Linking $@" -- cgit From 3f5d5bc300cc3061bc7066b8b48b68b2b5d55c5d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 21 Dec 2007 23:04:26 +0100 Subject: Until we better understand the WKSSVC_JOIN_FLAGS_JOIN_DC_ACCOUNT make sure we are not joining as a DC. Guenther (This used to be commit bf3ffbb5d2e8588e0041f0b890b590c58f8fcecf) --- source3/libnet/libnet_join.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index b1ebed3e15..c1ff8bb052 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -530,6 +530,10 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, return WERR_NOT_SUPPORTED; } + if (IS_DC) { + return WERR_SETUP_DOMAIN_CONTROLLER; + } + if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { status = do_DomainJoin(mem_ctx, r); -- cgit From 2fc5eb7916166e955a29906e39ba8f49b3f87376 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Dec 2007 14:38:52 -0800 Subject: Fix install - it was trying to install libnetapi.h whereas the actual file is netapi.h. Guenther please check which name this should be ! Jeremy. (This used to be commit 035fadaa596e893b7eeac09bc587ad3b73f77d0b) --- source3/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 74bae8928e..3f7c857fc3 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1888,7 +1888,7 @@ installlibnetapi: installdirs libnetapi @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) -$(INSTALLLIBCMD_SH) bin/libnetapi.@SHLIBEXT@ $(DESTDIR)$(LIBDIR) -$(INSTALLLIBCMD_A) bin/libnetapi.a $(DESTDIR)$(LIBDIR) - -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/libnetapi.h $(DESTDIR)${prefix}/include + -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/lib/netapi/netapi.h $(DESTDIR)${prefix}/include installpammodules: $(PAM_MODULES) @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(PAMMODULESDIR) @@ -1977,7 +1977,7 @@ uninstalllibaddns: uninstalllibnetapi: -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libnetapi.@SHLIBEXT@ -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libnetapi.a - -rm -f $(DESTDIR)${prefix}/include/libnetapi.h + -rm -f $(DESTDIR)${prefix}/include/netapi.h uninstallpammodules: @for module in $(PAM_MODULES); do \ -- cgit From 86dfb55ffb99abf6fc61a91e58477790395abe38 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 22 Dec 2007 00:02:45 +0100 Subject: Correct netapi header filename. Thanks Jeremy. Guenther (This used to be commit f192737ec8140aa6570bfb49a165b31890d63b16) --- source3/lib/netapi/examples/getdc/getdc.c | 2 +- source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c | 2 +- source3/lib/netapi/examples/netdomjoin/netdomjoin.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/lib/netapi/examples/getdc/getdc.c b/source3/lib/netapi/examples/getdc/getdc.c index ed6a8bd05d..4f5c5332d5 100644 --- a/source3/lib/netapi/examples/getdc/getdc.c +++ b/source3/lib/netapi/examples/getdc/getdc.c @@ -23,7 +23,7 @@ #include #include -#include +#include int main(int argc, char **argv) { diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index 8ca6897cab..beb12be8b1 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -28,7 +28,7 @@ #include #include -#include +#include #define MAX_CRED_LEN 256 #define MAX_NETBIOS_NAME_LEN 15 diff --git a/source3/lib/netapi/examples/netdomjoin/netdomjoin.c b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c index a2bb700250..e8b529927f 100644 --- a/source3/lib/netapi/examples/netdomjoin/netdomjoin.c +++ b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c @@ -23,7 +23,7 @@ #include #include -#include +#include char *get_string_param(const char *param) { -- cgit From 30a788bd2027648de1a1bc0922f40c1c00b727bd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 22 Dec 2007 00:12:59 +0100 Subject: Fix uninitialized error code in do_unjoin_modify_vals_config(). Guenther (This used to be commit c890ebc3cad7222007e62227ec1f28d978310cbf) --- source3/libnet/libnet_join.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index c1ff8bb052..2994c3f59d 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -390,7 +390,7 @@ static WERROR do_unjoin_modify_vals_config(TALLOC_CTX *mem_ctx, struct libnet_UnjoinCtx *r, struct registry_key *key) { - WERROR werr; + WERROR werr = WERR_OK; if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { -- cgit From 9fc2c21fa682073ce3144990f64fd81c83d60e4e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 22 Dec 2007 00:34:30 +0100 Subject: Fix net_dom_join & net_dom_unjoin. Guenther (This used to be commit 6dd17e4840ee6c4bf0df3c3f76f9b232b3674d55) --- source3/utils/net_dom.c | 57 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/source3/utils/net_dom.c b/source3/utils/net_dom.c index 7b5f562727..3a8338ec70 100644 --- a/source3/utils/net_dom.c +++ b/source3/utils/net_dom.c @@ -43,6 +43,7 @@ int net_help_dom(int argc, const char **argv) static int net_dom_unjoin(int argc, const char **argv) { + struct libnetapi_ctx *ctx = NULL; const char *server_name = NULL; const char *account = NULL; const char *password = NULL; @@ -50,8 +51,8 @@ static int net_dom_unjoin(int argc, const char **argv) WKSSVC_JOIN_FLAGS_JOIN_TYPE; struct cli_state *cli = NULL; bool reboot = false; - NTSTATUS status; - NET_API_STATUS werr; + NTSTATUS ntstatus; + NET_API_STATUS status; int ret = -1; int i; @@ -82,17 +83,25 @@ static int net_dom_unjoin(int argc, const char **argv) } if (reboot) { - status = net_make_ipc_connection_ex(opt_workgroup, server_name, - NULL, 0, &cli); - if (!NT_STATUS_IS_OK(status)) { + ntstatus = net_make_ipc_connection_ex(opt_workgroup, server_name, + NULL, 0, &cli); + if (!NT_STATUS_IS_OK(ntstatus)) { return -1; } } - werr = NetUnjoinDomain(server_name, account, password, unjoin_flags); - if (werr != 0) { + status = libnetapi_init(&ctx); + if (status != 0) { + return -1; + } + + libnetapi_set_username(ctx, opt_user_name); + libnetapi_set_password(ctx, opt_password); + + status = NetUnjoinDomain(server_name, account, password, unjoin_flags); + if (status != 0) { printf("Failed to unjoin domain: %s\n", - get_friendly_nt_error_msg(werror_to_ntstatus(W_ERROR(werr)))); + libnetapi_errstr(ctx, status)); goto done; } @@ -121,11 +130,13 @@ static int net_dom_unjoin(int argc, const char **argv) cli_shutdown(cli); } + /* libnetapi_free(ctx); */ return ret; } static int net_dom_join(int argc, const char **argv) { + struct libnetapi_ctx *ctx = NULL; const char *server_name = NULL; const char *domain_name = NULL; const char *account_ou = NULL; @@ -135,8 +146,8 @@ static int net_dom_join(int argc, const char **argv) WKSSVC_JOIN_FLAGS_JOIN_TYPE; struct cli_state *cli = NULL; bool reboot = false; - NTSTATUS status; - NET_API_STATUS werr; + NTSTATUS ntstatus; + NET_API_STATUS status; int ret = -1; int i; @@ -183,21 +194,28 @@ static int net_dom_join(int argc, const char **argv) } if (reboot) { - status = net_make_ipc_connection_ex(opt_workgroup, server_name, - NULL, 0, &cli); - if (!NT_STATUS_IS_OK(status)) { + ntstatus = net_make_ipc_connection_ex(opt_workgroup, server_name, + NULL, 0, &cli); + if (!NT_STATUS_IS_OK(ntstatus)) { return -1; } } /* check if domain is a domain or a workgroup */ - werr = NetJoinDomain(server_name, domain_name, account_ou, - Account, password, join_flags); - if (werr != 0) { - printf("Failed to join domain: %s (WERROR: %s)\n", - get_friendly_nt_error_msg(werror_to_ntstatus(W_ERROR(werr))), - dos_errstr(W_ERROR(werr))); + status = libnetapi_init(&ctx); + if (status != 0) { + return -1; + } + + libnetapi_set_username(ctx, opt_user_name); + libnetapi_set_password(ctx, opt_password); + + status = NetJoinDomain(server_name, domain_name, account_ou, + Account, password, join_flags); + if (status != 0) { + printf("Failed to join domain: %s\n", + libnetapi_errstr(ctx, status)); goto done; } @@ -226,6 +244,7 @@ static int net_dom_join(int argc, const char **argv) cli_shutdown(cli); } + /* libnetapi_free(ctx); */ return ret; } -- cgit From f4db66eba109cc4540b25381f1b801442a7e97a7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 22 Dec 2007 01:13:53 +0100 Subject: Fix the build of cifs.spnego. Guenther (This used to be commit b4a4a2b2933d693876b67231f747e1e232936054) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 3f7c857fc3..d3b990e94a 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1236,7 +1236,7 @@ bin/umount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ) @BUILD_POPT@ bin/cifs.spnego@EXEEXT@: $(BINARY_PREREQS) $(CIFS_SPNEGO_OBJ) $(LIBSMBCLIENT_OBJ) @BUILD_POPT@ @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(CIFS_SPNEGO_OBJ) $(DYNEXP) $(LDFLAGS) -lkeyutils $(LIBS) \ - $(LIBSMBCLIENT_OBJ) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@ + $(LIBSMBCLIENT_OBJ) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@ @LIBWBCLIENT_SHARED@ bin/testparm@EXEEXT@: $(BINARY_PREREQS) $(TESTPARM_OBJ) @BUILD_POPT@ @echo Linking $@ -- cgit From 98bc591c4fac3a26796c596b55b735739d96c76b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Dec 2007 16:43:02 -0800 Subject: Add NT error to debug to try and track this down. Jermey. (This used to be commit a1482b09150f4d292965c77bc73d47fb14f5eb85) --- source3/winbindd/winbindd_group.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c index 140943cc2c..fbd2fee692 100644 --- a/source3/winbindd/winbindd_group.c +++ b/source3/winbindd/winbindd_group.c @@ -1045,7 +1045,10 @@ static bool get_sam_group_entries(struct getent_state *ent) status = domain->methods->enum_local_groups(domain, mem_ctx, &num_entries, &sam_grp_entries); if ( !NT_STATUS_IS_OK(status) ) { - DEBUG(3,("get_sam_group_entries: Failed to enumerate domain local groups!\n")); + DEBUG(3,("get_sam_group_entries: " + "Failed to enumerate " + "domain local groups with error %s!\n", + nt_errstr(status))); num_entries = 0; } else -- cgit From 4773973300d9b4c6d46bdeefd57d200378f6cec3 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 22 Dec 2007 01:49:29 +0100 Subject: Remove redundant connection_struct from fd_close_posix() parameter list. Michael (This used to be commit f3365b74ac016eaee1e82eef769dd618af5df201) --- source3/locking/posix.c | 4 ++-- source3/smbd/open.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/locking/posix.c b/source3/locking/posix.c index aef5c1784f..207ee57ce1 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -607,14 +607,14 @@ static size_t get_posix_pending_close_entries(TALLOC_CTX *mem_ctx, to delete all locks on this fsp before this function is called. ****************************************************************************/ -NTSTATUS fd_close_posix(struct connection_struct *conn, files_struct *fsp) +NTSTATUS fd_close_posix(struct files_struct *fsp) { int saved_errno = 0; int ret; int *fd_array = NULL; size_t count, i; - if (!lp_locking(fsp->conn->params) || !lp_posix_locking(conn->params)) { + if (!lp_locking(fsp->conn->params) || !lp_posix_locking(fsp->conn->params)) { /* * No locking or POSIX to worry about or we want POSIX semantics * which will lose all locks on all fd's open on this dev/inode, diff --git a/source3/smbd/open.c b/source3/smbd/open.c index b83d6844d6..743f040911 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -78,7 +78,7 @@ NTSTATUS fd_close(struct connection_struct *conn, files_struct *fsp) if (fsp->fh->ref_count > 1) { return NT_STATUS_OK; /* Shared handle. Only close last reference. */ } - return fd_close_posix(conn, fsp); + return fd_close_posix(fsp); } /**************************************************************************** -- cgit From e47520f2221ea34a2264a3cc03fe1c5fcc5bf5c5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 22 Dec 2007 02:01:26 +0100 Subject: Remove redundant connection_struct from fd_close() parameter list. Michael (This used to be commit 3611cc8561cf837adea83fc7c16ca7535f188466) --- source3/smbd/close.c | 2 +- source3/smbd/open.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index eb610f7d1a..ff96c99712 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -389,7 +389,7 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_ locking_close_file(smbd_messaging_context(), fsp); - status = fd_close(conn, fsp); + status = fd_close(fsp); /* check for magic scripts */ if (close_type == NORMAL_CLOSE) { diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 743f040911..9428b47b6a 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -70,7 +70,7 @@ static NTSTATUS fd_open(struct connection_struct *conn, Close the file associated with a fsp. ****************************************************************************/ -NTSTATUS fd_close(struct connection_struct *conn, files_struct *fsp) +NTSTATUS fd_close(files_struct *fsp) { if (fsp->fh->fd == -1) { return NT_STATUS_OK; /* What we used to call a stat open. */ @@ -353,7 +353,7 @@ static NTSTATUS open_file(files_struct *fsp, /* For a non-io open, this stat failing means file not found. JRA */ if (ret == -1) { status = map_nt_error_from_unix(errno); - fd_close(conn, fsp); + fd_close(fsp); return status; } } @@ -365,7 +365,7 @@ static NTSTATUS open_file(files_struct *fsp, */ if(S_ISDIR(psbuf->st_mode)) { - fd_close(conn, fsp); + fd_close(fsp); errno = EISDIR; return NT_STATUS_FILE_IS_A_DIRECTORY; } @@ -1688,7 +1688,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, if (lck == NULL) { DEBUG(0, ("open_file_ntcreate: Could not get share " "mode lock for %s\n", fname)); - fd_close(conn, fsp); + fd_close(fsp); file_free(fsp); return NT_STATUS_SHARING_VIOLATION; } @@ -1699,7 +1699,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, oplock_request)) { schedule_defer_open(lck, request_time, req); TALLOC_FREE(lck); - fd_close(conn, fsp); + fd_close(fsp); file_free(fsp); return NT_STATUS_SHARING_VIOLATION; } @@ -1718,7 +1718,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, oplock_request)) { schedule_defer_open(lck, request_time, req); TALLOC_FREE(lck); - fd_close(conn, fsp); + fd_close(fsp); file_free(fsp); return NT_STATUS_SHARING_VIOLATION; } @@ -1727,7 +1727,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, if (!NT_STATUS_IS_OK(status)) { struct deferred_open_record state; - fd_close(conn, fsp); + fd_close(fsp); file_free(fsp); state.delayed_for_oplocks = False; @@ -1768,7 +1768,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, if(ret_flock == -1 ){ TALLOC_FREE(lck); - fd_close(conn, fsp); + fd_close(fsp); file_free(fsp); return NT_STATUS_SHARING_VIOLATION; @@ -1793,7 +1793,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, (SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf)==-1)) { status = map_nt_error_from_unix(errno); TALLOC_FREE(lck); - fd_close(conn,fsp); + fd_close(fsp); file_free(fsp); return status; } @@ -1850,7 +1850,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, /* Remember to delete the mode we just added. */ del_share_mode(lck, fsp); TALLOC_FREE(lck); - fd_close(conn,fsp); + fd_close(fsp); file_free(fsp); return status; } @@ -1974,7 +1974,7 @@ NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname, NTSTATUS close_file_fchmod(files_struct *fsp) { - NTSTATUS status = fd_close(fsp->conn, fsp); + NTSTATUS status = fd_close(fsp); file_free(fsp); return status; } -- cgit From a000fa4ee5491ae32c60881b28b3536e88e82e27 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 22 Dec 2007 02:13:02 +0100 Subject: Remove redundant connection_struct from check_magic() parameter list. Michael (This used to be commit cebaa483e62910ac3f87cd135b2aff18dc880416) --- source3/smbd/close.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index ff96c99712..5d30e467d0 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -27,7 +27,7 @@ extern struct current_user current_user; Run a file if it is a magic script. ****************************************************************************/ -static void check_magic(files_struct *fsp,connection_struct *conn) +static void check_magic(struct files_struct *fsp) { int ret; const char *magic_output = NULL; @@ -35,6 +35,7 @@ static void check_magic(files_struct *fsp,connection_struct *conn) int tmp_fd, outfd; TALLOC_CTX *ctx = NULL; const char *p; + struct connection_struct *conn = fsp->conn; if (!*lp_magicscript(SNUM(conn))) { return; @@ -393,7 +394,7 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_ /* check for magic scripts */ if (close_type == NORMAL_CLOSE) { - check_magic(fsp,conn); + check_magic(fsp); } /* -- cgit From 1176e04c76e28d9ee9ab355c5e9edcd1b627ac03 Mon Sep 17 00:00:00 2001 From: James Peach Date: Sat, 22 Dec 2007 14:01:25 -0800 Subject: Cache the underlying filesystem capabilities at connection time. This change alters the Samba connection code to cache the filesystem capabilities when a new client connects. This can be used to enable filesystem specific optimisations is a general manner. (This used to be commit de3c5b808a941ac8e9ebe7169536d8290067eef5) --- source3/include/smb.h | 4 ++++ source3/smbd/service.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/source3/include/smb.h b/source3/include/smb.h index 1222c9a73a..63ae51ecd4 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -658,10 +658,14 @@ typedef struct connection_struct { int num_files_open; unsigned int num_smb_operations; /* Count of smb operations on this tree. */ + /* Semantics requested by the client or forced by the server config. */ bool case_sensitive; bool case_preserve; bool short_case_preserve; + /* Semantics provided by the underlying filesystem. */ + int fs_capabilities; + name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */ name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */ name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */ diff --git a/source3/smbd/service.c b/source3/smbd/service.c index ed43528c76..8e69a3b381 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -1165,6 +1165,21 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, } #endif + /* Figure out the characteristics of the underlying filesystem. This + * assumes that all the filesystem mounted withing a share path have + * the same characteristics, which is likely but not guaranteed. + */ + { + vfs_statvfs_struct svfs; + + conn->fs_capabilities = + FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES; + + if (SMB_VFS_STATVFS(conn, conn->connectpath, &svfs) == 0) { + conn->fs_capabilities = svfs.FsCapabilities; + } + } + /* * Print out the 'connected as' stuff here as we need * to know the effective uid and gid we will be using -- cgit From 4dc0c1b88be359cbf4e5273e1670ef0f87b9e36b Mon Sep 17 00:00:00 2001 From: James Peach Date: Sat, 22 Dec 2007 14:10:06 -0800 Subject: Fix "may be used uninitialized" compiler warnings. (This used to be commit 22ac34a329c9be9cf7d1e6749ebcfb50215378e4) --- source3/auth/auth_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 373a2a375f..3f65e6b126 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -1423,7 +1423,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, static const char zeros[16] = { 0, }; NTSTATUS nt_status = NT_STATUS_OK; - char *found_username; + char *found_username = NULL; const char *nt_domain; const char *nt_username; struct samu *sam_account = NULL; @@ -1431,8 +1431,8 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, DOM_SID group_sid; bool username_was_mapped; - uid_t uid; - gid_t gid; + uid_t uid = (uid_t)-1; + gid_t gid = (gid_t)-1; auth_serversupplied_info *result; -- cgit From 596018455af0d80add90215689a80d336157429c Mon Sep 17 00:00:00 2001 From: James Peach Date: Sat, 22 Dec 2007 14:55:37 -0800 Subject: Use filesystem capabilities to support case-insensitive filesystems. If we know the underlying filesystem is case-insensitive, then we know that it won't help to search for case variations of the requested name. Jeremy, please review (and revert if you disagree). (This used to be commit 9e8b8f8c16612d8a08b55802f4fd9afca5498a7c) --- source3/smbd/dir.c | 38 +++++++++++++++++++++----------------- source3/smbd/filename.c | 9 +++++++++ 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 05679ee0ee..ccf91fe57d 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -646,10 +646,13 @@ const char *dptr_ReadDirName(TALLOC_CTX *ctx, TALLOC_FREE(pathreal); - /* In case sensitive mode we don't search - we know if it doesn't exist - with a stat we will fail. */ + /* Stat failed. We know this is authoratiative if we are + * providing case sensitive semantics or the underlying + * filesystem is case sensitive. + */ - if (dptr->conn->case_sensitive) { + if (dptr->conn->case_sensitive || + !(dptr->conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) { /* We need to set the underlying dir_hnd offset to -1 also as this function is usually called with the output from TellDir. */ dptr->dir_hnd->offset = *poffset = END_OF_DIRECTORY_OFFSET; @@ -924,12 +927,7 @@ static bool user_can_read_file(connection_struct *conn, char *name, SMB_STRUCT_S return True; } - /* If we can't stat it does not show it */ - if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, name, pst) != 0)) { - DEBUG(10,("user_can_read_file: SMB_VFS_STAT failed for file %s with error %s\n", - name, strerror(errno) )); - return False; - } + SMB_ASSERT(VALID_STAT(*pst)); /* Pseudo-open the file (note - no fd's created). */ @@ -987,10 +985,7 @@ static bool user_can_write_file(connection_struct *conn, char *name, SMB_STRUCT_ return True; } - /* If we can't stat it does not show it */ - if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, name, pst) != 0)) { - return False; - } + SMB_ASSERT(VALID_STAT(*pst)); /* Pseudo-open the file */ @@ -1039,9 +1034,7 @@ static bool file_is_special(connection_struct *conn, char *name, SMB_STRUCT_STAT if (conn->admin_user) return False; - /* If we can't stat it does not show it */ - if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, name, pst) != 0)) - return True; + SMB_ASSERT(VALID_STAT(*pst)); if (S_ISREG(pst->st_mode) || S_ISDIR(pst->st_mode) || S_ISLNK(pst->st_mode)) return False; @@ -1050,7 +1043,9 @@ static bool file_is_special(connection_struct *conn, char *name, SMB_STRUCT_STAT } /******************************************************************* - Should the file be seen by the client ? + Should the file be seen by the client ? NOTE: A successful return + is no guarantee of the file's existence ... you also have to check + whether pst is valid. ********************************************************************/ bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto) @@ -1086,6 +1081,15 @@ bool is_visible_file(connection_struct *conn, const char *dir_path, const char * return True; } + /* If the file name does not exist, there's no point checking + * the configuration options. We succeed, on the basis that the + * checks *might* have passed if the file was present. + */ + if (SMB_VFS_STAT(conn, entry, pst) != 0) { + SAFE_FREE(entry); + return True; + } + /* Honour _hide unreadable_ option */ if (hide_unreadable && !user_can_read_file(conn, entry, pst)) { DEBUG(10,("is_visible_file: file %s is unreadable.\n", entry )); diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index dc733d4568..f0d036b82b 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -735,6 +735,15 @@ static bool scan_directory(connection_struct *conn, const char *path, path = "."; } + /* If we have a case-sensitive filesystem, it doesn't do us any + * good to search for a name. If a case variation of the name was + * there, then the original stat(2) would have found it. + */ + if (!mangled && !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) { + errno = ENOENT; + return False; + } + /* * The incoming name can be mangled, and if we de-mangle it * here it will not compare correctly against the filename (name2) -- cgit From 9cd009b031a7cc076bb3cbb945c4ec528ea731a1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Dec 2007 00:32:09 +0100 Subject: tiny simplification (This used to be commit 8bd248456205a82d57af21559a77a1030f4679b7) --- source3/lib/winbind_util.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index f4e7ab19e8..f51a0171a2 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -105,8 +105,6 @@ bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid) memcpy(&dom_sid, sid, sizeof(dom_sid)); result = wbcSidToUid(&dom_sid, puid); - if (result != WBC_ERR_SUCCESS) - return False; return (result == WBC_ERR_SUCCESS); } @@ -138,8 +136,6 @@ bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid) memcpy(&dom_sid, sid, sizeof(dom_sid)); result = wbcSidToGid(&dom_sid, pgid); - if (result != WBC_ERR_SUCCESS) - return False; return (result == WBC_ERR_SUCCESS); } -- cgit From 85065a4f364baa4a43cd3b4d1fb0c8e2a0152855 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Dec 2007 00:33:44 +0100 Subject: Fix wbcPing() Without request and response, wbcRequestResponse() will always return WBC_ERR_INVALID_PARAM, so the ping will never reach winbind. (This used to be commit 9a24753d35a4b1a283a65c60088d82e4b80f14c8) --- source3/nsswitch/libwbclient/wbc_util.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source3/nsswitch/libwbclient/wbc_util.c b/source3/nsswitch/libwbclient/wbc_util.c index b0adaad318..c6acb27e55 100644 --- a/source3/nsswitch/libwbclient/wbc_util.c +++ b/source3/nsswitch/libwbclient/wbc_util.c @@ -33,7 +33,15 @@ wbcErr wbcPing(void) { - return wbcRequestResponse(WINBINDD_PING, NULL, NULL); + struct winbindd_request request; + struct winbindd_response response; + + /* Initialize request */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + return wbcRequestResponse(WINBINDD_PING, &request, &response); } /** @brief Lookup the current status of a trusted domain -- cgit From 24e694796d9c7658292af1ea6261889d2c120b35 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Dec 2007 00:35:06 +0100 Subject: Fix wbcAllocate[GU]id wbcRequestResponse() returns a wbcErr, not NSS_STATUS (This used to be commit 1bbdbdef991408af07afaba7bc0b4da55f06aed8) --- source3/nsswitch/libwbclient/wbc_idmap.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/source3/nsswitch/libwbclient/wbc_idmap.c b/source3/nsswitch/libwbclient/wbc_idmap.c index 651c270a57..53f9678ee7 100644 --- a/source3/nsswitch/libwbclient/wbc_idmap.c +++ b/source3/nsswitch/libwbclient/wbc_idmap.c @@ -211,7 +211,7 @@ wbcErr wbcAllocateUid(uid_t *puid) { struct winbindd_request request; struct winbindd_response response; - NSS_STATUS result; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; if (!puid) return WBC_ERR_INVALID_PARAM; @@ -223,16 +223,17 @@ wbcErr wbcAllocateUid(uid_t *puid) /* Make request */ - result = wbcRequestResponse(WINBINDD_ALLOCATE_UID, + wbc_status = wbcRequestResponse(WINBINDD_ALLOCATE_UID, &request, &response); - - if (result != NSS_STATUS_SUCCESS) - return WBC_ERR_UNKNOWN_FAILURE; + BAIL_ON_WBC_ERROR(wbc_status); /* Copy out result */ *puid = response.data.uid; - return WBC_ERR_SUCCESS; + wbc_status = WBC_ERR_SUCCESS; + + done: + return wbc_status; } /** @brief Obtain a new gid from Winbind @@ -246,7 +247,7 @@ wbcErr wbcAllocateGid(uid_t *pgid) { struct winbindd_request request; struct winbindd_response response; - NSS_STATUS result; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; if (!pgid) return WBC_ERR_INVALID_PARAM; @@ -258,15 +259,16 @@ wbcErr wbcAllocateGid(uid_t *pgid) /* Make request */ - result = wbcRequestResponse(WINBINDD_ALLOCATE_GID, + wbc_status = wbcRequestResponse(WINBINDD_ALLOCATE_GID, &request, &response); - - if (result != NSS_STATUS_SUCCESS) - return WBC_ERR_UNKNOWN_FAILURE; + BAIL_ON_WBC_ERROR(wbc_status); /* Copy out result */ *pgid = response.data.gid; - return WBC_ERR_SUCCESS; + wbc_status = WBC_ERR_SUCCESS; + + done: + return wbc_status; } -- cgit From d75d3bc021c5f9242dd786ebf1aab57aadf7df23 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 01:34:20 +0100 Subject: Fix typo in output. Michael (This used to be commit 2fe111c19bc827ec132365e718a2136bda57e568) --- source3/script/tests/selftest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index 0ad0639cb9..515c95bdbd 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -71,7 +71,7 @@ PATH=bin:$PATH export PATH LD_LIBRARY_PATH=$BINDIR -echo "LD_LIBRRARY_PATH=$LD_LIBRARY_PATH" +echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" export LD_LIBRARY_PATH ## -- cgit From f980d3ea14c020869102d8cd90fb69ecc2f78416 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 22 Dec 2007 17:38:18 -0800 Subject: If we detect a case insensitive filesystem make sure we don't search directories on name misses for non-mangled names. Jeremy (This used to be commit 120048d2f40cf1a0ace2ecde205cbc694d263d69) --- source3/smbd/filename.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index f0d036b82b..5ae193fb46 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -222,8 +222,14 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, start = name; - if(!conn->case_sensitive - && stat_cache_lookup(conn, &name, &dirpath, &start, &st)) { + /* If we're providing case insentive semantics or + * the underlying filesystem is case insensitive, + * then a case-normalized hit in the stat-cache is + * authoratitive. JRA. + */ + + if((!conn->case_sensitive || !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) && + stat_cache_lookup(conn, &name, &dirpath, &start, &st)) { *pst = st; goto done; } @@ -269,10 +275,11 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, /* * A special case - if we don't have any mangling chars and are case - * sensitive then searching won't help. + * sensitive or the underlying filesystem is case insentive then searching + * won't help. */ - if (conn->case_sensitive && + if ((conn->case_sensitive || !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) && !mangle_is_mangled(name, conn->params)) { goto done; } -- cgit From aeea4bfadd98f23df71c5754bef7defc42d2f67f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 01:43:13 +0100 Subject: Make libnet_smbconf_open_path_q() static. Michael (This used to be commit 8cf8ed9de8c3f41588fa93bd102f61f5b8b493c4) --- source3/libnet/libnet_conf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 8bc5161268..dcaa7689b3 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -24,9 +24,10 @@ * Open a subkey of KEY_SMBCONF (i.e a service) * - variant without error output (q = quiet)- */ -WERROR libnet_smbconf_open_path_q(TALLOC_CTX *ctx, const char *subkeyname, - uint32 desired_access, - struct registry_key **key) +static WERROR libnet_smbconf_open_path_q(TALLOC_CTX *ctx, + const char *subkeyname, + uint32 desired_access, + struct registry_key **key) { WERROR werr = WERR_OK; char *path = NULL; -- cgit From ec3e8587ecdef8e4a52d4c37ac379d9e414b861b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 02:44:29 +0100 Subject: Move smbconf_value_exists() to libnet/net_conf.c renaming it to libnet_smbconf_value_exists(). Michael (This used to be commit ba71c6844588f0342589163f514385911e7331e7) --- source3/libnet/libnet_conf.c | 17 +++++++++++++++++ source3/utils/net_conf.c | 18 +----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index dcaa7689b3..9f64e7fc0d 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -194,3 +194,20 @@ WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx, return do_modify_val_config(key, param, val); } +bool libnet_smbconf_value_exists(TALLOC_CTX *ctx, + struct registry_key *key, + const char *param) +{ + bool ret = False; + WERROR werr = WERR_OK; + struct registry_value *value = NULL; + + werr = reg_queryvalue(ctx, key, param, &value); + if (W_ERROR_IS_OK(werr)) { + ret = True; + } + + TALLOC_FREE(value); + return ret; +} + diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 808ba8d885..c4707e4248 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -238,22 +238,6 @@ done: return werr; } -static bool smbconf_value_exists(TALLOC_CTX *ctx, struct registry_key *key, - const char *param) -{ - bool ret = False; - WERROR werr = WERR_OK; - struct registry_value *value = NULL; - - werr = reg_queryvalue(ctx, key, param, &value); - if (W_ERROR_IS_OK(werr)) { - ret = True; - } - - TALLOC_FREE(value); - return ret; -} - static WERROR list_values(TALLOC_CTX *ctx, struct registry_key *key) { WERROR werr = WERR_OK; @@ -1037,7 +1021,7 @@ static int net_conf_delparm(int argc, const char **argv) goto done; } - if (!smbconf_value_exists(ctx, key, param)) { + if (!libnet_smbconf_value_exists(ctx, key, param)) { d_fprintf(stderr, "Error: given parameter '%s' is not set.\n", param); -- cgit From b04708866f146ada8a7cc353347244df54821fbf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 02:55:25 +0100 Subject: Move logic of net_smbconf_delparm() to libnet/libnet_conf.c Logic in new function libnet_smbconf_delparm(). Michael (This used to be commit 0cff79e3552e91ba0b6bc054802d28afcf4e8da4) --- source3/libnet/libnet_conf.c | 25 ++++++++++++++++++++++++- source3/utils/net_conf.c | 18 +++++------------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 9f64e7fc0d..960ee80dbc 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -194,7 +194,7 @@ WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx, return do_modify_val_config(key, param, val); } -bool libnet_smbconf_value_exists(TALLOC_CTX *ctx, +static bool libnet_smbconf_value_exists(TALLOC_CTX *ctx, struct registry_key *key, const char *param) { @@ -211,3 +211,26 @@ bool libnet_smbconf_value_exists(TALLOC_CTX *ctx, return ret; } +WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, + const char *service, + const char *param) +{ + struct registry_key *key = NULL; + WERROR werr = WERR_OK; + + if (!libnet_smbconf_key_exists(mem_ctx, service)) { + return WERR_NO_SUCH_SERVICE; + } + + werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_READ, &key); + W_ERROR_NOT_OK_RETURN(werr); + + if (!libnet_smbconf_value_exists(mem_ctx, key, param)) { + return WERR_INVALID_PARAM; + } + + werr = reg_deletevalue(key, param); + W_ERROR_NOT_OK_RETURN(werr); + + return WERR_OK; +} diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index c4707e4248..8d0b4b9bbe 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -995,7 +995,6 @@ static int net_conf_delparm(int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; - struct registry_key *key = NULL; char *service = NULL; char *param = NULL; TALLOC_CTX *ctx; @@ -1009,26 +1008,19 @@ static int net_conf_delparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - if (!libnet_smbconf_key_exists(ctx, service)) { + werr = libnet_smbconf_delparm(ctx, service, param); + + if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, "Error: given service '%s' does not exist.\n", service); goto done; - } - - werr = libnet_smbconf_open_path(ctx, service, REG_KEY_READ, &key); - if (!W_ERROR_IS_OK(werr)) { - goto done; - } - - if (!libnet_smbconf_value_exists(ctx, key, param)) { + } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) { d_fprintf(stderr, "Error: given parameter '%s' is not set.\n", param); goto done; - } - werr = reg_deletevalue(key, param); - if (!W_ERROR_IS_OK(werr)) { + } else if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error deleting value '%s': %s.\n", param, dos_errstr(werr)); goto done; -- cgit From bd2b8f0f7b5a98917162bc5a27ffa4ee4cbebc54 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 03:02:19 +0100 Subject: Replace direct deletion of registry value by use of libnet_smbconf_delparm(). Michael (This used to be commit 415fc0a5261f4d941027e5d5305fcea882724aef) --- source3/libnet/libnet_join.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 2994c3f59d..fe7fb7dd73 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -398,7 +398,7 @@ static WERROR do_unjoin_modify_vals_config(TALLOC_CTX *mem_ctx, W_ERROR_NOT_OK_RETURN(werr); } - reg_deletevalue(key, "realm"); + werr = libnet_smbconf_delparm(mem_ctx, "GLOBAL", "realm"); return werr; } -- cgit From 88a424a4d37b61af4e126869a16a2ca43d878056 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 03:13:30 +0100 Subject: Remove occurrences of registry_key from libnet_join.c Replace duplicated logic by calls of libnet_smbconf_set_global_param() from libnet_conf.c, pushing logic from do_JoinConfig() and do_UnjoinConfig() to do_join_modify_vals_config() and do_unjoin_modify_vals_config() respectively. Only the net_conf api functions should be exported by libnet_conf.c, not the lower level registry access functions. Michael (This used to be commit 81b9f1301d61f05f9153be61d62c13e82cecf7e2) --- source3/libnet/libnet_join.c | 82 +++++++++----------------------------------- 1 file changed, 17 insertions(+), 65 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index fe7fb7dd73..68244e5156 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -331,35 +331,20 @@ done: return status; } -static WERROR do_modify_val_config(struct registry_key *key, - const char *val_name, - const char *val_data) -{ - struct registry_value val; - - ZERO_STRUCT(val); - - val.type = REG_SZ; - val.v.sz.str = CONST_DISCARD(char *, val_data); - val.v.sz.len = strlen(val_data) + 1; - - return reg_setvalue(key, val_name, &val); -} - static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx, - struct libnet_JoinCtx *r, - struct registry_key *key) + struct libnet_JoinCtx *r) { WERROR werr; bool is_ad = false; if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) { - werr = do_modify_val_config(key, "security", "user"); + werr = libnet_smbconf_set_global_param(mem_ctx, "security", + "user"); W_ERROR_NOT_OK_RETURN(werr); - werr = do_modify_val_config(key, "workgroup", - r->in.domain_name); + werr = libnet_smbconf_set_global_param(mem_ctx, "workgroup", + r->in.domain_name); return werr; } @@ -367,19 +352,20 @@ static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx, is_ad = true; } - werr = do_modify_val_config(key, "security", "domain"); + werr = libnet_smbconf_set_global_param(mem_ctx, "security", "domain"); W_ERROR_NOT_OK_RETURN(werr); - werr = do_modify_val_config(key, "workgroup", - r->out.netbios_domain_name); + werr = libnet_smbconf_set_global_param(mem_ctx, "workgroup", + r->out.netbios_domain_name); W_ERROR_NOT_OK_RETURN(werr); if (is_ad) { - werr = do_modify_val_config(key, "security", "ads"); + werr = libnet_smbconf_set_global_param(mem_ctx, "security", + "ads"); W_ERROR_NOT_OK_RETURN(werr); - werr = do_modify_val_config(key, "realm", - r->out.dns_domain_name); + werr = libnet_smbconf_set_global_param(mem_ctx, "realm", + r->out.dns_domain_name); W_ERROR_NOT_OK_RETURN(werr); } @@ -387,14 +373,14 @@ static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx, } static WERROR do_unjoin_modify_vals_config(TALLOC_CTX *mem_ctx, - struct libnet_UnjoinCtx *r, - struct registry_key *key) + struct libnet_UnjoinCtx *r) { WERROR werr = WERR_OK; if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - werr = do_modify_val_config(key, "security", "user"); + werr = libnet_smbconf_set_global_param(mem_ctx, "security", + "user"); W_ERROR_NOT_OK_RETURN(werr); } @@ -408,7 +394,6 @@ static WERROR do_JoinConfig(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { WERROR werr; - struct registry_key *key = NULL; if (!W_ERROR_IS_OK(r->out.result)) { return r->out.result; @@ -418,23 +403,7 @@ static WERROR do_JoinConfig(TALLOC_CTX *mem_ctx, return WERR_OK; } - if (!registry_init_regdb()) { - return WERR_REG_IO_FAILURE; - } - - if (!libnet_smbconf_key_exists(mem_ctx, GLOBAL_NAME)) { - werr = libnet_reg_createkey_internal(mem_ctx, - GLOBAL_NAME, &key); - } else { - werr = libnet_smbconf_open_path(mem_ctx, - GLOBAL_NAME, - REG_KEY_WRITE, &key); - } - if (!W_ERROR_IS_OK(werr)) { - return werr; - } - - werr = do_join_modify_vals_config(mem_ctx, r, key); + werr = do_join_modify_vals_config(mem_ctx, r); if (!W_ERROR_IS_OK(werr)) { return werr; } @@ -449,7 +418,6 @@ static WERROR do_UnjoinConfig(TALLOC_CTX *mem_ctx, struct libnet_UnjoinCtx *r) { WERROR werr; - struct registry_key *key = NULL; if (!W_ERROR_IS_OK(r->out.result)) { return r->out.result; @@ -459,23 +427,7 @@ static WERROR do_UnjoinConfig(TALLOC_CTX *mem_ctx, return WERR_OK; } - if (!registry_init_regdb()) { - return WERR_REG_IO_FAILURE; - } - - if (!libnet_smbconf_key_exists(mem_ctx, GLOBAL_NAME)) { - werr = libnet_reg_createkey_internal(mem_ctx, - GLOBAL_NAME, &key); - } else { - werr = libnet_smbconf_open_path(mem_ctx, - GLOBAL_NAME, - REG_KEY_WRITE, &key); - } - if (!W_ERROR_IS_OK(werr)) { - return werr; - } - - werr = do_unjoin_modify_vals_config(mem_ctx, r, key); + werr = do_unjoin_modify_vals_config(mem_ctx, r); if (!W_ERROR_IS_OK(werr)) { return werr; } -- cgit From 31d436e54c2ec56ae59527feb9a31d13eca44f6d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 03:34:36 +0100 Subject: Move reg_setvalue_internal() to libnet_conf.c renaming it to libnet_smbconf_setvalue_internal() Michael (This used to be commit 7cb51a1d6d95704225d9ab22e88cc76fa910d38c) --- source3/libnet/libnet_conf.c | 72 ++++++++++++++++++++++++++++++++++++ source3/utils/net_conf.c | 88 +++++--------------------------------------- 2 files changed, 82 insertions(+), 78 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 960ee80dbc..d42e5ad227 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -148,6 +148,78 @@ done: return werr; } + +/* + * add a value to a key. + */ +WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key, + const char *valname, + const char *valstr) +{ + struct registry_value val; + WERROR werr = WERR_OK; + char *subkeyname; + const char *canon_valname; + const char *canon_valstr; + + if (!lp_canonicalize_parameter_with_value(valname, valstr, + &canon_valname, + &canon_valstr)) + { + if (canon_valname == NULL) { + d_fprintf(stderr, "invalid parameter '%s' given\n", + valname); + } else { + d_fprintf(stderr, "invalid value '%s' given for " + "parameter '%s'\n", valstr, valname); + } + werr = WERR_INVALID_PARAM; + goto done; + } + + ZERO_STRUCT(val); + + val.type = REG_SZ; + val.v.sz.str = CONST_DISCARD(char *, canon_valstr); + val.v.sz.len = strlen(canon_valstr) + 1; + + if (registry_smbconf_valname_forbidden(canon_valname)) { + d_fprintf(stderr, "Parameter '%s' not allowed in registry.\n", + canon_valname); + werr = WERR_INVALID_PARAM; + goto done; + } + + subkeyname = strrchr_m(key->key->name, '\\'); + if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) { + d_fprintf(stderr, "Invalid registry key '%s' given as " + "smbconf section.\n", key->key->name); + werr = WERR_INVALID_PARAM; + goto done; + } + subkeyname++; + if (!strequal(subkeyname, GLOBAL_NAME) && + lp_parameter_is_global(valname)) + { + d_fprintf(stderr, "Global paramter '%s' not allowed in " + "service definition ('%s').\n", canon_valname, + subkeyname); + werr = WERR_INVALID_PARAM; + goto done; + } + + werr = reg_setvalue(key, canon_valname, &val); + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, + "Error adding value '%s' to " + "key '%s': %s\n", + canon_valname, key->key->name, dos_errstr(werr)); + } + +done: + return werr; +} + static WERROR do_modify_val_config(struct registry_key *key, const char *val_name, const char *val_data) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 8d0b4b9bbe..2648aa2e81 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -143,77 +143,6 @@ static char *format_value(TALLOC_CTX *mem_ctx, struct registry_value *value) return result; } -/* - * add a value to a key. - */ -static WERROR reg_setvalue_internal(struct registry_key *key, - const char *valname, - const char *valstr) -{ - struct registry_value val; - WERROR werr = WERR_OK; - char *subkeyname; - const char *canon_valname; - const char *canon_valstr; - - if (!lp_canonicalize_parameter_with_value(valname, valstr, - &canon_valname, - &canon_valstr)) - { - if (canon_valname == NULL) { - d_fprintf(stderr, "invalid parameter '%s' given\n", - valname); - } else { - d_fprintf(stderr, "invalid value '%s' given for " - "parameter '%s'\n", valstr, valname); - } - werr = WERR_INVALID_PARAM; - goto done; - } - - ZERO_STRUCT(val); - - val.type = REG_SZ; - val.v.sz.str = CONST_DISCARD(char *, canon_valstr); - val.v.sz.len = strlen(canon_valstr) + 1; - - if (registry_smbconf_valname_forbidden(canon_valname)) { - d_fprintf(stderr, "Parameter '%s' not allowed in registry.\n", - canon_valname); - werr = WERR_INVALID_PARAM; - goto done; - } - - subkeyname = strrchr_m(key->key->name, '\\'); - if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) { - d_fprintf(stderr, "Invalid registry key '%s' given as " - "smbconf section.\n", key->key->name); - werr = WERR_INVALID_PARAM; - goto done; - } - subkeyname++; - if (!strequal(subkeyname, GLOBAL_NAME) && - lp_parameter_is_global(valname)) - { - d_fprintf(stderr, "Global paramter '%s' not allowed in " - "service definition ('%s').\n", canon_valname, - subkeyname); - werr = WERR_INVALID_PARAM; - goto done; - } - - werr = reg_setvalue(key, canon_valname, &val); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, - "Error adding value '%s' to " - "key '%s': %s\n", - canon_valname, key->key->name, dos_errstr(werr)); - } - -done: - return werr; -} - /* * delete a subkey of KEY_SMBCONF */ @@ -435,8 +364,8 @@ static int import_process_service(TALLOC_CTX *ctx, if (opt_testmode) { d_printf("\t%s = %s\n", parm->label, valstr); } else { - werr = reg_setvalue_internal(key, parm->label, - valstr); + werr = libnet_smbconf_reg_setvalue_internal(key, + parm->label, valstr); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -854,21 +783,24 @@ int net_conf_addshare(int argc, const char **argv) /* add config params as values */ - werr = reg_setvalue_internal(newkey, "path", path); + werr = libnet_smbconf_reg_setvalue_internal(newkey, "path", path); if (!W_ERROR_IS_OK(werr)) goto done; if (comment != NULL) { - werr = reg_setvalue_internal(newkey, "comment", comment); + werr = libnet_smbconf_reg_setvalue_internal(newkey, "comment", + comment); if (!W_ERROR_IS_OK(werr)) goto done; } - werr = reg_setvalue_internal(newkey, "guest ok", guest_ok); + werr = libnet_smbconf_reg_setvalue_internal(newkey, "guest ok", + guest_ok); if (!W_ERROR_IS_OK(werr)) goto done; - werr = reg_setvalue_internal(newkey, "writeable", writeable); + werr = libnet_smbconf_reg_setvalue_internal(newkey, "writeable", + writeable); if (!W_ERROR_IS_OK(werr)) goto done; @@ -927,7 +859,7 @@ static int net_conf_setparm(int argc, const char **argv) goto done; } - werr = reg_setvalue_internal(key, param, value_str); + werr = libnet_smbconf_reg_setvalue_internal(key, param, value_str); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting value '%s': %s\n", param, dos_errstr(werr)); -- cgit From 62f08d3dd9b1f1d53a8e9ecf352fbbfb4c12c484 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 03:41:55 +0100 Subject: Move net_conf_setparm() to libnet_conf.c renaming it to libnet_smbconf_setparm() Michael (This used to be commit 60f49b22b5aa125ff6cb358a258a1be99c378d7a) --- source3/libnet/libnet_conf.c | 21 +++++++++++++++++++++ source3/utils/net_conf.c | 12 +----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index d42e5ad227..00dc1d473d 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -235,6 +235,27 @@ static WERROR do_modify_val_config(struct registry_key *key, return reg_setvalue(key, val_name, &val); } +WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, + const char *service, + const char *param, + const char *valstr) +{ + WERROR werr; + struct registry_key *key = NULL; + + if (!libnet_smbconf_key_exists(mem_ctx, service)) { + werr = libnet_reg_createkey_internal(mem_ctx, service, &key); + } else { + werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_WRITE, + &key); + } + W_ERROR_NOT_OK_RETURN(werr); + + werr = libnet_smbconf_reg_setvalue_internal(key, param, valstr); + + return werr; +} + WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx, const char *param, const char *val) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 2648aa2e81..1ab1378910 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -834,7 +834,6 @@ static int net_conf_setparm(int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; - struct registry_key *key = NULL; char *service = NULL; char *param = NULL; const char *value_str = NULL; @@ -850,23 +849,14 @@ static int net_conf_setparm(int argc, const char **argv) param = strdup_lower(argv[1]); value_str = argv[2]; - if (!libnet_smbconf_key_exists(ctx, service)) { - werr = libnet_reg_createkey_internal(ctx, service, &key); - } else { - werr = libnet_smbconf_open_path(ctx, service, REG_KEY_WRITE, &key); - } - if (!W_ERROR_IS_OK(werr)) { - goto done; - } + werr = libnet_smbconf_setparm(ctx, service, param, value_str); - werr = libnet_smbconf_reg_setvalue_internal(key, param, value_str); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting value '%s': %s\n", param, dos_errstr(werr)); goto done; } - ret = 0; done: -- cgit From b6527f3d29dccc4b86252e7d6722371e61870e80 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 03:47:16 +0100 Subject: Reorder libnet_conf.c some, adding "section" comments. Michael (This used to be commit b9f22adfd3e67046b7d786b5b338e078b4cdc6df) --- source3/libnet/libnet_conf.c | 48 +++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 00dc1d473d..f364e4fb64 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -20,6 +20,13 @@ #include "includes.h" +/********************************************************************** + * + * Helper functions (mostly registry related) + * TODO: These should be eventually static. + + **********************************************************************/ + /* * Open a subkey of KEY_SMBCONF (i.e a service) * - variant without error output (q = quiet)- @@ -77,6 +84,23 @@ done: return ret; } +static bool libnet_smbconf_value_exists(TALLOC_CTX *ctx, + struct registry_key *key, + const char *param) +{ + bool ret = False; + WERROR werr = WERR_OK; + struct registry_value *value = NULL; + + werr = reg_queryvalue(ctx, key, param, &value); + if (W_ERROR_IS_OK(werr)) { + ret = True; + } + + TALLOC_FREE(value); + return ret; +} + /* * Open a subkey of KEY_SMBCONF (i.e a service) * - variant with error output - @@ -148,7 +172,6 @@ done: return werr; } - /* * add a value to a key. */ @@ -235,6 +258,12 @@ static WERROR do_modify_val_config(struct registry_key *key, return reg_setvalue(key, val_name, &val); } +/********************************************************************** + * + * The actual net conf api functions, that are exported. + * + **********************************************************************/ + WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, const char *service, const char *param, @@ -287,23 +316,6 @@ WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx, return do_modify_val_config(key, param, val); } -static bool libnet_smbconf_value_exists(TALLOC_CTX *ctx, - struct registry_key *key, - const char *param) -{ - bool ret = False; - WERROR werr = WERR_OK; - struct registry_value *value = NULL; - - werr = reg_queryvalue(ctx, key, param, &value); - if (W_ERROR_IS_OK(werr)) { - ret = True; - } - - TALLOC_FREE(value); - return ret; -} - WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, const char *service, const char *param) -- cgit From a48f3c8a964fe6b320a052a6251354351f8d98e0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 03:52:00 +0100 Subject: Make libnet_smbconf_set_global_param() call libnet_smbconf_setparm(). This not only removes duplicate logic, but also the use of libnet_smbconf_reg_setvalue_internal() instead of do_modify_val_config() which is removed, does add important tests and canonicalizations. Michael (This used to be commit fa844866493ee270f31faa3eca77cdff16b26301) --- source3/libnet/libnet_conf.c | 61 +++++++++++--------------------------------- 1 file changed, 15 insertions(+), 46 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index f364e4fb64..9d06f8287b 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -243,21 +243,6 @@ done: return werr; } -static WERROR do_modify_val_config(struct registry_key *key, - const char *val_name, - const char *val_data) -{ - struct registry_value val; - - ZERO_STRUCT(val); - - val.type = REG_SZ; - val.v.sz.str = CONST_DISCARD(char *, val_data); - val.v.sz.len = strlen(val_data) + 1; - - return reg_setvalue(key, val_name, &val); -} - /********************************************************************** * * The actual net conf api functions, that are exported. @@ -285,37 +270,6 @@ WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, return werr; } -WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx, - const char *param, - const char *val) -{ - WERROR werr; - struct registry_key *key = NULL; - - if (!lp_include_registry_globals()) { - return WERR_NOT_SUPPORTED; - } - - if (!registry_init_regdb()) { - return WERR_REG_IO_FAILURE; - } - - if (!libnet_smbconf_key_exists(mem_ctx, GLOBAL_NAME)) { - werr = libnet_reg_createkey_internal(mem_ctx, - GLOBAL_NAME, &key); - } else { - werr = libnet_smbconf_open_path(mem_ctx, - GLOBAL_NAME, - REG_KEY_WRITE, &key); - } - - if (!W_ERROR_IS_OK(werr)) { - return werr; - } - - return do_modify_val_config(key, param, val); -} - WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, const char *service, const char *param) @@ -339,3 +293,18 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, return WERR_OK; } + + +/********************************************************************** + * + * Convenience functions, that are also exportet. + * + **********************************************************************/ + +WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx, + const char *param, + const char *val) +{ + return libnet_smbconf_setparm(mem_ctx, GLOBAL_NAME, param, val); +} + -- cgit From d1c2280cd44e40a4398115c7d862ac0c296c98bc Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 04:10:15 +0100 Subject: Rename libnet_reg_createkey_internal() to libnet_smbconf_reg_createkey_internal(). Michael (This used to be commit 0e7f215f54c68b2d40f65f90ed11c41e1a7ef5ed) --- source3/libnet/libnet_conf.c | 9 +++++---- source3/utils/net_conf.c | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 9d06f8287b..69a105f8f5 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -134,9 +134,9 @@ WERROR libnet_smbconf_open_basepath(TALLOC_CTX *ctx, uint32 desired_access, /* * create a subkey of KEY_SMBCONF */ -WERROR libnet_reg_createkey_internal(TALLOC_CTX *ctx, - const char * subkeyname, - struct registry_key **newkey) +WERROR libnet_smbconf_reg_createkey_internal(TALLOC_CTX *ctx, + const char * subkeyname, + struct registry_key **newkey) { WERROR werr = WERR_OK; struct registry_key *create_parent = NULL; @@ -258,7 +258,8 @@ WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, struct registry_key *key = NULL; if (!libnet_smbconf_key_exists(mem_ctx, service)) { - werr = libnet_reg_createkey_internal(mem_ctx, service, &key); + werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service, + &key); } else { werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_WRITE, &key); diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 1ab1378910..673d373177 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -346,7 +346,7 @@ static int import_process_service(TALLOC_CTX *ctx, goto done; } } - werr = libnet_reg_createkey_internal(tmp_ctx, servicename, &key); + werr = libnet_smbconf_reg_createkey_internal(tmp_ctx, servicename, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -776,7 +776,7 @@ int net_conf_addshare(int argc, const char **argv) * create the share */ - werr = libnet_reg_createkey_internal(NULL, argv[0], &newkey); + werr = libnet_smbconf_reg_createkey_internal(NULL, argv[0], &newkey); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From a55a08a217cb25289167bd812442a95fef3adba4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 22 Dec 2007 14:52:34 +0100 Subject: Convert the [gu]id_sid cache to memcache (This used to be commit 4baf36784f6496121a6863af0283821785eb0cf1) --- source3/passdb/lookup_sid.c | 196 ++++++++++++++------------------------------ 1 file changed, 62 insertions(+), 134 deletions(-) diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index f5b03ffff0..55dd654131 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -971,184 +971,112 @@ bool lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, modified to use linked lists by jra. *****************************************************************/ -#define MAX_UID_SID_CACHE_SIZE 100 -#define TURNOVER_UID_SID_CACHE_SIZE 10 -#define MAX_GID_SID_CACHE_SIZE 100 -#define TURNOVER_GID_SID_CACHE_SIZE 10 - -static size_t n_uid_sid_cache = 0; -static size_t n_gid_sid_cache = 0; - -static struct uid_sid_cache { - struct uid_sid_cache *next, *prev; - uid_t uid; - DOM_SID sid; - enum lsa_SidType sidtype; -} *uid_sid_cache_head; - -static struct gid_sid_cache { - struct gid_sid_cache *next, *prev; - gid_t gid; - DOM_SID sid; - enum lsa_SidType sidtype; -} *gid_sid_cache_head; - /***************************************************************** Find a SID given a uid. -*****************************************************************/ +*****************************************************************/ static bool fetch_sid_from_uid_cache(DOM_SID *psid, uid_t uid) { - struct uid_sid_cache *pc; - - for (pc = uid_sid_cache_head; pc; pc = pc->next) { - if (pc->uid == uid) { - *psid = pc->sid; - DEBUG(3,("fetch sid from uid cache %u -> %s\n", - (unsigned int)uid, sid_string_dbg(psid))); - DLIST_PROMOTE(uid_sid_cache_head, pc); - return true; - } + DATA_BLOB cache_value; + + if (!memcache_lookup(NULL, UID_SID_CACHE, + data_blob_const(&uid, sizeof(uid)), + &cache_value)) { + return false; } - return false; + + SMB_ASSERT(cache_value.length == sizeof(*psid)); + memcpy(psid, cache_value.data, sizeof(*psid)); + + return true; } /***************************************************************** Find a uid given a SID. -*****************************************************************/ +*****************************************************************/ static bool fetch_uid_from_cache( uid_t *puid, const DOM_SID *psid ) { - struct uid_sid_cache *pc; - - for (pc = uid_sid_cache_head; pc; pc = pc->next) { - if (sid_compare(&pc->sid, psid) == 0) { - *puid = pc->uid; - DEBUG(3,("fetch uid from cache %u -> %s\n", - (unsigned int)*puid, sid_string_dbg(psid))); - DLIST_PROMOTE(uid_sid_cache_head, pc); - return true; - } + DATA_BLOB cache_value; + + if (!memcache_lookup(NULL, SID_UID_CACHE, + data_blob_const(psid, sizeof(*psid)), + &cache_value)) { + return false; } - return false; + + SMB_ASSERT(cache_value.length == sizeof(*puid)); + memcpy(puid, cache_value.data, sizeof(*puid)); + + return true; } /***************************************************************** Store uid to SID mapping in cache. -*****************************************************************/ +*****************************************************************/ void store_uid_sid_cache(const DOM_SID *psid, uid_t uid) { - struct uid_sid_cache *pc; - - /* do not store SIDs in the "Unix Group" domain */ - - if ( sid_check_is_in_unix_users( psid ) ) - return; - - if (n_uid_sid_cache >= MAX_UID_SID_CACHE_SIZE && n_uid_sid_cache > TURNOVER_UID_SID_CACHE_SIZE) { - /* Delete the last TURNOVER_UID_SID_CACHE_SIZE entries. */ - struct uid_sid_cache *pc_next; - size_t i; - - for (i = 0, pc = uid_sid_cache_head; i < (n_uid_sid_cache - TURNOVER_UID_SID_CACHE_SIZE); i++, pc = pc->next) - ; - for(; pc; pc = pc_next) { - pc_next = pc->next; - DLIST_REMOVE(uid_sid_cache_head,pc); - SAFE_FREE(pc); - n_uid_sid_cache--; - } - } - - pc = SMB_MALLOC_P(struct uid_sid_cache); - if (!pc) - return; - pc->uid = uid; - sid_copy(&pc->sid, psid); - DLIST_ADD(uid_sid_cache_head, pc); - n_uid_sid_cache++; + memcache_add(NULL, SID_UID_CACHE, + data_blob_const(psid, sizeof(*psid)), + data_blob_const(&uid, sizeof(uid))); + memcache_add(NULL, UID_SID_CACHE, + data_blob_const(&uid, sizeof(uid)), + data_blob_const(psid, sizeof(*psid))); } /***************************************************************** Find a SID given a gid. -*****************************************************************/ +*****************************************************************/ static bool fetch_sid_from_gid_cache(DOM_SID *psid, gid_t gid) { - struct gid_sid_cache *pc; - - for (pc = gid_sid_cache_head; pc; pc = pc->next) { - if (pc->gid == gid) { - *psid = pc->sid; - DEBUG(3,("fetch sid from gid cache %u -> %s\n", - (unsigned int)gid, sid_string_dbg(psid))); - DLIST_PROMOTE(gid_sid_cache_head, pc); - return true; - } + DATA_BLOB cache_value; + + if (!memcache_lookup(NULL, GID_SID_CACHE, + data_blob_const(&gid, sizeof(gid)), + &cache_value)) { + return false; } - return false; + + SMB_ASSERT(cache_value.length == sizeof(*psid)); + memcpy(psid, cache_value.data, sizeof(*psid)); + + return true; } /***************************************************************** Find a gid given a SID. -*****************************************************************/ +*****************************************************************/ static bool fetch_gid_from_cache(gid_t *pgid, const DOM_SID *psid) { - struct gid_sid_cache *pc; - - for (pc = gid_sid_cache_head; pc; pc = pc->next) { - if (sid_compare(&pc->sid, psid) == 0) { - *pgid = pc->gid; - DEBUG(3,("fetch gid from cache %u -> %s\n", - (unsigned int)*pgid, sid_string_dbg(psid))); - DLIST_PROMOTE(gid_sid_cache_head, pc); - return true; - } + DATA_BLOB cache_value; + + if (!memcache_lookup(NULL, SID_UID_CACHE, + data_blob_const(psid, sizeof(*psid)), + &cache_value)) { + return false; } - return false; + + SMB_ASSERT(cache_value.length == sizeof(*pgid)); + memcpy(pgid, cache_value.data, sizeof(*pgid)); + + return true; } /***************************************************************** Store gid to SID mapping in cache. -*****************************************************************/ +*****************************************************************/ void store_gid_sid_cache(const DOM_SID *psid, gid_t gid) { - struct gid_sid_cache *pc; - - /* do not store SIDs in the "Unix Group" domain */ - - if ( sid_check_is_in_unix_groups( psid ) ) - return; - - if (n_gid_sid_cache >= MAX_GID_SID_CACHE_SIZE && n_gid_sid_cache > TURNOVER_GID_SID_CACHE_SIZE) { - /* Delete the last TURNOVER_GID_SID_CACHE_SIZE entries. */ - struct gid_sid_cache *pc_next; - size_t i; - - for (i = 0, pc = gid_sid_cache_head; i < (n_gid_sid_cache - TURNOVER_GID_SID_CACHE_SIZE); i++, pc = pc->next) - ; - for(; pc; pc = pc_next) { - pc_next = pc->next; - DLIST_REMOVE(gid_sid_cache_head,pc); - SAFE_FREE(pc); - n_gid_sid_cache--; - } - } - - pc = SMB_MALLOC_P(struct gid_sid_cache); - if (!pc) - return; - pc->gid = gid; - sid_copy(&pc->sid, psid); - DLIST_ADD(gid_sid_cache_head, pc); - - DEBUG(3,("store_gid_sid_cache: gid %u in cache -> %s\n", - (unsigned int)gid, sid_string_dbg(psid))); - - n_gid_sid_cache++; + memcache_add(NULL, SID_GID_CACHE, + data_blob_const(psid, sizeof(*psid)), + data_blob_const(&gid, sizeof(gid))); + memcache_add(NULL, GID_SID_CACHE, + data_blob_const(&gid, sizeof(gid)), + data_blob_const(psid, sizeof(*psid))); } /***************************************************************** -- cgit From 958861e13b1bf96e835b3b40ad9823416d2f2a46 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Dec 2007 15:53:09 +0100 Subject: Attempt to fix the Solaris build Lets see what the others in the build farm think about this (This used to be commit c2a988d8427b7598291ae6999b5258e2b6a2e7cb) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index d3b990e94a..53f7bf3dc4 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -25,7 +25,7 @@ SHLD=@SHLD@ ## Dynamic shared libraries build settings DSO_EXPORTS_CMD=-Wl,--version-script,$(srcdir)/exports/`basename $@ | sed 's/@SHLIBEXT@$$/syms/'` DSO_EXPORTS=@DSO_EXPORTS@ -SONAME_VER=`grep ^$@ $(builddir)/library-versions | cut -d: -f2` +SONAME_VER=`grep \^$@ $(builddir)/library-versions | cut -d: -f2` SHLD_DSO = $(SHLD) $(LDSHFLAGS) $(DSO_EXPORTS) -o $@ # The MODULE_EXPORTS variable contains the platform-specific linker flags -- cgit From 4c364e3078795ff38d55503c4351b2bf3bc9e6bc Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 23 Dec 2007 16:38:28 +0100 Subject: Attempt to make the build farm run s4torture again (This used to be commit 04710626e174d7237521f33a351b4425add063b8) --- source3/script/tests/selftest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index 515c95bdbd..d4264bab8c 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -70,7 +70,7 @@ export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR PATH=bin:$PATH export PATH -LD_LIBRARY_PATH=$BINDIR +LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$BINDIR" echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" export LD_LIBRARY_PATH -- cgit From 4e53afccb1470b8d889f7300ad77a497f38ed418 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 23 Dec 2007 20:09:16 +0100 Subject: selftest: also export LD_LIBRARY_PATH for samba4's smbtorture metze (This used to be commit f5570dcf503a4b28ebf624d06fd090f3b6b0a560) --- source3/script/tests/selftest.sh | 13 +++++++++++-- source3/script/tests/tests_all.sh | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index d4264bab8c..86abb15ed1 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -62,7 +62,6 @@ export PATH SOCKET_WRAPPER_DIR DOMAIN export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE export SRCDIR SCRIPTDIR BINDIR export USERNAME PASSWORD -export SMBTORTURE4 export WORKGROUP SERVER SERVER_IP export NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR @@ -70,10 +69,20 @@ export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR PATH=bin:$PATH export PATH -LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$BINDIR" +if test x"$LD_LIBRARY_PATH" != x""; then + LD_LIBRARY_PATH="$BINDIR:$LD_LIBRARY_PATH" +else + LD_LIBRARY_PATH="$BINDIR" +fi echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" export LD_LIBRARY_PATH +SAMBA4BINDIR=`dirname $SMBTORTURE4` +SAMBA4SHAREDDIR="$SAMBA4BINDIR/shared" + +export SAMBA4SHAREDDIR +export SMBTORTURE4 + ## ## verify that we were built with --enable-socket-wrapper ## diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index 12789aa926..109e9c2920 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -4,6 +4,9 @@ $SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" || fail $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP || failed=`expr $failed + $?` $SCRIPTDIR/test_wbinfo_s3.sh $WORKGROUP $SERVER $USERNAME $PASSWORD || failed=`expr $failed + $?` +LD_LIBRARY_PATH="$SAMBA4SHAREDDIR:$LD_LIBRARY_PATH" +echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH SMBTORTURE4VERSION=`$SMBTORTURE4 --version` if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then echo "Running Tests with Samba4's smbtorture" -- cgit From 8f163d5c5ae48a3ff1974e936b9316781eceff8a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 15:07:20 +0100 Subject: Move logic of net_conf_getparm() to libnet_conf.c. Michael (This used to be commit d3a20c4d5a8109334cd3ed665ba60cfcc4425059) --- source3/libnet/libnet_conf.c | 24 ++++++++++++++++++++++++ source3/utils/net_conf.c | 22 ++++++++++------------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 69a105f8f5..121ec35468 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -271,6 +271,30 @@ WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, return werr; } +WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, + const char *service, + const char *param, + struct registry_value **value) +{ + WERROR werr; + struct registry_key *key = NULL; + + if (!libnet_smbconf_key_exists(mem_ctx, service)) { + return WERR_NO_SUCH_SERVICE; + } + + werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_READ, &key); + W_ERROR_NOT_OK_RETURN(werr); + + if (!libnet_smbconf_value_exists(mem_ctx, key, param)) { + return WERR_INVALID_PARAM; + } + + werr = reg_queryvalue(mem_ctx, key, param, value); + + return werr; +} + WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, const char *service, const char *param) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 673d373177..f3f2321643 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -869,7 +869,6 @@ static int net_conf_getparm(int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; - struct registry_key *key = NULL; char *service = NULL; char *param = NULL; struct registry_value *value = NULL; @@ -884,21 +883,20 @@ static int net_conf_getparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - if (!libnet_smbconf_key_exists(ctx, service)) { + werr = libnet_smbconf_getparm(ctx, service, param, &value); + + if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, - "ERROR: given service '%s' does not exist.\n", + "Error: given service '%s' does not exist.\n", service); goto done; - } - - werr = libnet_smbconf_open_path(ctx, service, REG_KEY_READ, &key); - if (!W_ERROR_IS_OK(werr)) { + } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) { + d_fprintf(stderr, + "Error: given parameter '%s' is not set.\n", + param); goto done; - } - - werr = reg_queryvalue(ctx, key, param, &value); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error querying value '%s': %s.\n", + } else if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error getting value '%s': %s.\n", param, dos_errstr(werr)); goto done; } -- cgit From 6306005f4c12275df2f0cd2c2a95493bea36824d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 23:02:47 +0100 Subject: Remove redundant check of return value. Michael (This used to be commit 29f46c2d45e7ad7f8a9a525f9ac82c050a510967) --- source3/libnet/libnet_conf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 121ec35468..9eb5c16adc 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -314,9 +314,8 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, } werr = reg_deletevalue(key, param); - W_ERROR_NOT_OK_RETURN(werr); - return WERR_OK; + return werr; } -- cgit From 44860bce54d448316d2ac0bb9b0a2d0677d6c4eb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 23 Dec 2007 23:58:58 +0100 Subject: Fix rights error in libnet_smbconf_delparm(). Introduced by additional test for existence of given parameter. Michael (This used to be commit 0fe095e85ca981e5660a67f3fb7d7965ae62c667) --- source3/libnet/libnet_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 9eb5c16adc..3a64c3d844 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -306,7 +306,7 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, return WERR_NO_SUCH_SERVICE; } - werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_READ, &key); + werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_ALL, &key); W_ERROR_NOT_OK_RETURN(werr); if (!libnet_smbconf_value_exists(mem_ctx, key, param)) { -- cgit From 225dbe6c02e45b30541acb21f60cc20ddcfbf362 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 24 Dec 2007 00:47:43 +0100 Subject: Don't leak memory in libnet_smbconf_getparm(). Michael (This used to be commit 09e62c765401102480d39a483bfffaf5a054babc) --- source3/libnet/libnet_conf.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 3a64c3d844..d9a9e7de9b 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -280,18 +280,24 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, struct registry_key *key = NULL; if (!libnet_smbconf_key_exists(mem_ctx, service)) { - return WERR_NO_SUCH_SERVICE; + werr = WERR_NO_SUCH_SERVICE; + goto done; } werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_READ, &key); - W_ERROR_NOT_OK_RETURN(werr); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (!libnet_smbconf_value_exists(mem_ctx, key, param)) { - return WERR_INVALID_PARAM; + werr = WERR_INVALID_PARAM; + goto done; } werr = reg_queryvalue(mem_ctx, key, param, value); +done: + TALLOC_FREE(key); return werr; } -- cgit From c74579f49149171e731ae9b5a8e77c579d120cbb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 24 Dec 2007 00:53:22 +0100 Subject: Make libnet_smbconf_key_exists() use talloc_stackframe(). And not pass a talloc context. Michael (This used to be commit 7e8451f2f03b246801783aaf4b3d54465292f8f7) --- source3/libnet/libnet_conf.c | 18 ++++++------------ source3/utils/net_conf.c | 4 ++-- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index d9a9e7de9b..26e17f2ea3 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -62,24 +62,18 @@ done: /* * check if a subkey of KEY_SMBCONF of a given name exists */ -bool libnet_smbconf_key_exists(TALLOC_CTX *ctx, const char *subkeyname) +bool libnet_smbconf_key_exists(const char *subkeyname) { bool ret = False; WERROR werr = WERR_OK; - TALLOC_CTX *mem_ctx; - struct registry_key *key; - - if (!(mem_ctx = talloc_new(ctx))) { - d_fprintf(stderr, "ERROR: Out of memory...!\n"); - goto done; - } + TALLOC_CTX *mem_ctx = talloc_stackframe(); + struct registry_key *key = NULL; werr = libnet_smbconf_open_path_q(mem_ctx, subkeyname, REG_KEY_READ, &key); if (W_ERROR_IS_OK(werr)) { ret = True; } -done: TALLOC_FREE(mem_ctx); return ret; } @@ -257,7 +251,7 @@ WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, WERROR werr; struct registry_key *key = NULL; - if (!libnet_smbconf_key_exists(mem_ctx, service)) { + if (!libnet_smbconf_key_exists(service)) { werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service, &key); } else { @@ -279,7 +273,7 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, WERROR werr; struct registry_key *key = NULL; - if (!libnet_smbconf_key_exists(mem_ctx, service)) { + if (!libnet_smbconf_key_exists(service)) { werr = WERR_NO_SUCH_SERVICE; goto done; } @@ -308,7 +302,7 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, struct registry_key *key = NULL; WERROR werr = WERR_OK; - if (!libnet_smbconf_key_exists(mem_ctx, service)) { + if (!libnet_smbconf_key_exists(service)) { return WERR_NO_SUCH_SERVICE; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index f3f2321643..d09079c6f2 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -340,7 +340,7 @@ static int import_process_service(TALLOC_CTX *ctx, if (opt_testmode) { d_printf("[%s]\n", servicename); } else { - if (libnet_smbconf_key_exists(tmp_ctx, servicename)) { + if (libnet_smbconf_key_exists(servicename)) { werr = reg_delkey_internal(tmp_ctx, servicename); if (!W_ERROR_IS_OK(werr)) { goto done; @@ -424,7 +424,7 @@ int net_conf_list(int argc, const char **argv) goto done; } - if (libnet_smbconf_key_exists(ctx, GLOBAL_NAME)) { + if (libnet_smbconf_key_exists(GLOBAL_NAME)) { werr = reg_openkey(ctx, base_key, GLOBAL_NAME, REG_KEY_READ, &sub_key); if (!W_ERROR_IS_OK(werr)) { -- cgit From 434f0bcb02fe9df247527e1fa0372c94359f2f07 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 24 Dec 2007 00:56:24 +0100 Subject: Make libnet_smbconf_value_exists() use talloc_stackframe(). And not pass a talloc context. Michael (This used to be commit 2983aba9d092e6ede43f6eb521c17fe3f304d041) --- source3/libnet/libnet_conf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 26e17f2ea3..35eb740588 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -78,12 +78,12 @@ bool libnet_smbconf_key_exists(const char *subkeyname) return ret; } -static bool libnet_smbconf_value_exists(TALLOC_CTX *ctx, - struct registry_key *key, +static bool libnet_smbconf_value_exists(struct registry_key *key, const char *param) { bool ret = False; WERROR werr = WERR_OK; + TALLOC_CTX *ctx = talloc_stackframe(); struct registry_value *value = NULL; werr = reg_queryvalue(ctx, key, param, &value); @@ -91,7 +91,7 @@ static bool libnet_smbconf_value_exists(TALLOC_CTX *ctx, ret = True; } - TALLOC_FREE(value); + TALLOC_FREE(ctx); return ret; } @@ -283,7 +283,7 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - if (!libnet_smbconf_value_exists(mem_ctx, key, param)) { + if (!libnet_smbconf_value_exists(key, param)) { werr = WERR_INVALID_PARAM; goto done; } @@ -309,7 +309,7 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_ALL, &key); W_ERROR_NOT_OK_RETURN(werr); - if (!libnet_smbconf_value_exists(mem_ctx, key, param)) { + if (!libnet_smbconf_value_exists(key, param)) { return WERR_INVALID_PARAM; } -- cgit From 92b1ef15df560c9cc0429bc5ecb4084efe05610f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 24 Dec 2007 00:57:04 +0100 Subject: Use the appropriate boolean constants. Michael (This used to be commit 45e3e2451adc1490b62d39d486c169ad53e1d3f3) --- source3/libnet/libnet_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 35eb740588..ebf2d6654f 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -64,14 +64,14 @@ done: */ bool libnet_smbconf_key_exists(const char *subkeyname) { - bool ret = False; + bool ret = false; WERROR werr = WERR_OK; TALLOC_CTX *mem_ctx = talloc_stackframe(); struct registry_key *key = NULL; werr = libnet_smbconf_open_path_q(mem_ctx, subkeyname, REG_KEY_READ, &key); if (W_ERROR_IS_OK(werr)) { - ret = True; + ret = true; } TALLOC_FREE(mem_ctx); @@ -81,14 +81,14 @@ bool libnet_smbconf_key_exists(const char *subkeyname) static bool libnet_smbconf_value_exists(struct registry_key *key, const char *param) { - bool ret = False; + bool ret = false; WERROR werr = WERR_OK; TALLOC_CTX *ctx = talloc_stackframe(); struct registry_value *value = NULL; werr = reg_queryvalue(ctx, key, param, &value); if (W_ERROR_IS_OK(werr)) { - ret = True; + ret = true; } TALLOC_FREE(ctx); -- cgit From 713221e1c52db2df787ec8ec66c14f17b168cc78 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 24 Dec 2007 01:00:46 +0100 Subject: Do not leak memory in libnet_smbconf_setparm(). Michael (This used to be commit a657b1c9f17d3cebc86b596f1f2d244750d70a6d) --- source3/libnet/libnet_conf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ebf2d6654f..4945413bb1 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -258,10 +258,14 @@ WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_WRITE, &key); } - W_ERROR_NOT_OK_RETURN(werr); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } werr = libnet_smbconf_reg_setvalue_internal(key, param, valstr); +done: + TALLOC_FREE(key); return werr; } -- cgit From 3177cece659b12114e37033a22becc595649d07a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 24 Dec 2007 01:03:14 +0100 Subject: Do not leak memory in libnet_smbconf_delparm(). Michael (This used to be commit 49cfe2b9ebe03d5985187890445b775047f8a2f4) --- source3/libnet/libnet_conf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 4945413bb1..a371915a36 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -311,14 +311,19 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, } werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_ALL, &key); - W_ERROR_NOT_OK_RETURN(werr); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (!libnet_smbconf_value_exists(key, param)) { - return WERR_INVALID_PARAM; + werr = WERR_INVALID_PARAM; + goto done; } werr = reg_deletevalue(key, param); +done: + TALLOC_FREE(key); return werr; } -- cgit From 54861606f91d387b03f579a4c968f0c7cf66e0bd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 00:12:18 +0100 Subject: Attempt to fix the ifreq detection (This used to be commit 2d08959685b495caf1884babbece27775d8bcb4f) --- source3/configure.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/configure.in b/source3/configure.in index 1906d74505..a93e6fbdd5 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3026,10 +3026,12 @@ AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[ SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}" AC_TRY_RUN([ +#undef SOCKET_WRAPPER #define NO_CONFIG_H 1 #define HAVE_IFACE_IFREQ 1 #define AUTOCONF_TEST 1 #include "${srcdir-.}/lib/replace/replace.c" +#undef getnameinfo #include "${srcdir-.}/lib/interfaces.c"], samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)]) CPPFLAGS="$SAVE_CPPFLAGS" -- cgit From c9f65929b733353baec531c4735749a754f051c5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 02:21:30 +0100 Subject: Move reg_delkey_internal() to libnet/libnet_conf.c Michael (This used to be commit c1b863fd0520ce64a1bad5e2fa3f69afcc2c78d5) --- source3/libnet/libnet_conf.c | 24 ++++++++++++++++++++++++ source3/utils/net_conf.c | 24 ------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index a371915a36..30342e1e43 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -243,6 +243,30 @@ done: * **********************************************************************/ +/* + * delete a subkey of KEY_SMBCONF + */ +WERROR reg_delkey_internal(TALLOC_CTX *ctx, const char *keyname) +{ + WERROR werr = WERR_OK; + struct registry_key *key = NULL; + + werr = libnet_smbconf_open_basepath(ctx, REG_KEY_WRITE, &key); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + werr = reg_deletekey_recursive(key, key, keyname); + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error deleting registry key %s\\%s: %s\n", + KEY_SMBCONF, keyname, dos_errstr(werr)); + } + +done: + TALLOC_FREE(key); + return werr; +} + WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, const char *service, const char *param, diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index d09079c6f2..f45042b2f8 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -143,30 +143,6 @@ static char *format_value(TALLOC_CTX *mem_ctx, struct registry_value *value) return result; } -/* - * delete a subkey of KEY_SMBCONF - */ -static WERROR reg_delkey_internal(TALLOC_CTX *ctx, const char *keyname) -{ - WERROR werr = WERR_OK; - struct registry_key *key = NULL; - - werr = libnet_smbconf_open_basepath(ctx, REG_KEY_WRITE, &key); - if (!W_ERROR_IS_OK(werr)) { - goto done; - } - - werr = reg_deletekey_recursive(key, key, keyname); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error deleting registry key %s\\%s: %s\n", - KEY_SMBCONF, keyname, dos_errstr(werr)); - } - -done: - TALLOC_FREE(key); - return werr; -} - static WERROR list_values(TALLOC_CTX *ctx, struct registry_key *key) { WERROR werr = WERR_OK; -- cgit From 9c20b9a731d581ae8bbf4f9ef66c3b7ded7e4122 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 02:24:39 +0100 Subject: Rename reg_delkey_internal() to libnet_smbconf_delshare(). Michael (This used to be commit 7d501f0d78ec57509d0bc5ef0dc16fcd24ee27e7) --- source3/libnet/libnet_conf.c | 6 +++--- source3/utils/net_conf.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 30342e1e43..ad02930ce4 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -243,10 +243,10 @@ done: * **********************************************************************/ -/* - * delete a subkey of KEY_SMBCONF +/** + * delete a service from configuration */ -WERROR reg_delkey_internal(TALLOC_CTX *ctx, const char *keyname) +WERROR libnet_smbconf_delshare(TALLOC_CTX *ctx, const char *keyname) { WERROR werr = WERR_OK; struct registry_key *key = NULL; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index f45042b2f8..e1b4fe1dfa 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -317,7 +317,7 @@ static int import_process_service(TALLOC_CTX *ctx, d_printf("[%s]\n", servicename); } else { if (libnet_smbconf_key_exists(servicename)) { - werr = reg_delkey_internal(tmp_ctx, servicename); + werr = libnet_smbconf_delshare(tmp_ctx, servicename); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -799,7 +799,7 @@ int net_conf_delshare(int argc, const char **argv) } sharename = argv[0]; - if (W_ERROR_IS_OK(reg_delkey_internal(NULL, sharename))) { + if (W_ERROR_IS_OK(libnet_smbconf_delshare(NULL, sharename))) { ret = 0; } done: -- cgit From 86486fcc9826663f7bf03fe4ceb354818415d089 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 02:31:41 +0100 Subject: Simplify libnet_smbconf_delshare(). Remove talloc context parameter. Remove d_printf error message. Michael (This used to be commit 870d35c04889603843bae989fb9c01396b4c6ed1) --- source3/libnet/libnet_conf.c | 11 ++++------- source3/utils/net_conf.c | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ad02930ce4..4c5a0829d6 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -246,24 +246,21 @@ done: /** * delete a service from configuration */ -WERROR libnet_smbconf_delshare(TALLOC_CTX *ctx, const char *keyname) +WERROR libnet_smbconf_delshare(const char *servicename) { WERROR werr = WERR_OK; struct registry_key *key = NULL; + TALLOC_CTX *ctx = talloc_stackframe(); werr = libnet_smbconf_open_basepath(ctx, REG_KEY_WRITE, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } - werr = reg_deletekey_recursive(key, key, keyname); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error deleting registry key %s\\%s: %s\n", - KEY_SMBCONF, keyname, dos_errstr(werr)); - } + werr = reg_deletekey_recursive(key, key, servicename); done: - TALLOC_FREE(key); + TALLOC_FREE(ctx); return werr; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index e1b4fe1dfa..38c14d779f 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -317,7 +317,7 @@ static int import_process_service(TALLOC_CTX *ctx, d_printf("[%s]\n", servicename); } else { if (libnet_smbconf_key_exists(servicename)) { - werr = libnet_smbconf_delshare(tmp_ctx, servicename); + werr = libnet_smbconf_delshare(servicename); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -799,7 +799,7 @@ int net_conf_delshare(int argc, const char **argv) } sharename = argv[0]; - if (W_ERROR_IS_OK(libnet_smbconf_delshare(NULL, sharename))) { + if (W_ERROR_IS_OK(libnet_smbconf_delshare(sharename))) { ret = 0; } done: -- cgit From 734ddacc915aa6008b7189b4c8124bc8ee6b6890 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 02:42:33 +0100 Subject: Add error reporting to net_conf_delshare(). Michael (This used to be commit 8d02a2de61eb6b62fef1fbe57194c9d286423ba0) --- source3/utils/net_conf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 38c14d779f..54875c49a3 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -792,6 +792,7 @@ int net_conf_delshare(int argc, const char **argv) { int ret = -1; const char *sharename = NULL; + WERROR werr = WERR_OK; if (argc != 1) { net_conf_delshare_usage(argc, argv); @@ -799,9 +800,14 @@ int net_conf_delshare(int argc, const char **argv) } sharename = argv[0]; - if (W_ERROR_IS_OK(libnet_smbconf_delshare(sharename))) { - ret = 0; + werr = libnet_smbconf_delshare(sharename); + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error deleting share %s: %s\n", + sharename, dos_errstr(werr)); + goto done; } + + ret = 0; done: return ret; } -- cgit From 9626fffe14ebedba7ce53441bb4f9e2288a8410d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 02:48:45 +0100 Subject: Use the proper boolean constants in net_conf.c Michael (This used to be commit 1fe4ea63b197cb7ebc054909d888d74b5ad6523c) --- source3/utils/net_conf.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 54875c49a3..a10f983025 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -360,7 +360,7 @@ done: return ret; } -/* return True iff there are nondefault globals */ +/* return true iff there are nondefault globals */ static bool globals_exist(void) { int i = 0; @@ -368,10 +368,10 @@ static bool globals_exist(void) while ((parm = lp_next_parameter(GLOBAL_SECTION_SNUM, &i, 0)) != NULL) { if (parm->type != P_SEP) { - return True; + return true; } } - return False; + return false; } /* @@ -456,7 +456,7 @@ int net_conf_import(int argc, const char **argv) int ret = -1; const char *filename = NULL; const char *servicename = NULL; - bool service_found = False; + bool service_found = false; TALLOC_CTX *ctx; struct share_iterator *shares; struct share_params *share; @@ -480,10 +480,10 @@ int net_conf_import(int argc, const char **argv) filename)); if (!lp_load(filename, - False, /* global_only */ - True, /* save_defaults */ - False, /* add_ipc */ - True)) /* initialize_globals */ + false, /* global_only */ + true, /* save_defaults */ + false, /* add_ipc */ + true)) /* initialize_globals */ { d_fprintf(stderr, "Error parsing configuration file.\n"); goto done; @@ -497,7 +497,7 @@ int net_conf_import(int argc, const char **argv) if (((servicename == NULL) && globals_exist()) || strequal(servicename, GLOBAL_NAME)) { - service_found = True; + service_found = true; if (import_process_service(ctx, &global_share) != 0) { goto done; } @@ -516,7 +516,7 @@ int net_conf_import(int argc, const char **argv) if ((servicename == NULL) || strequal(servicename, lp_servicename(share->service))) { - service_found = True; + service_found = true; if (import_process_service(ctx, share)!= 0) { goto done; } -- cgit From 8e53343a74ab6c8947523ca9bd9a8c1583a8691e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 02:55:07 +0100 Subject: Move drop_smbconf_internal() to libnet_conf.c Michael (This used to be commit 4c2a3396bb687703f6b74655fda2014d1f75200b) --- source3/libnet/libnet_conf.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ source3/utils/net_conf.c | 50 -------------------------------------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 4c5a0829d6..e81b8b4111 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -243,6 +243,56 @@ done: * **********************************************************************/ +WERROR drop_smbconf_internal(TALLOC_CTX *ctx) +{ + char *path, *p; + WERROR werr = WERR_OK; + NT_USER_TOKEN *token; + struct registry_key *parent_key = NULL; + struct registry_key *new_key = NULL; + TALLOC_CTX* tmp_ctx = NULL; + enum winreg_CreateAction action; + + tmp_ctx = talloc_new(ctx); + if (tmp_ctx == NULL) { + werr = WERR_NOMEM; + goto done; + } + + if (!(token = registry_create_admin_token(tmp_ctx))) { + /* what is the appropriate error code here? */ + werr = WERR_CAN_NOT_COMPLETE; + goto done; + } + + path = talloc_strdup(tmp_ctx, KEY_SMBCONF); + if (path == NULL) { + d_fprintf(stderr, "ERROR: out of memory!\n"); + werr = WERR_NOMEM; + goto done; + } + p = strrchr(path, '\\'); + *p = '\0'; + werr = reg_open_path(tmp_ctx, path, REG_KEY_WRITE, token, &parent_key); + + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + werr = reg_deletekey_recursive(tmp_ctx, parent_key, p+1); + + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + werr = reg_createkey(tmp_ctx, parent_key, p+1, REG_KEY_WRITE, + &new_key, &action); + +done: + TALLOC_FREE(tmp_ctx); + return werr; +} + /** * delete a service from configuration */ diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index a10f983025..e46ff758ef 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -168,56 +168,6 @@ done: return werr; } -static WERROR drop_smbconf_internal(TALLOC_CTX *ctx) -{ - char *path, *p; - WERROR werr = WERR_OK; - NT_USER_TOKEN *token; - struct registry_key *parent_key = NULL; - struct registry_key *new_key = NULL; - TALLOC_CTX* tmp_ctx = NULL; - enum winreg_CreateAction action; - - tmp_ctx = talloc_new(ctx); - if (tmp_ctx == NULL) { - werr = WERR_NOMEM; - goto done; - } - - if (!(token = registry_create_admin_token(tmp_ctx))) { - /* what is the appropriate error code here? */ - werr = WERR_CAN_NOT_COMPLETE; - goto done; - } - - path = talloc_strdup(tmp_ctx, KEY_SMBCONF); - if (path == NULL) { - d_fprintf(stderr, "ERROR: out of memory!\n"); - werr = WERR_NOMEM; - goto done; - } - p = strrchr(path, '\\'); - *p = '\0'; - werr = reg_open_path(tmp_ctx, path, REG_KEY_WRITE, token, &parent_key); - - if (!W_ERROR_IS_OK(werr)) { - goto done; - } - - werr = reg_deletekey_recursive(tmp_ctx, parent_key, p+1); - - if (!W_ERROR_IS_OK(werr)) { - goto done; - } - - werr = reg_createkey(tmp_ctx, parent_key, p+1, REG_KEY_WRITE, - &new_key, &action); - -done: - TALLOC_FREE(tmp_ctx); - return werr; -} - static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm, struct share_params *share) { -- cgit From 2764f5a0a6404b1ade9b996783e0a131b7b2d231 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:01:59 +0100 Subject: Rename drop_smbconf_internal() to libnet_smbconf_drop(). Michael (This used to be commit 5873e6a1f8242e07b1699366a536350a7199c28c) --- source3/libnet/libnet_conf.c | 2 +- source3/utils/net_conf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index e81b8b4111..bc8dc9e4d0 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -243,7 +243,7 @@ done: * **********************************************************************/ -WERROR drop_smbconf_internal(TALLOC_CTX *ctx) +WERROR libnet_smbconf_drop(TALLOC_CTX *ctx) { char *path, *p; WERROR werr = WERR_OK; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index e46ff758ef..6d59643bee 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -538,7 +538,7 @@ int net_conf_drop(int argc, const char **argv) goto done; } - werr = drop_smbconf_internal(NULL); + werr = libnet_smbconf_drop(NULL); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error deleting configuration: %s\n", dos_errstr(werr)); -- cgit From e5a87c2543dea12488250eb8e15dcfe02b34dfe1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:05:06 +0100 Subject: Remove talloc context parameter from libnet_smbconf_drop(). Make use of talloc_stackframe. Michael (This used to be commit aaceab1153f6c2a2adde83681913c771a16ca81f) --- source3/libnet/libnet_conf.c | 22 ++++++++-------------- source3/utils/net_conf.c | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index bc8dc9e4d0..c85579b8e0 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -243,29 +243,23 @@ done: * **********************************************************************/ -WERROR libnet_smbconf_drop(TALLOC_CTX *ctx) +WERROR libnet_smbconf_drop(void) { char *path, *p; WERROR werr = WERR_OK; NT_USER_TOKEN *token; struct registry_key *parent_key = NULL; struct registry_key *new_key = NULL; - TALLOC_CTX* tmp_ctx = NULL; + TALLOC_CTX* mem_ctx = talloc_stackframe(); enum winreg_CreateAction action; - tmp_ctx = talloc_new(ctx); - if (tmp_ctx == NULL) { - werr = WERR_NOMEM; - goto done; - } - - if (!(token = registry_create_admin_token(tmp_ctx))) { + if (!(token = registry_create_admin_token(mem_ctx))) { /* what is the appropriate error code here? */ werr = WERR_CAN_NOT_COMPLETE; goto done; } - path = talloc_strdup(tmp_ctx, KEY_SMBCONF); + path = talloc_strdup(mem_ctx, KEY_SMBCONF); if (path == NULL) { d_fprintf(stderr, "ERROR: out of memory!\n"); werr = WERR_NOMEM; @@ -273,23 +267,23 @@ WERROR libnet_smbconf_drop(TALLOC_CTX *ctx) } p = strrchr(path, '\\'); *p = '\0'; - werr = reg_open_path(tmp_ctx, path, REG_KEY_WRITE, token, &parent_key); + werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token, &parent_key); if (!W_ERROR_IS_OK(werr)) { goto done; } - werr = reg_deletekey_recursive(tmp_ctx, parent_key, p+1); + werr = reg_deletekey_recursive(mem_ctx, parent_key, p+1); if (!W_ERROR_IS_OK(werr)) { goto done; } - werr = reg_createkey(tmp_ctx, parent_key, p+1, REG_KEY_WRITE, + werr = reg_createkey(mem_ctx, parent_key, p+1, REG_KEY_WRITE, &new_key, &action); done: - TALLOC_FREE(tmp_ctx); + TALLOC_FREE(mem_ctx); return werr; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 6d59643bee..9a6f5400e1 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -538,7 +538,7 @@ int net_conf_drop(int argc, const char **argv) goto done; } - werr = libnet_smbconf_drop(NULL); + werr = libnet_smbconf_drop(); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error deleting configuration: %s\n", dos_errstr(werr)); -- cgit From efd218fb070f4f819d313455660e74970fee7689 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:06:48 +0100 Subject: Remove a d_fprintf() from libnet_smbconf_drop(). Michael (This used to be commit 078e5e98b3589cec78893d44146a653dad9a7460) --- source3/libnet/libnet_conf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index c85579b8e0..5b3dea58ef 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -261,7 +261,6 @@ WERROR libnet_smbconf_drop(void) path = talloc_strdup(mem_ctx, KEY_SMBCONF); if (path == NULL) { - d_fprintf(stderr, "ERROR: out of memory!\n"); werr = WERR_NOMEM; goto done; } -- cgit From dff8e6b62c8f2a517e867a9137c8e1a777b129ad Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:08:00 +0100 Subject: Add comment header to function libnet_smbconf_drop(). Michael (This used to be commit e94edb6bdbc9379b48679d7c72618acfe862fe52) --- source3/libnet/libnet_conf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 5b3dea58ef..c9b4f20de3 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -243,6 +243,9 @@ done: * **********************************************************************/ +/** + * Drop the whole configuration (restarting empty). + */ WERROR libnet_smbconf_drop(void) { char *path, *p; -- cgit From a66a5fd94bfb8a41bdb46aedf7eba28b55fbdaaf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:16:25 +0100 Subject: Typofix in comment. Michael (This used to be commit 5039a70246a475176fa8212ad78b430f2211951f) --- source3/libnet/libnet_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index c9b4f20de3..be9edad4e9 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -397,7 +397,7 @@ done: /********************************************************************** * - * Convenience functions, that are also exportet. + * Convenience functions that are also exported. * **********************************************************************/ -- cgit From f3b0469b4a623c3ef17e2453bf40eb52778b5c42 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:29:05 +0100 Subject: Remove talloc context parameter from libnet_smbconf_setparm(). Make use of talloc stackframe internally. This removes talloc contxt from net_conf_setparm. Michael (This used to be commit efaffefc438f8375a083b194ac7a09e563000d3c) --- source3/libnet/libnet_conf.c | 11 +++++------ source3/libnet/libnet_join.c | 17 +++++++---------- source3/utils/net_conf.c | 6 +----- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index be9edad4e9..6ea97a82eb 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -310,13 +310,13 @@ done: return werr; } -WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, - const char *service, +WERROR libnet_smbconf_setparm(const char *service, const char *param, const char *valstr) { WERROR werr; struct registry_key *key = NULL; + TALLOC_CTX *mem_ctx = talloc_stackframe(); if (!libnet_smbconf_key_exists(service)) { werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service, @@ -332,7 +332,7 @@ WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, werr = libnet_smbconf_reg_setvalue_internal(key, param, valstr); done: - TALLOC_FREE(key); + TALLOC_FREE(mem_ctx); return werr; } @@ -401,10 +401,9 @@ done: * **********************************************************************/ -WERROR libnet_smbconf_set_global_param(TALLOC_CTX *mem_ctx, - const char *param, +WERROR libnet_smbconf_set_global_param(const char *param, const char *val) { - return libnet_smbconf_setparm(mem_ctx, GLOBAL_NAME, param, val); + return libnet_smbconf_setparm(GLOBAL_NAME, param, val); } diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 68244e5156..4f5c09cf47 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -339,11 +339,10 @@ static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx, if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) { - werr = libnet_smbconf_set_global_param(mem_ctx, "security", - "user"); + werr = libnet_smbconf_set_global_param("security", "user"); W_ERROR_NOT_OK_RETURN(werr); - werr = libnet_smbconf_set_global_param(mem_ctx, "workgroup", + werr = libnet_smbconf_set_global_param("workgroup", r->in.domain_name); return werr; } @@ -352,19 +351,18 @@ static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx, is_ad = true; } - werr = libnet_smbconf_set_global_param(mem_ctx, "security", "domain"); + werr = libnet_smbconf_set_global_param("security", "domain"); W_ERROR_NOT_OK_RETURN(werr); - werr = libnet_smbconf_set_global_param(mem_ctx, "workgroup", + werr = libnet_smbconf_set_global_param("workgroup", r->out.netbios_domain_name); W_ERROR_NOT_OK_RETURN(werr); if (is_ad) { - werr = libnet_smbconf_set_global_param(mem_ctx, "security", - "ads"); + werr = libnet_smbconf_set_global_param("security", "ads"); W_ERROR_NOT_OK_RETURN(werr); - werr = libnet_smbconf_set_global_param(mem_ctx, "realm", + werr = libnet_smbconf_set_global_param("realm", r->out.dns_domain_name); W_ERROR_NOT_OK_RETURN(werr); } @@ -379,8 +377,7 @@ static WERROR do_unjoin_modify_vals_config(TALLOC_CTX *mem_ctx, if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - werr = libnet_smbconf_set_global_param(mem_ctx, "security", - "user"); + werr = libnet_smbconf_set_global_param("security", "user"); W_ERROR_NOT_OK_RETURN(werr); } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 9a6f5400e1..eb6398f5b9 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -769,9 +769,6 @@ static int net_conf_setparm(int argc, const char **argv) char *service = NULL; char *param = NULL; const char *value_str = NULL; - TALLOC_CTX *ctx; - - ctx = talloc_init("setparm"); if (argc != 3) { net_conf_setparm_usage(argc, argv); @@ -781,7 +778,7 @@ static int net_conf_setparm(int argc, const char **argv) param = strdup_lower(argv[1]); value_str = argv[2]; - werr = libnet_smbconf_setparm(ctx, service, param, value_str); + werr = libnet_smbconf_setparm(service, param, value_str); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting value '%s': %s\n", @@ -793,7 +790,6 @@ static int net_conf_setparm(int argc, const char **argv) done: SAFE_FREE(service); - TALLOC_FREE(ctx); return ret; } -- cgit From 726f32b6728a7d2b56ccb2f04827d0e5150ea848 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:29:41 +0100 Subject: Add a missing free. Michael (This used to be commit bf6031287f75a0e17092f60f9885e7e55cd0f93c) --- source3/utils/net_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index eb6398f5b9..5d8b6d605b 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -790,6 +790,7 @@ static int net_conf_setparm(int argc, const char **argv) done: SAFE_FREE(service); + SAFE_FREE(param); return ret; } -- cgit From 44631bfd4d418cbf1ca4309057e6161cdce50bd4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:34:04 +0100 Subject: Remove talloc context parameter from libnet_smbconf_delparm(). Make use of talloc stackframe internally. This removes talloc contxt from net_conf_delparm. Michael (This used to be commit 16f137393881edc78c9322f038ba38e53e3ee07d) --- source3/libnet/libnet_conf.c | 6 +++--- source3/libnet/libnet_join.c | 2 +- source3/utils/net_conf.c | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 6ea97a82eb..bb0e637b33 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -366,12 +366,12 @@ done: return werr; } -WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, - const char *service, +WERROR libnet_smbconf_delparm(const char *service, const char *param) { struct registry_key *key = NULL; WERROR werr = WERR_OK; + TALLOC_CTX *mem_ctx = talloc_stackframe(); if (!libnet_smbconf_key_exists(service)) { return WERR_NO_SUCH_SERVICE; @@ -390,7 +390,7 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, werr = reg_deletevalue(key, param); done: - TALLOC_FREE(key); + TALLOC_FREE(mem_ctx); return werr; } diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 4f5c09cf47..e8d114d747 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -381,7 +381,7 @@ static WERROR do_unjoin_modify_vals_config(TALLOC_CTX *mem_ctx, W_ERROR_NOT_OK_RETURN(werr); } - werr = libnet_smbconf_delparm(mem_ctx, "GLOBAL", "realm"); + werr = libnet_smbconf_delparm("GLOBAL", "realm"); return werr; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 5d8b6d605b..5dc1eb06f4 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -846,9 +846,6 @@ static int net_conf_delparm(int argc, const char **argv) WERROR werr = WERR_OK; char *service = NULL; char *param = NULL; - TALLOC_CTX *ctx; - - ctx = talloc_init("delparm"); if (argc != 2) { net_conf_delparm_usage(argc, argv); @@ -857,7 +854,7 @@ static int net_conf_delparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - werr = libnet_smbconf_delparm(ctx, service, param); + werr = libnet_smbconf_delparm(service, param); if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, -- cgit From c2ab4bd70599cd7ff2043fef9904da178e6e4d19 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:35:00 +0100 Subject: Add two missing free-s. Michael (This used to be commit 4efac39c363d565c2c7211da73d5e1cf2ac3d0b2) --- source3/utils/net_conf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 5dc1eb06f4..df85d7eb4b 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -875,6 +875,8 @@ static int net_conf_delparm(int argc, const char **argv) ret = 0; done: + SAFE_FREE(service); + SAFE_FREE(param); return ret; } -- cgit From fc8be9d710fba6c05b098fafa7fb383a663853e2 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:38:06 +0100 Subject: Remove now unneeded talloc ctx parameter from do_unjoin_modify_vals_config(). Michael (This used to be commit 4f7375a110a69530d6ef9781573f45a5bf8391a5) --- source3/libnet/libnet_join.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index e8d114d747..b9ed4d56c7 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -370,8 +370,7 @@ static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx, return werr; } -static WERROR do_unjoin_modify_vals_config(TALLOC_CTX *mem_ctx, - struct libnet_UnjoinCtx *r) +static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) { WERROR werr = WERR_OK; @@ -424,7 +423,7 @@ static WERROR do_UnjoinConfig(TALLOC_CTX *mem_ctx, return WERR_OK; } - werr = do_unjoin_modify_vals_config(mem_ctx, r); + werr = do_unjoin_modify_vals_config(r); if (!W_ERROR_IS_OK(werr)) { return werr; } -- cgit From d25661a615a4c22dfe1e5c3a882f3be55cc5631f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:39:31 +0100 Subject: Remove now unneeded talloc ctx parameter from do_UnjoinConfig(). Michael (This used to be commit 92b8e5ea4ba26d663ea4e6fb65e4225d8259ea60) --- source3/libnet/libnet_join.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index b9ed4d56c7..663728a7a9 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -410,8 +410,7 @@ static WERROR do_JoinConfig(TALLOC_CTX *mem_ctx, return werr; } -static WERROR do_UnjoinConfig(TALLOC_CTX *mem_ctx, - struct libnet_UnjoinCtx *r) +static WERROR do_UnjoinConfig(struct libnet_UnjoinCtx *r) { WERROR werr; @@ -522,7 +521,7 @@ WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx, } } - werr = do_UnjoinConfig(mem_ctx, r); + werr = do_UnjoinConfig(r); if (!W_ERROR_IS_OK(werr)) { return werr; } -- cgit From 8445e820f29702c06d9bc71642ed58f63ffcc1c5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:40:35 +0100 Subject: Remove now unneeded talloc ctx parameter from do_join_modify_vals_config(). Michael (This used to be commit f8823ae1232022ed3f7f9be6b8959d413e8aed19) --- source3/libnet/libnet_join.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 663728a7a9..5301674f41 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -331,8 +331,7 @@ done: return status; } -static WERROR do_join_modify_vals_config(TALLOC_CTX *mem_ctx, - struct libnet_JoinCtx *r) +static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) { WERROR werr; bool is_ad = false; @@ -399,7 +398,7 @@ static WERROR do_JoinConfig(TALLOC_CTX *mem_ctx, return WERR_OK; } - werr = do_join_modify_vals_config(mem_ctx, r); + werr = do_join_modify_vals_config(r); if (!W_ERROR_IS_OK(werr)) { return werr; } -- cgit From a107e8421d8571d529be3cf1b7d4e0b8bde2cca9 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 03:41:34 +0100 Subject: Remove now unneeded talloc ctx parameter from do_JoinConfig(). Michael (This used to be commit be985d8d0ce80d12aa7f0b447b16b14aa0362826) --- source3/libnet/libnet_join.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 5301674f41..6edcdb8945 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -385,8 +385,7 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) } -static WERROR do_JoinConfig(TALLOC_CTX *mem_ctx, - struct libnet_JoinCtx *r) +static WERROR do_JoinConfig(struct libnet_JoinCtx *r) { WERROR werr; @@ -491,7 +490,7 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, } } - werr = do_JoinConfig(mem_ctx, r); + werr = do_JoinConfig(r); if (!W_ERROR_IS_OK(werr)) { return werr; } -- cgit From 921d8782ccb92d2c9a394bb2d281d3762d75dde6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 11:34:10 +0100 Subject: Fix the build (This used to be commit 72dc71710813ea9f1d8864c4401fef25a25577bd) --- source3/lib/netapi/serverinfo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 276a98c15e..27c7c4b2fc 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -167,8 +167,7 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, return WERR_NOT_SUPPORTED; } - return libnet_smbconf_set_global_param(ctx, - "server string", + return libnet_smbconf_set_global_param("server string", info1005->comment); } -- cgit From b410f254f094d86d964c73e1f94449575450687f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 11:59:34 +0100 Subject: Revert "Attempt to fix the ifreq detection" This reverts commit 2d08959685b495caf1884babbece27775d8bcb4f. (This used to be commit acb560900be29c407e7da955d16c2de7898e49b8) --- source3/configure.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/source3/configure.in b/source3/configure.in index a93e6fbdd5..1906d74505 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3026,12 +3026,10 @@ AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[ SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}" AC_TRY_RUN([ -#undef SOCKET_WRAPPER #define NO_CONFIG_H 1 #define HAVE_IFACE_IFREQ 1 #define AUTOCONF_TEST 1 #include "${srcdir-.}/lib/replace/replace.c" -#undef getnameinfo #include "${srcdir-.}/lib/interfaces.c"], samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)]) CPPFLAGS="$SAVE_CPPFLAGS" -- cgit From 1c26f38c166f7493e329835b31bc34f2e585ed46 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 12:00:53 +0100 Subject: Interface detection should not go through the socket wrapper Next try to get the build farm more in line again than it is now (This used to be commit 38e178df12d30672f74bf272338954c7917b59e3) --- source3/lib/interfaces.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/lib/interfaces.c b/source3/lib/interfaces.c index 722ab56abd..3797fc679d 100644 --- a/source3/lib/interfaces.c +++ b/source3/lib/interfaces.c @@ -84,6 +84,7 @@ #include #endif +#define SOCKET_WRAPPER_NOT_REPLACE #include "interfaces.h" #include "lib/replace/replace.h" -- cgit From ec54edd9eb67293ef89d18ed2da6f8811ed5604d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 13:34:14 +0100 Subject: make clean should remove everything in bin/ Jerry, you might want to review/change removing libwbclient.so.0 (This used to be commit 768e0439507caeff430358eb24dc9288a21c8a03) --- source3/Makefile.in | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/Makefile.in b/source3/Makefile.in index 53f7bf3dc4..10a14d0a55 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1996,6 +1996,7 @@ clean: delheaders $(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(ROOT_SBIN_PROGS) \ $(MODULES) $(TORTURE_PROGS) $(LIBSMBCLIENT) $(LIBADDNS) \ $(LIBSMBSHAREMODES) $(EVERYTHING_PROGS) $(LIBNETAPI) \ + bin/libwbclient.so.0 bin/timelimit \ .headers.stamp */src/*.o proto_exists -rm -rf t_dir -- cgit From afec8b523a52918c4f4761bbeb39266f874c7705 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 13:49:17 +0100 Subject: Next try to fix get_interfaces detection (This used to be commit 2dc0282f245c62b83b80f8da0394201e1c00f284) --- source3/configure.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/configure.in b/source3/configure.in index 1906d74505..f45dc66eef 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3012,6 +3012,7 @@ AC_TRY_RUN([ #define NO_CONFIG_H 1 #define HAVE_IFACE_IFCONF 1 #define AUTOCONF_TEST 1 +#define SOCKET_WRAPPER_NOT_REPLACE #include "${srcdir-.}/lib/replace/replace.c" #include "${srcdir-.}/lib/interfaces.c"], samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)]) @@ -3029,6 +3030,7 @@ AC_TRY_RUN([ #define NO_CONFIG_H 1 #define HAVE_IFACE_IFREQ 1 #define AUTOCONF_TEST 1 +#define SOCKET_WRAPPER_NOT_REPLACE #include "${srcdir-.}/lib/replace/replace.c" #include "${srcdir-.}/lib/interfaces.c"], samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)]) @@ -3047,6 +3049,7 @@ AC_TRY_RUN([ #define HAVE_IFACE_AIX 1 #define AUTOCONF_TEST 1 #undef _XOPEN_SOURCE_EXTENDED +#define SOCKET_WRAPPER_NOT_REPLACE #include "${srcdir-.}/lib/replace/replace.c" #include "${srcdir-.}/lib/interfaces.c"], samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)]) -- cgit From 199ecd9a8549fb198c3b0be4227b8021d42d6dda Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 14:19:50 +0100 Subject: ifreq needs more from lib/replace (This used to be commit e85290550ad33433f584009ffce34c81bea5b164) --- source3/configure.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/configure.in b/source3/configure.in index f45dc66eef..416453fdbe 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3032,6 +3032,8 @@ AC_TRY_RUN([ #define AUTOCONF_TEST 1 #define SOCKET_WRAPPER_NOT_REPLACE #include "${srcdir-.}/lib/replace/replace.c" +#include "${srcdir-.}/lib/replace/getaddrinfo.c" +#include "${srcdir-.}/lib/replace/snprintf.c" #include "${srcdir-.}/lib/interfaces.c"], samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)]) CPPFLAGS="$SAVE_CPPFLAGS" -- cgit From fae533d359854e11c2335bc4b9261132dca423be Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 18:36:49 +0100 Subject: AIX iface test needs rep_vasprintf (This used to be commit 3e5788cc9665acb450be793fb88db8e2a871aaa5) --- source3/configure.in | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/configure.in b/source3/configure.in index 416453fdbe..fb5cd03692 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3053,6 +3053,7 @@ AC_TRY_RUN([ #undef _XOPEN_SOURCE_EXTENDED #define SOCKET_WRAPPER_NOT_REPLACE #include "${srcdir-.}/lib/replace/replace.c" +#include "${srcdir-.}/lib/replace/snprintf.c" #include "${srcdir-.}/lib/interfaces.c"], samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)]) CPPFLAGS="$SAVE_CPPFLAGS" -- cgit From 8b88fa53b5f1f344b30b3409acf765ee46005396 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 18:37:42 +0100 Subject: Host SerNet-AIX has __ss_family instead of ss_family in sockaddr_storage (This used to be commit e33286f4a68352e55df081d06307f64f190773b3) --- source3/configure.in | 9 +++++++++ source3/lib/replace/system/network.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/source3/configure.in b/source3/configure.in index fb5cd03692..d7fde01619 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3042,6 +3042,15 @@ if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then fi fi +dnl AIX 5.3.0.0 +AC_TRY_COMPILE([#include ],[ +struct sockaddr_storage s; s.__ss_family = 0], +samba_cv_have_aix_sockaddr_storage=yes,samba_cv_have_aix_sockaddr_storage=no) + +if test x"$samba_cv_have_aix_sockaddr_storage" = x"yes"; then + AC_DEFINE(HAVE_AIX_SOCKADDR_STORAGE, 1, [Whether struct sockaddr_storage has __sa_family]) +fi + if test $iface = no; then AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[ SAVE_CPPFLAGS="$CPPFLAGS" diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index 9087c02da1..b6ae3c7c6f 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -233,6 +233,10 @@ typedef unsigned short int sa_family_t; #endif #endif +#ifdef HAVE_AIX_SOCKADDR_STORAGE +#define ss_family __ss_family +#endif + #ifndef HAVE_STRUCT_ADDRINFO #define HAVE_STRUCT_ADDRINFO struct addrinfo { -- cgit From e8cfbb0f4c58b45eb2585a8f130af017fd83adc8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 26 Dec 2007 00:53:19 +0100 Subject: Rename libnet_smbconf_open_path_q() to libnet_smbconf_open_path() removing previouse libnet_smbconf_open_path() and adding DEBUG output (instead of d_fprintf error output) to new libnet_smbconf_open_path(). Michael (This used to be commit e63cc54fab8a0b03573f76305eab366a3ee4eda1) --- source3/libnet/libnet_conf.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index bb0e637b33..3598f6c23c 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -29,12 +29,11 @@ /* * Open a subkey of KEY_SMBCONF (i.e a service) - * - variant without error output (q = quiet)- */ -static WERROR libnet_smbconf_open_path_q(TALLOC_CTX *ctx, - const char *subkeyname, - uint32 desired_access, - struct registry_key **key) +WERROR libnet_smbconf_open_path(TALLOC_CTX *ctx, + const char *subkeyname, + uint32 desired_access, + struct registry_key **key) { WERROR werr = WERR_OK; char *path = NULL; @@ -54,6 +53,11 @@ static WERROR libnet_smbconf_open_path_q(TALLOC_CTX *ctx, werr = reg_open_path(ctx, path, desired_access, token, key); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, ("Error opening registry path '%s': %s\n", + path, dos_errstr(werr))); + } + done: TALLOC_FREE(path); return werr; @@ -69,7 +73,7 @@ bool libnet_smbconf_key_exists(const char *subkeyname) TALLOC_CTX *mem_ctx = talloc_stackframe(); struct registry_key *key = NULL; - werr = libnet_smbconf_open_path_q(mem_ctx, subkeyname, REG_KEY_READ, &key); + werr = libnet_smbconf_open_path(mem_ctx, subkeyname, REG_KEY_READ, &key); if (W_ERROR_IS_OK(werr)) { ret = true; } @@ -95,27 +99,6 @@ static bool libnet_smbconf_value_exists(struct registry_key *key, return ret; } -/* - * Open a subkey of KEY_SMBCONF (i.e a service) - * - variant with error output - - */ -WERROR libnet_smbconf_open_path(TALLOC_CTX *ctx, const char *subkeyname, - uint32 desired_access, - struct registry_key **key) -{ - WERROR werr = WERR_OK; - - werr = libnet_smbconf_open_path_q(ctx, subkeyname, desired_access, key); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error opening registry path '%s\\%s': %s\n", - KEY_SMBCONF, - (subkeyname == NULL) ? "" : subkeyname, - dos_errstr(werr)); - } - - return werr; -} - /* * open the base key KEY_SMBCONF */ -- cgit From 18ea20e19b59d3151ca59f0576211f855931f839 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 26 Dec 2007 00:58:11 +0100 Subject: Rename libnet_smbconf_open_path() to libnet_smbconf_reg_open_path(). Michael (This used to be commit 4b0e636965bd37e7c0deecb7b5eff0cc4487408b) --- source3/libnet/libnet_conf.c | 22 ++++++++++++---------- source3/utils/net_conf.c | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 3598f6c23c..59989eccd5 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -30,10 +30,10 @@ /* * Open a subkey of KEY_SMBCONF (i.e a service) */ -WERROR libnet_smbconf_open_path(TALLOC_CTX *ctx, - const char *subkeyname, - uint32 desired_access, - struct registry_key **key) +WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *ctx, + const char *subkeyname, + uint32 desired_access, + struct registry_key **key) { WERROR werr = WERR_OK; char *path = NULL; @@ -73,7 +73,8 @@ bool libnet_smbconf_key_exists(const char *subkeyname) TALLOC_CTX *mem_ctx = talloc_stackframe(); struct registry_key *key = NULL; - werr = libnet_smbconf_open_path(mem_ctx, subkeyname, REG_KEY_READ, &key); + werr = libnet_smbconf_reg_open_path(mem_ctx, subkeyname, REG_KEY_READ, + &key); if (W_ERROR_IS_OK(werr)) { ret = true; } @@ -105,7 +106,7 @@ static bool libnet_smbconf_value_exists(struct registry_key *key, WERROR libnet_smbconf_open_basepath(TALLOC_CTX *ctx, uint32 desired_access, struct registry_key **key) { - return libnet_smbconf_open_path(ctx, NULL, desired_access, key); + return libnet_smbconf_reg_open_path(ctx, NULL, desired_access, key); } /* @@ -305,8 +306,8 @@ WERROR libnet_smbconf_setparm(const char *service, werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service, &key); } else { - werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_WRITE, - &key); + werr = libnet_smbconf_reg_open_path(mem_ctx, service, + REG_KEY_WRITE, &key); } if (!W_ERROR_IS_OK(werr)) { goto done; @@ -332,7 +333,8 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_READ, &key); + werr = libnet_smbconf_reg_open_path(mem_ctx, service, REG_KEY_READ, + &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -360,7 +362,7 @@ WERROR libnet_smbconf_delparm(const char *service, return WERR_NO_SUCH_SERVICE; } - werr = libnet_smbconf_open_path(mem_ctx, service, REG_KEY_ALL, &key); + werr = libnet_smbconf_reg_open_path(mem_ctx, service, REG_KEY_ALL, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index df85d7eb4b..348e91a15f 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -565,7 +565,7 @@ int net_conf_showshare(int argc, const char **argv) goto done; } - werr = libnet_smbconf_open_path(ctx, argv[0], REG_KEY_READ, &key); + werr = libnet_smbconf_reg_open_path(ctx, argv[0], REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From afca308742795a34e58f7a049c9a8d86cdff80c1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 26 Dec 2007 01:01:14 +0100 Subject: Rename libnet_smbconf_open_basepath() to libnet_smbconf_reg_open_basepath(). Michael (This used to be commit 4c0e7270c42788e7f77c402032ae74cf0f8a7106) --- source3/libnet/libnet_conf.c | 9 +++++---- source3/utils/net_conf.c | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 59989eccd5..3c765769fe 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -103,8 +103,8 @@ static bool libnet_smbconf_value_exists(struct registry_key *key, /* * open the base key KEY_SMBCONF */ -WERROR libnet_smbconf_open_basepath(TALLOC_CTX *ctx, uint32 desired_access, - struct registry_key **key) +WERROR libnet_smbconf_reg_open_basepath(TALLOC_CTX *ctx, uint32 desired_access, + struct registry_key **key) { return libnet_smbconf_reg_open_path(ctx, NULL, desired_access, key); } @@ -129,7 +129,8 @@ WERROR libnet_smbconf_reg_createkey_internal(TALLOC_CTX *ctx, goto done; } - werr = libnet_smbconf_open_basepath(create_ctx, REG_KEY_WRITE, &create_parent); + werr = libnet_smbconf_reg_open_basepath(create_ctx, REG_KEY_WRITE, + &create_parent); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -282,7 +283,7 @@ WERROR libnet_smbconf_delshare(const char *servicename) struct registry_key *key = NULL; TALLOC_CTX *ctx = talloc_stackframe(); - werr = libnet_smbconf_open_basepath(ctx, REG_KEY_WRITE, &key); + werr = libnet_smbconf_reg_open_basepath(ctx, REG_KEY_WRITE, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 348e91a15f..8b89f2fa6f 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -345,7 +345,7 @@ int net_conf_list(int argc, const char **argv) goto done; } - werr = libnet_smbconf_open_basepath(ctx, REG_KEY_READ, &base_key); + werr = libnet_smbconf_reg_open_basepath(ctx, REG_KEY_READ, &base_key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -503,7 +503,8 @@ int net_conf_listshares(int argc, const char **argv) goto done; } - werr = libnet_smbconf_open_basepath(ctx, SEC_RIGHTS_ENUM_SUBKEYS, &key); + werr = libnet_smbconf_reg_open_basepath(ctx, SEC_RIGHTS_ENUM_SUBKEYS, + &key); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From f99af84e6a48c8e3e3e4af9f06d31669a6fb2d90 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 26 Dec 2007 01:03:28 +0100 Subject: Move libnet_smbconf_reg_open_basepath() in source file to group helper functions more logically. Michael (This used to be commit 3fa3891f8721e9f02594cd1be2dc6b9b88692416) --- source3/libnet/libnet_conf.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 3c765769fe..93e13009a4 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -63,6 +63,15 @@ done: return werr; } +/* + * open the base key KEY_SMBCONF + */ +WERROR libnet_smbconf_reg_open_basepath(TALLOC_CTX *ctx, uint32 desired_access, + struct registry_key **key) +{ + return libnet_smbconf_reg_open_path(ctx, NULL, desired_access, key); +} + /* * check if a subkey of KEY_SMBCONF of a given name exists */ @@ -100,15 +109,6 @@ static bool libnet_smbconf_value_exists(struct registry_key *key, return ret; } -/* - * open the base key KEY_SMBCONF - */ -WERROR libnet_smbconf_reg_open_basepath(TALLOC_CTX *ctx, uint32 desired_access, - struct registry_key **key) -{ - return libnet_smbconf_reg_open_path(ctx, NULL, desired_access, key); -} - /* * create a subkey of KEY_SMBCONF */ -- cgit From 250c57ccfbae343e8d713c768d0288f73a0a5013 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 26 Dec 2007 14:18:11 +0100 Subject: We need to return the correct atime On systems with nanosecond atime we need to re-stat after messing with the fd, at least Solaris 10 updates atime after we stat(2)ed the file. (This used to be commit 6e6ec0a563f8b7e3d4618ce60e776bcce53f40c4) --- source3/smbd/open.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 9428b47b6a..f30808b30a 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2667,7 +2667,12 @@ NTSTATUS create_file_unixpath(connection_struct *conn, *pinfo = info; } if (psbuf != NULL) { - *psbuf = sbuf; + if ((fsp->fh == NULL) || (fsp->fh->fd == -1)) { + *psbuf = sbuf; + } + else { + SMB_VFS_FSTAT(fsp, fsp->fh->fd, psbuf); + } } return NT_STATUS_OK; -- cgit From 533c7c81fe9c5ca9f8936e1e6f2eb7502cbd653f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 24 Dec 2007 12:58:40 +0100 Subject: Add tdbsam_search_users (This used to be commit 02f0b0bd393bd942fc934f251bd6afed8e5424b0) --- source3/passdb/pdb_tdb.c | 134 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index b4282b1278..1c2278ba7d 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -1592,6 +1592,139 @@ static bool tdbsam_new_rid(struct pdb_methods *methods, uint32 *prid) return ret; } +struct tdbsam_search_state { + struct pdb_methods *methods; + uint32_t acct_flags; + + uint32_t *rids; + uint32_t num_rids; + ssize_t array_size; + uint32_t current; +}; + +static int tdbsam_collect_rids(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, + void *private_data) +{ + struct tdbsam_search_state *state = talloc_get_type_abort( + private_data, struct tdbsam_search_state); + size_t prefixlen = strlen(RIDPREFIX); + uint32 rid; + + if ((key.dsize < prefixlen) + || (strncmp((char *)key.dptr, RIDPREFIX, prefixlen))) { + return 0; + } + + rid = strtoul((char *)key.dptr+prefixlen, NULL, 16); + + ADD_TO_LARGE_ARRAY(state, uint32, rid, &state->rids, &state->num_rids, + &state->array_size); + + return 0; +} + +static void tdbsam_search_end(struct pdb_search *search) +{ + struct tdbsam_search_state *state = talloc_get_type_abort( + search->private_data, struct tdbsam_search_state); + TALLOC_FREE(state); +} + +static bool tdbsam_search_next_entry(struct pdb_search *search, + struct samr_displayentry *entry) +{ + struct tdbsam_search_state *state = talloc_get_type_abort( + search->private_data, struct tdbsam_search_state); + struct samu *user = NULL; + NTSTATUS status; + uint32_t rid; + + again: + TALLOC_FREE(user); + user = samu_new(talloc_tos()); + if (user == NULL) { + DEBUG(0, ("samu_new failed\n")); + return false; + } + + if (state->current == state->num_rids) { + return false; + } + + rid = state->rids[state->current++]; + + status = tdbsam_getsampwrid(state->methods, user, rid); + + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { + /* + * Someone has deleted that user since we listed the RIDs + */ + goto again; + } + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("tdbsam_getsampwrid failed: %s\n", + nt_errstr(status))); + TALLOC_FREE(user); + return false; + } + + if ((state->acct_flags != 0) && + ((state->acct_flags & pdb_get_acct_ctrl(user)) == 0)) { + goto again; + } + + entry->acct_flags = pdb_get_acct_ctrl(user); + entry->rid = rid; + entry->account_name = talloc_strdup( + search->mem_ctx, pdb_get_username(user)); + entry->fullname = talloc_strdup( + search->mem_ctx, pdb_get_fullname(user)); + entry->description = talloc_strdup( + search->mem_ctx, pdb_get_acct_desc(user)); + + TALLOC_FREE(user); + + if ((entry->account_name == NULL) || (entry->fullname == NULL) + || (entry->description == NULL)) { + DEBUG(0, ("talloc_strdup failed\n")); + return false; + } + + return true; +} + +static bool tdbsam_search_users(struct pdb_methods *methods, + struct pdb_search *search, + uint32 acct_flags) +{ + struct tdbsam_search_state *state; + + if (!tdbsam_open(tdbsam_filename)) { + DEBUG(0,("tdbsam_getsampwnam: failed to open %s!\n", + tdbsam_filename)); + return false; + } + + state = TALLOC_ZERO_P(search->mem_ctx, struct tdbsam_search_state); + if (state == NULL) { + DEBUG(0, ("talloc failed\n")); + return false; + } + state->acct_flags = acct_flags; + state->methods = methods; + + tdb_traverse(tdbsam, tdbsam_collect_rids, state); + + tdbsam_close(); + + search->private_data = state; + search->next_entry = tdbsam_search_next_entry; + search->search_end = tdbsam_search_end; + + return true; +} + /********************************************************************* Initialize the tdb sam backend. Setup the dispath table of methods, open the tdb, etc... @@ -1618,6 +1751,7 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc (*pdb_method)->update_sam_account = tdbsam_update_sam_account; (*pdb_method)->delete_sam_account = tdbsam_delete_sam_account; (*pdb_method)->rename_sam_account = tdbsam_rename_sam_account; + (*pdb_method)->search_users = tdbsam_search_users; (*pdb_method)->rid_algorithm = tdbsam_rid_algorithm; (*pdb_method)->new_rid = tdbsam_new_rid; -- cgit From f633d348d70525b856aaae586626decfbc024db9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 25 Dec 2007 00:04:39 +0100 Subject: smbpasswd_search_users (This used to be commit 84af4fb65677cf137f14f57c8820c77c9d006d89) --- source3/passdb/pdb_smbpasswd.c | 114 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 6a3bdb80a2..21cd988cff 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -1606,6 +1606,119 @@ static void free_private_data(void **vp) /* No need to free any further, as it is talloc()ed */ } +struct smbpasswd_search_state { + uint32_t acct_flags; + + struct samr_displayentry *entries; + uint32_t num_entries; + ssize_t array_size; + uint32_t current; +}; + +static void smbpasswd_search_end(struct pdb_search *search) +{ + struct smbpasswd_search_state *state = talloc_get_type_abort( + search->private_data, struct smbpasswd_search_state); + TALLOC_FREE(state); +} + +static bool smbpasswd_search_next_entry(struct pdb_search *search, + struct samr_displayentry *entry) +{ + struct smbpasswd_search_state *state = talloc_get_type_abort( + search->private_data, struct smbpasswd_search_state); + + if (state->current == state->num_entries) { + return false; + } + + *entry = state->entries[state->current++]; + + return true; +} + +static bool smbpasswd_search_users(struct pdb_methods *methods, + struct pdb_search *search, + uint32_t acct_flags) +{ + struct smbpasswd_privates *smbpasswd_state = + (struct smbpasswd_privates*)methods->private_data; + + struct smbpasswd_search_state *search_state; + struct smb_passwd *pwd; + FILE *fp; + + search_state = TALLOC_ZERO_P(search->mem_ctx, + struct smbpasswd_search_state); + if (search_state == NULL) { + DEBUG(0, ("talloc failed\n")); + return false; + } + search_state->acct_flags = acct_flags; + + fp = startsmbfilepwent(smbpasswd_state->smbpasswd_file, PWF_READ, + &smbpasswd_state->pw_file_lock_depth); + + if (fp == NULL) { + DEBUG(10, ("Unable to open smbpasswd file.\n")); + TALLOC_FREE(search_state); + return false; + } + + while ((pwd = getsmbfilepwent(smbpasswd_state, fp)) != NULL) { + struct samr_displayentry entry; + struct samu *user; + + if ((acct_flags != 0) + && ((acct_flags & pwd->acct_ctrl) == 0)) { + continue; + } + + user = samu_new(talloc_tos()); + if (user == NULL) { + DEBUG(0, ("samu_new failed\n")); + break; + } + + if (!build_sam_account(smbpasswd_state, user, pwd)) { + /* Already got debug msgs... */ + break; + } + + ZERO_STRUCT(entry); + + entry.acct_flags = pdb_get_acct_ctrl(user); + sid_peek_rid(pdb_get_user_sid(user), &entry.rid); + entry.account_name = talloc_strdup( + search_state, pdb_get_username(user)); + entry.fullname = talloc_strdup( + search_state, pdb_get_fullname(user)); + entry.description = talloc_strdup( + search_state, pdb_get_acct_desc(user)); + + TALLOC_FREE(user); + + if ((entry.account_name == NULL) || (entry.fullname == NULL) + || (entry.description == NULL)) { + DEBUG(0, ("talloc_strdup failed\n")); + break; + } + + ADD_TO_LARGE_ARRAY(search_state, struct samr_displayentry, + entry, &search_state->entries, + &search_state->num_entries, + &search_state->array_size); + } + + endsmbfilepwent(fp, &(smbpasswd_state->pw_file_lock_depth)); + + search->private_data = search_state; + search->next_entry = smbpasswd_search_next_entry; + search->search_end = smbpasswd_search_end; + + return true; +} + static NTSTATUS pdb_init_smbpasswd( struct pdb_methods **pdb_method, const char *location ) { NTSTATUS nt_status; @@ -1626,6 +1739,7 @@ static NTSTATUS pdb_init_smbpasswd( struct pdb_methods **pdb_method, const char (*pdb_method)->update_sam_account = smbpasswd_update_sam_account; (*pdb_method)->delete_sam_account = smbpasswd_delete_sam_account; (*pdb_method)->rename_sam_account = smbpasswd_rename_sam_account; + (*pdb_method)->search_users = smbpasswd_search_users; (*pdb_method)->rid_algorithm = smbpasswd_rid_algorithm; -- cgit From 5f196fafd3a8ed9dda189b62bcd24105bb693456 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 26 Dec 2007 17:06:06 +0100 Subject: Properly destroy the pdb search object (This used to be commit 514cf532248723e7f775dc5f8f2e6936e02b7a1c) --- source3/utils/net_sam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c index bd1f6cd686..52f8f911e1 100644 --- a/source3/utils/net_sam.c +++ b/source3/utils/net_sam.c @@ -1135,7 +1135,7 @@ static int net_sam_do_list(int argc, const char **argv, } } - search->search_end(search); + pdb_search_destroy(search); return 0; } -- cgit From c90f731ef21d682f808cf3da0f24510a2eaea4ff Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 26 Dec 2007 17:45:49 +0100 Subject: Convert pdbedit to use pdb_search_users (This used to be commit 8a8f2583b8bda22f65c7483dea54ac823ed1c0c3) --- source3/utils/pdbedit.c | 201 +++++++++++++++++++++++++++++------------------- 1 file changed, 123 insertions(+), 78 deletions(-) diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index 6884783396..e1d6709073 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -61,69 +61,85 @@ static int export_database (struct pdb_methods *in, struct pdb_methods *out, const char *username) { - struct samu *user = NULL; NTSTATUS status; + struct pdb_search *u_search; + struct samr_displayentry userentry; DEBUG(3, ("export_database: username=\"%s\"\n", username ? username : "(NULL)")); - status = in->setsampwent(in, 0, 0); - if ( NT_STATUS_IS_ERR(status) ) { - fprintf(stderr, "Unable to set account database iterator for %s!\n", - in->name); + u_search = pdb_search_init(PDB_USER_SEARCH); + if (u_search == NULL) { + DEBUG(0, ("pdb_search_init failed\n")); return 1; } - if ( ( user = samu_new( NULL ) ) == NULL ) { - fprintf(stderr, "export_database: Memory allocation failure!\n"); + if (!in->search_users(in, u_search, 0)) { + DEBUG(0, ("Could not start searching users\n")); + pdb_search_destroy(u_search); return 1; } - while ( NT_STATUS_IS_OK(in->getsampwent(in, user)) ) - { - DEBUG(4, ("Processing account %s\n", user->username)); + while (u_search->next_entry(u_search, &userentry)) { + struct samu *user; + struct samu *account; + DOM_SID user_sid; - /* If we don't have a specific user or if we do and - the login name matches */ + DEBUG(4, ("Processing account %s\n", userentry.account_name)); - if ( !username || (strcmp(username, user->username) == 0)) { - struct samu *account; + if ((username != NULL) + && (strcmp(username, userentry.account_name) != 0)) { + /* + * ignore unwanted users + */ + continue; + } - if ( (account = samu_new( NULL )) == NULL ) { - fprintf(stderr, "export_database: Memory allocation failure!\n"); - TALLOC_FREE( user ); - in->endsampwent( in ); - return 1; - } + user = samu_new(talloc_tos()); + if (user == NULL) { + DEBUG(0, ("talloc failed\n")); + break; + } - printf("Importing account for %s...", user->username); - if ( !NT_STATUS_IS_OK(out->getsampwnam( out, account, user->username )) ) { - status = out->add_sam_account(out, user); - } else { - status = out->update_sam_account( out, user ); - } + sid_compose(&user_sid, get_global_sam_sid(), userentry.rid); - if ( NT_STATUS_IS_OK(status) ) { - printf( "ok\n"); - } else { - printf( "failed\n"); - } + status = in->getsampwsid(in, user, &user_sid); - TALLOC_FREE( account ); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(2, ("getsampwsid failed: %s\n", + nt_errstr(status))); + TALLOC_FREE(user); + continue; } - /* clean up and get ready for another run */ + account = samu_new(NULL); + if (account == NULL) { + fprintf(stderr, "export_database: Memory allocation " + "failure!\n"); + TALLOC_FREE( user ); + pdb_search_destroy(u_search); + return 1; + } - TALLOC_FREE( user ); + printf("Importing account for %s...", user->username); + status = out->getsampwnam(out, account, user->username); - if ( ( user = samu_new( NULL ) ) == NULL ) { - fprintf(stderr, "export_database: Memory allocation failure!\n"); - return 1; + if (NT_STATUS_IS_OK(status)) { + status = out->update_sam_account( out, user ); + } else { + status = out->add_sam_account(out, user); + } + + if ( NT_STATUS_IS_OK(status) ) { + printf( "ok\n"); + } else { + printf( "failed\n"); } - } - TALLOC_FREE( user ); + TALLOC_FREE( account ); + TALLOC_FREE( user ); + } - in->endsampwent(in); + pdb_search_destroy(u_search); return 0; } @@ -326,33 +342,50 @@ static int print_user_info (struct pdb_methods *in, const char *username, bool v **********************************************************/ static int print_users_list (struct pdb_methods *in, bool verbosity, bool smbpwdstyle) { - struct samu *sam_pwent=NULL; - bool check; - - check = NT_STATUS_IS_OK(in->setsampwent(in, False, 0)); - if (!check) { + struct pdb_search *u_search; + struct samr_displayentry userentry; + + u_search = pdb_search_init(PDB_USER_SEARCH); + if (u_search == NULL) { + DEBUG(0, ("pdb_search_init failed\n")); return 1; } - check = True; - if ( (sam_pwent = samu_new( NULL )) == NULL ) { + if (!in->search_users(in, u_search, 0)) { + DEBUG(0, ("Could not start searching users\n")); + pdb_search_destroy(u_search); return 1; } - while (check && NT_STATUS_IS_OK(in->getsampwent (in, sam_pwent))) { + while (u_search->next_entry(u_search, &userentry)) { + struct samu *sam_pwent; + DOM_SID user_sid; + NTSTATUS status; + + sam_pwent = samu_new(talloc_tos()); + if (sam_pwent == NULL) { + DEBUG(0, ("talloc failed\n")); + break; + } + + sid_compose(&user_sid, get_global_sam_sid(), userentry.rid); + + status = in->getsampwsid(in, sam_pwent, &user_sid); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(2, ("getsampwsid failed: %s\n", + nt_errstr(status))); + TALLOC_FREE(sam_pwent); + continue; + } + if (verbosity) printf ("---------------\n"); print_sam_info (sam_pwent, verbosity, smbpwdstyle); TALLOC_FREE(sam_pwent); - - if ( (sam_pwent = samu_new( NULL )) == NULL ) { - check = False; - } } - if (check) - TALLOC_FREE(sam_pwent); - - in->endsampwent(in); + pdb_search_destroy(u_search); + return 0; } @@ -361,38 +394,50 @@ static int print_users_list (struct pdb_methods *in, bool verbosity, bool smbpwd **********************************************************/ static int fix_users_list (struct pdb_methods *in) { - struct samu *sam_pwent=NULL; - bool check; - - check = NT_STATUS_IS_OK(in->setsampwent(in, False, 0)); - if (!check) { + struct pdb_search *u_search; + struct samr_displayentry userentry; + + u_search = pdb_search_init(PDB_USER_SEARCH); + if (u_search == NULL) { + DEBUG(0, ("pdb_search_init failed\n")); return 1; } - check = True; - if ( (sam_pwent = samu_new( NULL )) == NULL ) { + if (!in->search_users(in, u_search, 0)) { + DEBUG(0, ("Could not start searching users\n")); + pdb_search_destroy(u_search); return 1; } - while (check && NT_STATUS_IS_OK(in->getsampwent (in, sam_pwent))) { - printf("Updating record for user %s\n", pdb_get_username(sam_pwent)); - - if (!NT_STATUS_IS_OK(pdb_update_sam_account(sam_pwent))) { - printf("Update of user %s failed!\n", pdb_get_username(sam_pwent)); + while (u_search->next_entry(u_search, &userentry)) { + struct samu *sam_pwent; + DOM_SID user_sid; + NTSTATUS status; + + sam_pwent = samu_new(talloc_tos()); + if (sam_pwent == NULL) { + DEBUG(0, ("talloc failed\n")); + break; } - TALLOC_FREE(sam_pwent); - if ( (sam_pwent = samu_new( NULL )) == NULL ) { - check = False; + + sid_compose(&user_sid, get_global_sam_sid(), userentry.rid); + + status = in->getsampwsid(in, sam_pwent, &user_sid); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(2, ("getsampwsid failed: %s\n", + nt_errstr(status))); + TALLOC_FREE(sam_pwent); + continue; } - if (!check) { - fprintf(stderr, "Failed to initialise new struct samu structure (out of memory?)\n"); + + if (!NT_STATUS_IS_OK(pdb_update_sam_account(sam_pwent))) { + printf("Update of user %s failed!\n", + pdb_get_username(sam_pwent)); } - - } - if (check) TALLOC_FREE(sam_pwent); - - in->endsampwent(in); + } + pdb_search_destroy(u_search); return 0; } -- cgit From e70c97ef85b309d6e005c07e16a003725d21ffc8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 26 Dec 2007 17:58:55 +0100 Subject: Remove the sampwent interface (This used to be commit 9e80b969fb40766de2c9b1a05d16bf4d4c6e46f7) --- source3/include/passdb.h | 9 +-- source3/passdb/pdb_interface.c | 123 +--------------------------------- source3/passdb/pdb_ldap.c | 102 ---------------------------- source3/passdb/pdb_smbpasswd.c | 76 --------------------- source3/passdb/pdb_tdb.c | 146 ----------------------------------------- source3/torture/pdbtest.c | 18 ----- 6 files changed, 3 insertions(+), 471 deletions(-) diff --git a/source3/include/passdb.h b/source3/include/passdb.h index bb8a336b8c..b72ec6b0ba 100644 --- a/source3/include/passdb.h +++ b/source3/include/passdb.h @@ -242,20 +242,15 @@ struct pdb_search { * changed to version 14 to move lookup_rids and lookup_names to return * enum lsa_SidType rather than uint32. * Changed to 16 for access to the trusted domain passwords (obnox). + * Changed to 17, the sampwent interface is gone. */ -#define PASSDB_INTERFACE_VERSION 16 +#define PASSDB_INTERFACE_VERSION 17 struct pdb_methods { const char *name; /* What name got this module */ - NTSTATUS (*setsampwent)(struct pdb_methods *, bool update, uint32 acb_mask); - - void (*endsampwent)(struct pdb_methods *); - - NTSTATUS (*getsampwent)(struct pdb_methods *, struct samu *user); - NTSTATUS (*getsampwnam)(struct pdb_methods *, struct samu *sam_acct, const char *username); NTSTATUS (*getsampwsid)(struct pdb_methods *, struct samu *sam_acct, const DOM_SID *sid); diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 198960550b..2102b579ec 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -208,33 +208,6 @@ static struct pdb_methods *pdb_get_methods(void) return pdb_get_methods_reload(False); } -/****************************************************************** - Backward compatibility functions for the original passdb interface -*******************************************************************/ - -bool pdb_setsampwent(bool update, uint16 acb_mask) -{ - struct pdb_methods *pdb = pdb_get_methods(); - return NT_STATUS_IS_OK(pdb->setsampwent(pdb, update, acb_mask)); -} - -void pdb_endsampwent(void) -{ - struct pdb_methods *pdb = pdb_get_methods(); - pdb->endsampwent(pdb); -} - -bool pdb_getsampwent(struct samu *user) -{ - struct pdb_methods *pdb = pdb_get_methods(); - - if ( !NT_STATUS_IS_OK(pdb->getsampwent(pdb, user) ) ) { - return False; - } - - return True; -} - bool pdb_getsampwnam(struct samu *sam_acct, const char *username) { struct pdb_methods *pdb = pdb_get_methods(); @@ -1181,21 +1154,6 @@ static NTSTATUS pdb_default_update_login_attempts (struct pdb_methods *methods, return NT_STATUS_NOT_IMPLEMENTED; } -static NTSTATUS pdb_default_setsampwent(struct pdb_methods *methods, bool update, uint32 acb_mask) -{ - return NT_STATUS_NOT_IMPLEMENTED; -} - -static NTSTATUS pdb_default_getsampwent(struct pdb_methods *methods, struct samu *user) -{ - return NT_STATUS_NOT_IMPLEMENTED; -} - -static void pdb_default_endsampwent(struct pdb_methods *methods) -{ - return; /* NT_STATUS_NOT_IMPLEMENTED; */ -} - static NTSTATUS pdb_default_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value) { return account_policy_get(policy_index, value) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; @@ -1738,7 +1696,7 @@ static NTSTATUS pdb_default_lookup_names(struct pdb_methods *methods, } #endif -static struct pdb_search *pdb_search_init(enum pdb_search_type type) +struct pdb_search *pdb_search_init(enum pdb_search_type type) { TALLOC_CTX *mem_ctx; struct pdb_search *result; @@ -1795,81 +1753,6 @@ static void fill_displayentry(TALLOC_CTX *mem_ctx, uint32 rid, entry->description = ""; } -static bool user_search_in_progress = False; -struct user_search { - uint16 acct_flags; -}; - -static bool next_entry_users(struct pdb_search *s, - struct samr_displayentry *entry) -{ - struct user_search *state = (struct user_search *)s->private_data; - struct samu *user = NULL; - - next: - if ( !(user = samu_new( NULL )) ) { - DEBUG(0, ("next_entry_users: samu_new() failed!\n")); - return False; - } - - if (!pdb_getsampwent(user)) { - TALLOC_FREE(user); - return False; - } - - if ((state->acct_flags != 0) && - ((pdb_get_acct_ctrl(user) & state->acct_flags) == 0)) { - TALLOC_FREE(user); - goto next; - } - - fill_displayentry(s->mem_ctx, pdb_get_user_rid(user), - pdb_get_acct_ctrl(user), pdb_get_username(user), - pdb_get_fullname(user), pdb_get_acct_desc(user), - entry); - - TALLOC_FREE(user); - return True; -} - -static void search_end_users(struct pdb_search *search) -{ - pdb_endsampwent(); - user_search_in_progress = False; -} - -static bool pdb_default_search_users(struct pdb_methods *methods, - struct pdb_search *search, - uint32 acct_flags) -{ - struct user_search *state; - - if (user_search_in_progress) { - DEBUG(1, ("user search in progress\n")); - return False; - } - - if (!pdb_setsampwent(False, acct_flags)) { - DEBUG(5, ("Could not start search\n")); - return False; - } - - user_search_in_progress = True; - - state = TALLOC_P(search->mem_ctx, struct user_search); - if (state == NULL) { - DEBUG(0, ("talloc failed\n")); - return False; - } - - state->acct_flags = acct_flags; - - search->private_data = state; - search->next_entry = next_entry_users; - search->search_end = search_end_users; - return True; -} - struct group_search { GROUP_MAP *groups; size_t num_groups, current_group; @@ -2136,9 +2019,6 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods ) return NT_STATUS_NO_MEMORY; } - (*methods)->setsampwent = pdb_default_setsampwent; - (*methods)->endsampwent = pdb_default_endsampwent; - (*methods)->getsampwent = pdb_default_getsampwent; (*methods)->getsampwnam = pdb_default_getsampwnam; (*methods)->getsampwsid = pdb_default_getsampwsid; (*methods)->create_user = pdb_default_create_user; @@ -2180,7 +2060,6 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods ) (*methods)->gid_to_sid = pdb_default_gid_to_sid; (*methods)->sid_to_id = pdb_default_sid_to_id; - (*methods)->search_users = pdb_default_search_users; (*methods)->search_groups = pdb_default_search_groups; (*methods)->search_aliases = pdb_default_search_aliases; diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index bc912ada29..b638219466 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -1453,79 +1453,6 @@ static bool init_ldap_from_sam (struct ldapsam_privates *ldap_state, return True; } -/********************************************************************** - Connect to LDAP server for password enumeration. -*********************************************************************/ - -static NTSTATUS ldapsam_setsampwent(struct pdb_methods *my_methods, bool update, uint32 acb_mask) -{ - struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data; - int rc; - char *filter = NULL; - const char *suffix; - const char **attr_list; - bool machine_mask = False, user_mask = False; - NTSTATUS status = NT_STATUS_OK; - TALLOC_CTX *ctx = talloc_init("ldapsam_setsampwent"); - - if (!ctx) { - return NT_STATUS_NO_MEMORY; - } - filter = talloc_asprintf(ctx, "(&%s%s)", "(uid=%u)", - get_objclass_filter(ldap_state->schema_ver)); - if (!filter) { - status = NT_STATUS_NO_MEMORY; - goto out; - } - - filter = talloc_all_string_sub(ctx, filter, "%u", "*"); - if (!filter) { - status = NT_STATUS_NO_MEMORY; - goto out; - } - - machine_mask = ((acb_mask != 0) && (acb_mask & (ACB_WSTRUST|ACB_SVRTRUST|ACB_DOMTRUST))); - user_mask = ((acb_mask != 0) && (acb_mask & ACB_NORMAL)); - - if (machine_mask) { - suffix = lp_ldap_machine_suffix(); - } else if (user_mask) { - suffix = lp_ldap_user_suffix(); - } else { - suffix = lp_ldap_suffix(); - } - - DEBUG(10,("ldapsam_setsampwent: LDAP Query for acb_mask 0x%x will use suffix %s\n", - acb_mask, suffix)); - - attr_list = get_userattr_list(NULL, ldap_state->schema_ver); - rc = smbldap_search(ldap_state->smbldap_state, suffix, LDAP_SCOPE_SUBTREE, filter, - attr_list, 0, &ldap_state->result); - TALLOC_FREE( attr_list ); - - if (rc != LDAP_SUCCESS) { - DEBUG(0, ("ldapsam_setsampwent: LDAP search failed: %s\n", ldap_err2string(rc))); - DEBUG(3, ("ldapsam_setsampwent: Query was: %s, %s\n", suffix, filter)); - ldap_msgfree(ldap_state->result); - ldap_state->result = NULL; - status = NT_STATUS_UNSUCCESSFUL; - goto out; - } - - DEBUG(2, ("ldapsam_setsampwent: %d entries in the base %s\n", - ldap_count_entries(ldap_state->smbldap_state->ldap_struct, - ldap_state->result), suffix)); - - ldap_state->entry = ldap_first_entry(ldap_state->smbldap_state->ldap_struct, - ldap_state->result); - ldap_state->index = 0; - - out: - - TALLOC_FREE(ctx); - return status; -} - /********************************************************************** End enumeration of the LDAP password list. *********************************************************************/ @@ -1539,32 +1466,6 @@ static void ldapsam_endsampwent(struct pdb_methods *my_methods) } } -/********************************************************************** -Get the next entry in the LDAP password database. -*********************************************************************/ - -static NTSTATUS ldapsam_getsampwent(struct pdb_methods *my_methods, - struct samu *user) -{ - NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; - struct ldapsam_privates *ldap_state = - (struct ldapsam_privates *)my_methods->private_data; - bool bret = False; - - while (!bret) { - if (!ldap_state->entry) - return ret; - - ldap_state->index++; - bret = init_sam_from_ldap(ldap_state, user, ldap_state->entry); - - ldap_state->entry = ldap_next_entry(priv2ld(ldap_state), - ldap_state->entry); - } - - return NT_STATUS_OK; -} - static void append_attr(TALLOC_CTX *mem_ctx, const char ***attr_list, const char *new_attr) { @@ -6172,9 +6073,6 @@ static NTSTATUS pdb_init_ldapsam_common(struct pdb_methods **pdb_method, const c (*pdb_method)->name = "ldapsam"; - (*pdb_method)->setsampwent = ldapsam_setsampwent; - (*pdb_method)->endsampwent = ldapsam_endsampwent; - (*pdb_method)->getsampwent = ldapsam_getsampwent; (*pdb_method)->getsampwnam = ldapsam_getsampwnam; (*pdb_method)->getsampwsid = ldapsam_getsampwsid; (*pdb_method)->add_sam_account = ldapsam_add_sam_account; diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 21cd988cff..6cf54fbdf6 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -1264,79 +1264,6 @@ static bool build_sam_account(struct smbpasswd_privates *smbpasswd_state, Functions to be implemented by the new passdb API ****************************************************************/ -static NTSTATUS smbpasswd_setsampwent (struct pdb_methods *my_methods, bool update, uint32 acb_mask) -{ - struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data; - - smbpasswd_state->pw_file = startsmbfilepwent(smbpasswd_state->smbpasswd_file, - update ? PWF_UPDATE : PWF_READ, - &(smbpasswd_state->pw_file_lock_depth)); - - /* did we fail? Should we try to create it? */ - if (!smbpasswd_state->pw_file && update && errno == ENOENT) { - FILE *fp; - /* slprintf(msg_str,msg_str_len-1, - "smbpasswd file did not exist - attempting to create it.\n"); */ - DEBUG(0,("smbpasswd file did not exist - attempting to create it.\n")); - fp = sys_fopen(smbpasswd_state->smbpasswd_file, "w"); - if (fp) { - fprintf(fp, "# Samba SMB password file\n"); - fclose(fp); - } - - smbpasswd_state->pw_file = startsmbfilepwent(smbpasswd_state->smbpasswd_file, - update ? PWF_UPDATE : PWF_READ, - &(smbpasswd_state->pw_file_lock_depth)); - } - - if (smbpasswd_state->pw_file != NULL) - return NT_STATUS_OK; - else - return NT_STATUS_UNSUCCESSFUL; -} - -static void smbpasswd_endsampwent (struct pdb_methods *my_methods) -{ - struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data; - endsmbfilepwent(smbpasswd_state->pw_file, &(smbpasswd_state->pw_file_lock_depth)); -} - -/***************************************************************** - ****************************************************************/ - -static NTSTATUS smbpasswd_getsampwent(struct pdb_methods *my_methods, struct samu *user) -{ - NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; - struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data; - struct smb_passwd *pw_buf=NULL; - bool done = False; - - DEBUG(5,("pdb_getsampwent\n")); - - if ( !user ) { - DEBUG(5,("pdb_getsampwent (smbpasswd): user is NULL\n")); - return nt_status; - } - - while (!done) { - /* do we have an entry? */ - pw_buf = getsmbfilepwent(smbpasswd_state, smbpasswd_state->pw_file); - if (pw_buf == NULL) - return nt_status; - - /* build the struct samu entry from the smb_passwd struct. - We loop in case the user in the pdb does not exist in - the local system password file */ - if (build_sam_account(smbpasswd_state, user, pw_buf)) - done = True; - } - - DEBUG(5,("getsampwent (smbpasswd): done\n")); - - /* success */ - return NT_STATUS_OK; -} - /**************************************************************** Search smbpasswd file by iterating over the entries. Do not call getpwnam() for unix account information until we have found @@ -1730,9 +1657,6 @@ static NTSTATUS pdb_init_smbpasswd( struct pdb_methods **pdb_method, const char (*pdb_method)->name = "smbpasswd"; - (*pdb_method)->setsampwent = smbpasswd_setsampwent; - (*pdb_method)->endsampwent = smbpasswd_endsampwent; - (*pdb_method)->getsampwent = smbpasswd_getsampwent; (*pdb_method)->getsampwnam = smbpasswd_getsampwnam; (*pdb_method)->getsampwsid = smbpasswd_getsampwsid; (*pdb_method)->add_sam_account = smbpasswd_add_sam_account; diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 1c2278ba7d..1277b9c395 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -44,13 +44,6 @@ static int tdbsam_debug_level = DBGC_ALL; #define RIDPREFIX "RID_" #define PRIVPREFIX "PRIV_" -struct pwent_list { - struct pwent_list *prev, *next; - TDB_DATA key; -}; -static struct pwent_list *tdbsam_pwent_list; -static bool pwent_initialized; - /* GLOBAL TDB SAM CONTEXT */ static TDB_CONTEXT *tdbsam; @@ -891,134 +884,6 @@ void tdbsam_close( void ) return; } -/**************************************************************************** - creates a list of user keys -****************************************************************************/ - -static int tdbsam_traverse_setpwent(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *state) -{ - const char *prefix = USERPREFIX; - int prefixlen = strlen (prefix); - struct pwent_list *ptr; - - if ( strncmp((const char *)key.dptr, prefix, prefixlen) == 0 ) { - if ( !(ptr=SMB_MALLOC_P(struct pwent_list)) ) { - DEBUG(0,("tdbsam_traverse_setpwent: Failed to malloc new entry for list\n")); - - /* just return 0 and let the traversal continue */ - return 0; - } - ZERO_STRUCTP(ptr); - - /* save a copy of the key */ - - ptr->key.dptr = (uint8 *)memdup( key.dptr, key.dsize ); - if (!ptr->key.dptr) { - DEBUG(0,("tdbsam_traverse_setpwent: memdup failed\n")); - /* just return 0 and let the traversal continue */ - SAFE_FREE(ptr); - return 0; - } - - ptr->key.dsize = key.dsize; - - DLIST_ADD( tdbsam_pwent_list, ptr ); - - } - - return 0; -} - -/*************************************************************** - Open the TDB passwd database for SAM account enumeration. - Save a list of user keys for iteration. -****************************************************************/ - -static NTSTATUS tdbsam_setsampwent(struct pdb_methods *my_methods, bool update, uint32 acb_mask) -{ - if ( !tdbsam_open( tdbsam_filename ) ) { - DEBUG(0,("tdbsam_getsampwnam: failed to open %s!\n", tdbsam_filename)); - return NT_STATUS_ACCESS_DENIED; - } - - tdb_traverse( tdbsam, tdbsam_traverse_setpwent, NULL ); - pwent_initialized = True; - - return NT_STATUS_OK; -} - - -/*************************************************************** - End enumeration of the TDB passwd list. -****************************************************************/ - -static void tdbsam_endsampwent(struct pdb_methods *my_methods) -{ - struct pwent_list *ptr, *ptr_next; - - /* close the tdb only if we have a valid pwent state */ - - if ( pwent_initialized ) { - DEBUG(7, ("endtdbpwent: closed sam database.\n")); - tdbsam_close(); - } - - /* clear out any remaining entries in the list */ - - for ( ptr=tdbsam_pwent_list; ptr; ptr = ptr_next ) { - ptr_next = ptr->next; - DLIST_REMOVE( tdbsam_pwent_list, ptr ); - SAFE_FREE( ptr->key.dptr); - SAFE_FREE( ptr ); - } - - pwent_initialized = False; -} - -/***************************************************************** - Get one struct samu from the TDB (next in line) -*****************************************************************/ - -static NTSTATUS tdbsam_getsampwent(struct pdb_methods *my_methods, struct samu *user) -{ - NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; - TDB_DATA data; - struct pwent_list *pkey; - - if ( !user ) { - DEBUG(0,("tdbsam_getsampwent: struct samu is NULL.\n")); - return nt_status; - } - - if ( !tdbsam_pwent_list ) { - DEBUG(4,("tdbsam_getsampwent: end of list\n")); - return nt_status; - } - - /* pull the next entry */ - - pkey = tdbsam_pwent_list; - DLIST_REMOVE( tdbsam_pwent_list, pkey ); - - data = tdb_fetch(tdbsam, pkey->key); - - SAFE_FREE( pkey->key.dptr); - SAFE_FREE( pkey); - - if ( !data.dptr ) { - DEBUG(5,("pdb_getsampwent: database entry not found. Was the user deleted?\n")); - return nt_status; - } - - if ( !init_sam_from_buffer(user, (unsigned char *)data.dptr, data.dsize) ) { - DEBUG(0,("pdb_getsampwent: Bad struct samu entry returned from TDB!\n")); - } - - SAFE_FREE( data.dptr ); - - return NT_STATUS_OK; -} - /****************************************************************** Lookup a name in the SAM TDB ******************************************************************/ @@ -1306,10 +1171,6 @@ static bool tdb_update_sam(struct pdb_methods *my_methods, struct samu* newpwd, { bool result = True; - /* invalidate the existing TDB iterator if it is open */ - - tdbsam_endsampwent( my_methods ); - #if 0 if ( !pdb_get_group_rid(newpwd) ) { DEBUG (0,("tdb_update_sam: Failing to store a struct samu for [%s] " @@ -1396,10 +1257,6 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods, return NT_STATUS_ACCESS_DENIED; } - /* invalidate the existing TDB iterator if it is open */ - - tdbsam_endsampwent( my_methods ); - if ( !(new_acct = samu_new( NULL )) ) { return NT_STATUS_NO_MEMORY; } @@ -1742,9 +1599,6 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc (*pdb_method)->name = "tdbsam"; - (*pdb_method)->setsampwent = tdbsam_setsampwent; - (*pdb_method)->endsampwent = tdbsam_endsampwent; - (*pdb_method)->getsampwent = tdbsam_getsampwent; (*pdb_method)->getsampwnam = tdbsam_getsampwnam; (*pdb_method)->getsampwsid = tdbsam_getsampwsid; (*pdb_method)->add_sam_account = tdbsam_add_sam_account; diff --git a/source3/torture/pdbtest.c b/source3/torture/pdbtest.c index 77666bb664..ab7edde85d 100644 --- a/source3/torture/pdbtest.c +++ b/source3/torture/pdbtest.c @@ -364,24 +364,6 @@ int main(int argc, char **argv) get_friendly_nt_error_msg(rv)); } - pdb->setsampwent(pdb, False, 0); - while (NT_STATUS_IS_OK(pdb->getsampwent(pdb, out))) { - if (pdb_get_username(out) == NULL) { - fprintf(stderr, "Got bad username through getsampwent()\n"); - error = True; - break; - } - if (NT_STATUS_IS_ERR(pdb->getsampwnam(pdb, in, pdb_get_username(out)))) { - fprintf(stderr, "Error getting samu through getsampwnam() of an account we got through getsampwent!\n"); - error = True; - continue; - } - if (!samu_correct(out, in)) { - printf("Record gotten through getsampwnam() differs from same record through getsampwent()\n"); - } - } - pdb->endsampwent(pdb); - TALLOC_FREE(ctx); if (error) { -- cgit From 07867ec373b98d6c0d3048983091ba4c49231196 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 26 Dec 2007 23:44:24 +0100 Subject: Fix some memleaks (This used to be commit 78b0b66cbac349625257260d2e45d918e0c93617) --- source3/lib/debug.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 87ec9ed8f5..9ea2dc151a 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -785,13 +785,13 @@ void check_log_size( void ) (void)x_vfprintf( dbf, format_str, ap ); va_end( ap ); errno = old_errno; - return( 0 ); + goto done; } /* prevent recursion by checking if reopen_logs() has temporaily set the debugf string to NULL */ if( debugf == NULL) - return( 0 ); + goto done; #ifdef WITH_SYSLOG if( !lp_syslog_only() ) @@ -806,7 +806,7 @@ void check_log_size( void ) x_setbuf( dbf, NULL ); } else { errno = old_errno; - return(0); + goto done; } } } @@ -855,10 +855,11 @@ void check_log_size( void ) (void)x_fflush( dbf ); } - errno = old_errno; - + done: TALLOC_FREE(tmp_debug_ctx); + errno = old_errno; + return( 0 ); } -- cgit From 23c965d9472058c566a1b9f8a44964acd5c8a446 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Dec 2007 00:22:07 +0100 Subject: typos (This used to be commit 30fa3477c8f810d8f2b4c4be218509544735274c) --- source3/modules/vfs_solarisacl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_solarisacl.c b/source3/modules/vfs_solarisacl.c index 673b6805af..cda243f8c1 100644 --- a/source3/modules/vfs_solarisacl.c +++ b/source3/modules/vfs_solarisacl.c @@ -264,8 +264,8 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle, } done: - DEBUG(10, ("solarisacl_sys_acl_st_fd %s.\n", - ((ret == 0) ? "succeded" : "failed" ))); + DEBUG(10, ("solarisacl_sys_acl_set_fd %s.\n", + ((ret == 0) ? "succeeded" : "failed" ))); SAFE_FREE(solaris_acl); SAFE_FREE(default_acl); return ret; -- cgit From afc93255d183eefb68e45b8ec6275f6a62cf9795 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 26 Dec 2007 17:12:36 -0800 Subject: Add SMB encryption. Still fixing client decrypt but negotiation works. Jeremy. (This used to be commit d78045601af787731f0737b8627450018902b104) --- source3/Makefile.in | 4 +- source3/client/client.c | 43 +++ source3/include/client.h | 26 ++ source3/include/smb.h | 3 +- source3/include/smb_macros.h | 16 +- source3/include/trans2.h | 24 +- source3/lib/dummysmbd.c | 20 ++ source3/lib/util.c | 38 +-- source3/lib/util_sock.c | 30 +- source3/libads/ads_status.c | 9 + source3/libsmb/cliconnect.c | 22 +- source3/libsmb/clidgram.c | 2 +- source3/libsmb/clientgen.c | 108 ++++--- source3/libsmb/clifile.c | 44 +-- source3/libsmb/clifsinfo.c | 333 ++++++++++++++++++++ source3/libsmb/clilist.c | 4 +- source3/libsmb/climessage.c | 6 +- source3/libsmb/clioplock.c | 2 +- source3/libsmb/cliprint.c | 4 +- source3/libsmb/clireadwrite.c | 31 +- source3/libsmb/clitrans.c | 8 +- source3/libsmb/errormap.c | 105 +++++++ source3/libsmb/smb_seal.c | 496 +++++++++++++++++++++++++++++ source3/nmbd/nmbd_packets.c | 2 +- source3/param/loadparm.c | 7 +- source3/smbd/aio.c | 17 +- source3/smbd/error.c | 71 ++--- source3/smbd/notify.c | 3 +- source3/smbd/oplock.c | 6 +- source3/smbd/pipes.c | 3 +- source3/smbd/process.c | 56 +++- source3/smbd/reply.c | 35 ++- source3/smbd/seal.c | 703 ++++++++++++++++++++++++++++++++++++++++++ source3/smbd/trans2.c | 49 +++ 34 files changed, 2116 insertions(+), 214 deletions(-) create mode 100644 source3/libsmb/smb_seal.c create mode 100644 source3/smbd/seal.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 10a14d0a55..9d8ad3e68b 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -374,7 +374,7 @@ LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \ libsmb/clistr.o libsmb/cliquota.o libsmb/clifsinfo.o libsmb/clidfs.o \ libsmb/smberr.o libsmb/credentials.o libsmb/pwd_cache.o \ libsmb/clioplock.o $(ERRORMAP_OBJ) libsmb/clirap2.o \ - $(DOSERR_OBJ) \ + libsmb/smb_seal.o $(DOSERR_OBJ) \ $(RPC_PARSE_OBJ1) $(LIBSAMBA_OBJ) $(LIBNMB_OBJ) RPC_CLIENT_OBJ1 = rpc_client/cli_netlogon.o rpc_client/cli_srvsvc.o @@ -551,7 +551,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \ smbd/reply.o smbd/sesssetup.o smbd/trans2.o smbd/uid.o \ smbd/dosmode.o smbd/filename.o smbd/open.o smbd/close.o \ smbd/blocking.o smbd/sec_ctx.o smbd/srvstr.o \ - smbd/vfs.o smbd/statcache.o \ + smbd/vfs.o smbd/statcache.o smbd/seal.o \ smbd/posix_acls.o lib/sysacls.o $(SERVER_MUTEX_OBJ) \ smbd/process.o smbd/service.o smbd/error.o \ printing/printfsp.o lib/sysquotas.o lib/sysquotas_linux.o \ diff --git a/source3/client/client.c b/source3/client/client.c index f761d92bac..665a051190 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -2178,6 +2178,48 @@ static int cmd_open(void) return 0; } +static int cmd_posix_encrypt(void) +{ + TALLOC_CTX *ctx = talloc_tos(); + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + + if (cli->use_kerberos) { + status = cli_gss_smb_encryption_start(cli); + } else { + char *domain = NULL; + char *user = NULL; + char *password = NULL; + + if (!next_token_talloc(ctx, &cmd_ptr,&domain,NULL)) { + d_printf("posix_encrypt domain user password\n"); + return 1; + } + + if (!next_token_talloc(ctx, &cmd_ptr,&user,NULL)) { + d_printf("posix_encrypt domain user password\n"); + return 1; + } + + if (!next_token_talloc(ctx, &cmd_ptr,&password,NULL)) { + d_printf("posix_encrypt domain user password\n"); + return 1; + } + + status = cli_raw_ntlm_smb_encryption_start(cli, + user, + password, + domain); + } + + if (!NT_STATUS_IS_OK(status)) { + d_printf("posix_encrypt failed with error %s\n", nt_errstr(status)); + } else { + d_printf("encryption on\n"); + } + + return 0; +} + /**************************************************************************** ****************************************************************************/ @@ -3803,6 +3845,7 @@ static struct { {"newer",cmd_newer," only mget files newer than the specified local file",{COMPL_LOCAL,COMPL_NONE}}, {"open",cmd_open," open a file",{COMPL_REMOTE,COMPL_NONE}}, {"posix", cmd_posix, "turn on all POSIX capabilities", {COMPL_REMOTE,COMPL_NONE}}, + {"posix_encrypt",cmd_posix_encrypt," start up transport encryption",{COMPL_REMOTE,COMPL_NONE}}, {"posix_open",cmd_posix_open," 0 open_flags mode open a file using POSIX interface",{COMPL_REMOTE,COMPL_NONE}}, {"posix_mkdir",cmd_posix_mkdir," 0 creates a directory using POSIX interface",{COMPL_REMOTE,COMPL_NONE}}, {"posix_rmdir",cmd_posix_rmdir," removes a directory using POSIX interface",{COMPL_REMOTE,COMPL_NONE}}, diff --git a/source3/include/client.h b/source3/include/client.h index 0047b2bf23..f8adf567de 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -27,7 +27,9 @@ will be a multiple of the page size on almost any system */ #define CLI_BUFFER_SIZE (0xFFFF) #define CLI_SAMBA_MAX_LARGE_READX_SIZE (127*1024) /* Works for Samba servers */ +#define CLI_SAMBA_MAX_LARGE_WRITEX_SIZE (127*1024) /* Works for Samba servers */ #define CLI_WINDOWS_MAX_LARGE_READX_SIZE ((64*1024)-2) /* Windows servers are broken.... */ +#define CLI_WINDOWS_MAX_LARGE_WRITEX_SIZE ((64*1024)-2) /* Windows servers are broken.... */ #define CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE (0xFFFF00) /* 24-bit len. */ #define CLI_SAMBA_MAX_POSIX_LARGE_WRITEX_SIZE (0xFFFF00) /* 24-bit len. */ @@ -79,6 +81,28 @@ struct rpc_pipe_client { struct dcinfo *dc; }; +/* Transport encryption state. */ +enum smb_trans_enc_type { SMB_TRANS_ENC_NTLM, SMB_TRANS_ENC_GSS }; + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) +struct smb_tran_enc_state_gss { + gss_ctx_id_t gss_ctx; + gss_cred_id_t creds; +}; +#endif + +struct smb_trans_enc_state { + enum smb_trans_enc_type smb_enc_type; + uint16 enc_ctx_num; + bool enc_on; + union { + NTLMSSP_STATE *ntlmssp_state; +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + struct smb_tran_enc_state_gss *gss_state; +#endif + } s; +}; + struct cli_state { int port; int fd; @@ -142,6 +166,8 @@ struct cli_state { smb_sign_info sign_info; + struct smb_trans_enc_state *trans_enc_state; /* Setup if we're encrypting SMB's. */ + /* the session key for this CLI, outside any per-pipe authenticaion */ DATA_BLOB user_session_key; diff --git a/source3/include/smb.h b/source3/include/smb.h index 63ae51ecd4..2ffd530fb0 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -80,7 +80,8 @@ enum smb_read_errors { SMB_WRITE_ERROR, /* This error code can go into the client smb_rw_error. */ SMB_READ_BAD_SIG, SMB_NO_MEMORY, - SMB_DO_NOT_DO_TDIS /* cli_close_connection() check for this when smbfs wants to keep tree connected */ + SMB_DO_NOT_DO_TDIS, /* cli_close_connection() check for this when smbfs wants to keep tree connected */ + SMB_READ_BAD_DECRYPT }; #define DIR_STRUCT_SIZE 43 diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 0dfb596994..9bacdce1db 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -158,11 +158,10 @@ #define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx))) #define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx))) -#define ERROR_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__) -#define ERROR_NT(status) error_packet(outbuf,0,0,status,__LINE__,__FILE__) -#define ERROR_OPEN(status) error_open(outbuf,status,__LINE__,__FILE__) -#define ERROR_FORCE_NT(status) error_packet(outbuf,-1,-1,status,__LINE__,__FILE__) -#define ERROR_BOTH(status,class,code) error_packet(outbuf,class,code,status,__LINE__,__FILE__) +#define ERROR_DOS(class,code) error_packet(inbuf,outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__) +#define ERROR_NT(status) error_packet(inbuf,outbuf,0,0,status,__LINE__,__FILE__) +#define ERROR_FORCE_NT(status) error_packet(inbuf,outbuf,-1,-1,status,__LINE__,__FILE__) +#define ERROR_BOTH(status,class,code) error_packet(inbuf,outbuf,class,code,status,__LINE__,__FILE__) #define reply_nterror(req,status) reply_nt_error(req,status,__LINE__,__FILE__) #define reply_force_nterror(req,status) reply_force_nt_error(req,status,__LINE__,__FILE__) @@ -170,9 +169,6 @@ #define reply_botherror(req,status,eclass,ecode) reply_both_error(req,eclass,ecode,status,__LINE__,__FILE__) #define reply_unixerror(req,defclass,deferror) reply_unix_error(req,defclass,deferror,NT_STATUS_OK,__LINE__,__FILE__) -/* this is how errors are generated */ -#define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,NT_STATUS_OK,__LINE__,__FILE__) - /* these are the datagram types */ #define DGRAM_DIRECT_UNIQUE 0x10 @@ -189,8 +185,8 @@ #define smb_offset(p,buf) (PTR_DIFF(p,buf+4) + chain_size) #define smb_len(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|((PVAL(buf,1)&1)<<16)) -#define _smb_setlen(buf,len) do { buf[0] = 0; buf[1] = (len&0x10000)>>16; \ - buf[2] = (len&0xFF00)>>8; buf[3] = len&0xFF; } while (0) +#define _smb_setlen(buf,len) do { buf[0] = 0; buf[1] = ((len)&0x10000)>>16; \ + buf[2] = ((len)&0xFF00)>>8; buf[3] = (len)&0xFF; } while (0) #define smb_len_large(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|(PVAL(buf,1)<<16)) #define _smb_setlen_large(buf,len) do { buf[0] = 0; buf[1] = ((len)&0xFF0000)>>16; \ diff --git a/source3/include/trans2.h b/source3/include/trans2.h index f7f3ef2149..8ed075d418 100644 --- a/source3/include/trans2.h +++ b/source3/include/trans2.h @@ -566,7 +566,6 @@ findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2. __u8 * psid_list may be empty */ - /* ... more as we think of them :-). */ /* SMB POSIX ACL definitions. */ @@ -653,6 +652,29 @@ enum smb_whoami_flags { DOM_SID[] - list of SIDs (may be empty) */ +/* + * The following trans2 is done between client and server + * as a FSINFO call to set up the encryption state for transport + * encryption. + * This is a subcommand of the TRANS2_QFSINFO. + * + * The request looks like : + * + * [data block] -> SPNEGO framed GSSAPI request. + * + * The reply looks like : + * + * [data block] -> SPNEGO framed GSSAPI reply - if error + * is NT_STATUS_OK then we're done, if it's + * NT_STATUS_MORE_PROCESSING_REQUIRED then the + * client needs to keep going. If it's an + * error it can be any NT_STATUS error. + * + */ + +#define SMB_REQUEST_TRANSPORT_ENCRYPTION 0x203 /* QFSINFO */ + + /* The query/set info levels for POSIX ACLs. */ #define SMB_QUERY_POSIX_ACL 0x204 #define SMB_SET_POSIX_ACL 0x204 diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c index e3b179b763..464ba92306 100644 --- a/source3/lib/dummysmbd.c +++ b/source3/lib/dummysmbd.c @@ -52,3 +52,23 @@ NTSTATUS can_delete_directory(struct connection_struct *conn, return NT_STATUS_OK; } +NTSTATUS srv_decrypt_buffer(char *buf) +{ + return NT_STATUS_OK; +} + +NTSTATUS srv_encrypt_buffer(char *buffer, char **buf_out) +{ + *buf_out = buffer; + return NT_STATUS_OK; +} + +void srv_free_enc_buffer(char *buf) +{ + ; +} + +bool srv_encryption_on(void) +{ + return false; +} diff --git a/source3/lib/util.c b/source3/lib/util.c index 11c14ea538..7f8a297fac 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -605,32 +605,30 @@ void show_msg(char *buf) } /******************************************************************* - Set the length and marker of an smb packet. + Set the length and marker of an encrypted smb packet. ********************************************************************/ -void smb_setlen(char *buf,int len) +void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num) { _smb_setlen(buf,len); SCVAL(buf,4,0xFF); - SCVAL(buf,5,'S'); - SCVAL(buf,6,'M'); - SCVAL(buf,7,'B'); + SCVAL(buf,5,'E'); + SSVAL(buf,6,enc_ctx_num); } /******************************************************************* - Setup the word count and byte count for a smb message. + Set the length and marker of an smb packet. ********************************************************************/ -int set_message(char *buf,int num_words,int num_bytes,bool zero) +void smb_setlen(char *buf,int len) { - if (zero && (num_words || num_bytes)) { - memset(buf + smb_size,'\0',num_words*2 + num_bytes); - } - SCVAL(buf,smb_wct,num_words); - SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); - smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); - return (smb_size + num_words*2 + num_bytes); + _smb_setlen(buf,len); + + SCVAL(buf,4,0xFF); + SCVAL(buf,5,'S'); + SCVAL(buf,6,'M'); + SCVAL(buf,7,'B'); } /******************************************************************* @@ -641,20 +639,10 @@ int set_message_bcc(char *buf,int num_bytes) { int num_words = CVAL(buf,smb_wct); SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); - smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); + _smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); return (smb_size + num_words*2 + num_bytes); } -/******************************************************************* - Setup only the byte count for a smb message, using the end of the - message as a marker. -********************************************************************/ - -int set_message_end(void *outbuf,void *end_ptr) -{ - return set_message_bcc((char *)outbuf,PTR_DIFF(end_ptr,smb_buf((char *)outbuf))); -} - /******************************************************************* Add a data blob to the end of a smb_buf, adjusting bcc and smb_len. Return the bytes added diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 8f1bd9e686..d16a8f079a 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1287,6 +1287,17 @@ bool receive_smb(int fd, char *buffer, unsigned int timeout, enum smb_read_error return false; } + if (srv_encryption_on()) { + NTSTATUS status = srv_decrypt_buffer(buffer); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("receive_smb: SMB decryption failed " + "on incoming packet! Error %s\n", + nt_errstr(status) )); + cond_set_smb_read_error(pre, SMB_READ_BAD_DECRYPT); + return false; + } + } + /* Check the incoming SMB signature. */ if (!srv_check_sign_mac(buffer, true)) { DEBUG(0, ("receive_smb: SMB Signature verification " @@ -1307,22 +1318,35 @@ bool send_smb(int fd, char *buffer) size_t len; size_t nwritten=0; ssize_t ret; + char *buf_out = buffer; /* Sign the outgoing packet if required. */ - srv_calculate_sign_mac(buffer); + srv_calculate_sign_mac(buf_out); + + if (srv_encryption_on()) { + NTSTATUS status = srv_encrypt_buffer(buffer, &buf_out); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("send_smb: SMB encryption failed " + "on outgoing packet! Error %s\n", + nt_errstr(status) )); + return false; + } + } - len = smb_len(buffer) + 4; + len = smb_len(buf_out) + 4; while (nwritten < len) { - ret = write_data(fd,buffer+nwritten,len - nwritten); + ret = write_data(fd,buf_out+nwritten,len - nwritten); if (ret <= 0) { DEBUG(0,("Error writing %d bytes to client. %d. (%s)\n", (int)len,(int)ret, strerror(errno) )); + srv_free_enc_buffer(buf_out); return false; } nwritten += ret; } + srv_free_enc_buffer(buf_out); return true; } diff --git a/source3/libads/ads_status.c b/source3/libads/ads_status.c index ecef9d224b..29148e8543 100644 --- a/source3/libads/ads_status.c +++ b/source3/libads/ads_status.c @@ -141,3 +141,12 @@ const char *ads_errstr(ADS_STATUS status) } } +#ifdef HAVE_GSSAPI +NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min) +{ + ADS_STATUS adss = ADS_ERROR_GSS(maj, min); + DEBUG(10,("gss_err_to_ntstatus: Error %s\n", + ads_errstr(adss) )); + return ads_ntstatus(adss); +} +#endif diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 33110c803f..4560521d4a 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -98,7 +98,7 @@ static NTSTATUS cli_session_setup_lanman2(struct cli_state *cli, /* send a session setup command */ memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,10, 0, True); + cli_set_message(cli->outbuf,10, 0, True); SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); @@ -168,7 +168,7 @@ static NTSTATUS cli_session_setup_guest(struct cli_state *cli) uint32 capabilities = cli_session_setup_capabilities(cli); memset(cli->outbuf, '\0', smb_size); - set_message(cli->outbuf,13,0,True); + cli_set_message(cli->outbuf,13,0,True); SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); @@ -228,7 +228,7 @@ static NTSTATUS cli_session_setup_plaintext(struct cli_state *cli, fstr_sprintf( lanman, "Samba %s", SAMBA_VERSION_STRING); memset(cli->outbuf, '\0', smb_size); - set_message(cli->outbuf,13,0,True); + cli_set_message(cli->outbuf,13,0,True); SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); @@ -377,7 +377,7 @@ static NTSTATUS cli_session_setup_nt1(struct cli_state *cli, const char *user, /* send a session setup command */ memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,13,0,True); + cli_set_message(cli->outbuf,13,0,True); SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); @@ -457,7 +457,7 @@ static bool cli_session_setup_blob_send(struct cli_state *cli, DATA_BLOB blob) /* send a session setup command */ memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,12,0,True); + cli_set_message(cli->outbuf,12,0,True); SCVAL(cli->outbuf,smb_com,SMBsesssetupX); cli_setup_packet(cli); @@ -1028,7 +1028,7 @@ NTSTATUS cli_session_setup(struct cli_state *cli, bool cli_ulogoff(struct cli_state *cli) { memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,2,0,True); + cli_set_message(cli->outbuf,2,0,True); SCVAL(cli->outbuf,smb_com,SMBulogoffX); cli_setup_packet(cli); SSVAL(cli->outbuf,smb_vwv0,0xFF); @@ -1106,7 +1106,7 @@ bool cli_send_tconX(struct cli_state *cli, slprintf(fullshare, sizeof(fullshare)-1, "\\\\%s\\%s", cli->desthost, share); - set_message(cli->outbuf,4, 0, True); + cli_set_message(cli->outbuf,4, 0, True); SCVAL(cli->outbuf,smb_com,SMBtconX); cli_setup_packet(cli); @@ -1157,7 +1157,7 @@ bool cli_send_tconX(struct cli_state *cli, bool cli_tdis(struct cli_state *cli) { memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,0,0,True); + cli_set_message(cli->outbuf,0,0,True); SCVAL(cli->outbuf,smb_com,SMBtdis); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -1189,7 +1189,7 @@ void cli_negprot_send(struct cli_state *cli) memset(cli->outbuf,'\0',smb_size); /* setup the protocol strings */ - set_message(cli->outbuf,0,0,True); + cli_set_message(cli->outbuf,0,0,True); p = smb_buf(cli->outbuf); for (numprots=0; @@ -1229,7 +1229,7 @@ bool cli_negprot(struct cli_state *cli) numprots++) plength += strlen(prots[numprots].name)+2; - set_message(cli->outbuf,0,plength,True); + cli_set_message(cli->outbuf,0,plength,True); p = smb_buf(cli->outbuf); for (numprots=0; @@ -1806,7 +1806,7 @@ NTSTATUS cli_raw_tcon(struct cli_state *cli, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf, 0, 0, True); + cli_set_message(cli->outbuf, 0, 0, True); SCVAL(cli->outbuf,smb_com,SMBtcon); cli_setup_packet(cli); diff --git a/source3/libsmb/clidgram.c b/source3/libsmb/clidgram.c index 76630bd504..66c6ee1022 100644 --- a/source3/libsmb/clidgram.c +++ b/source3/libsmb/clidgram.c @@ -81,7 +81,7 @@ bool cli_send_mailslot(struct messaging_context *msg_ctx, return False; } - set_message(ptr,17,strlen(mailslot) + 1 + len,True); + cli_set_message(ptr,17,strlen(mailslot) + 1 + len,True); memcpy(ptr,tmp,4); SCVAL(ptr,smb_com,SMBtrans); diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 0544b3d879..da225ebc24 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -20,6 +20,21 @@ #include "includes.h" +/******************************************************************* + Setup the word count and byte count for a client smb message. +********************************************************************/ + +int cli_set_message(char *buf,int num_words,int num_bytes,bool zero) +{ + if (zero && (num_words || num_bytes)) { + memset(buf + smb_size,'\0',num_words*2 + num_bytes); + } + SCVAL(buf,smb_wct,num_words); + SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); + smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); + return (smb_size + num_words*2 + num_bytes); +} + /**************************************************************************** Change the timeout (in milliseconds). ****************************************************************************/ @@ -85,7 +100,7 @@ bool cli_receive_smb(struct cli_state *cli) /* fd == -1 causes segfaults -- Tom (tom@ninja.nl) */ if (cli->fd == -1) - return False; + return false; again: len = client_receive_smb(cli, 0); @@ -100,7 +115,7 @@ bool cli_receive_smb(struct cli_state *cli) int fnum = SVAL(cli->inbuf,smb_vwv2); unsigned char level = CVAL(cli->inbuf,smb_vwv3+1); if (!cli->oplock_handler(cli, fnum, level)) { - return False; + return false; } } /* try to prevent loops */ @@ -114,7 +129,7 @@ bool cli_receive_smb(struct cli_state *cli) DEBUG(0, ("Receiving SMB: Server stopped responding\n")); close(cli->fd); cli->fd = -1; - return False; + return false; } if (!cli_check_sign_mac(cli)) { @@ -135,16 +150,16 @@ bool cli_receive_smb(struct cli_state *cli) * Set bad sig but don't close fd. */ cli->smb_rw_error = SMB_READ_BAD_SIG; - return True; + return true; } DEBUG(0, ("SMB Signature verification failed on incoming packet!\n")); cli->smb_rw_error = SMB_READ_BAD_SIG; close(cli->fd); cli->fd = -1; - return False; + return false; }; - return True; + return true; } /**************************************************************************** @@ -164,6 +179,7 @@ ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len) /**************************************************************************** Read a smb readX header. + We can only use this if encryption and signing are off. ****************************************************************************/ bool cli_receive_smb_readX_header(struct cli_state *cli) @@ -171,7 +187,7 @@ bool cli_receive_smb_readX_header(struct cli_state *cli) ssize_t len, offset; if (cli->fd == -1) - return False; + return false; again: @@ -199,7 +215,7 @@ bool cli_receive_smb_readX_header(struct cli_state *cli) if (cli->oplock_handler) { int fnum = SVAL(cli->inbuf,smb_vwv2); unsigned char level = CVAL(cli->inbuf,smb_vwv3+1); - if (!cli->oplock_handler(cli, fnum, level)) return False; + if (!cli->oplock_handler(cli, fnum, level)) return false; } /* try to prevent loops */ SCVAL(cli->inbuf,smb_com,0xFF); @@ -238,14 +254,14 @@ bool cli_receive_smb_readX_header(struct cli_state *cli) } } - return True; + return true; read_err: cli->smb_rw_error = SMB_READ_ERROR; close(cli->fd); cli->fd = -1; - return False; + return false; } static ssize_t write_socket(int fd, const char *buf, size_t len) @@ -272,32 +288,54 @@ bool cli_send_smb(struct cli_state *cli) size_t len; size_t nwritten=0; ssize_t ret; + char *buf_out = cli->outbuf; + bool enc_on = cli_encryption_on(cli); /* fd == -1 causes segfaults -- Tom (tom@ninja.nl) */ if (cli->fd == -1) - return False; + return false; cli_calculate_sign_mac(cli); - len = smb_len(cli->outbuf) + 4; + if (enc_on) { + NTSTATUS status = cli_encrypt_message(cli, &buf_out); + if (!NT_STATUS_IS_OK(status)) { + close(cli->fd); + cli->fd = -1; + cli->smb_rw_error = SMB_WRITE_ERROR; + DEBUG(0,("Error in encrypting client message. Error %s\n", + nt_errstr(status) )); + return false; + } + } + + len = smb_len(buf_out) + 4; while (nwritten < len) { - ret = write_socket(cli->fd,cli->outbuf+nwritten,len - nwritten); + ret = write_socket(cli->fd,buf_out+nwritten,len - nwritten); if (ret <= 0) { + if (enc_on) { + cli_free_enc_buffer(cli, buf_out); + } close(cli->fd); cli->fd = -1; cli->smb_rw_error = SMB_WRITE_ERROR; DEBUG(0,("Error writing %d bytes to client. %d (%s)\n", (int)len,(int)ret, strerror(errno) )); - return False; + return false; } nwritten += ret; } + + if (enc_on) { + cli_free_enc_buffer(cli, buf_out); + } + /* Increment the mid so we can tell between responses. */ cli->mid++; if (!cli->mid) cli->mid++; - return True; + return true; } /**************************************************************************** @@ -347,7 +385,7 @@ bool cli_send_smb_direct_writeX(struct cli_state *cli, DEBUG(0,("Error writing %d extradata " "bytes to client. %d (%s)\n", (int)extradata,(int)ret, strerror(errno) )); - return False; + return false; } nwritten += ret; } @@ -409,7 +447,7 @@ void cli_init_creds(struct cli_state *cli, const char *username, const char *dom fstrcpy(cli->user_name, username); pwd_set_cleartext(&cli->pwd, password); if (!*username) { - cli->pwd.null_pwd = True; + cli->pwd.null_pwd = true; } DEBUG(10,("cli_init_creds: user %s domain %s\n", cli->user_name, cli->domain)); @@ -424,16 +462,16 @@ void cli_setup_signing_state(struct cli_state *cli, int signing_state) if (signing_state == Undefined) return; - if (signing_state == False) { - cli->sign_info.allow_smb_signing = False; - cli->sign_info.mandatory_signing = False; + if (signing_state == false) { + cli->sign_info.allow_smb_signing = false; + cli->sign_info.mandatory_signing = false; return; } - cli->sign_info.allow_smb_signing = True; + cli->sign_info.allow_smb_signing = true; if (signing_state == Required) - cli->sign_info.mandatory_signing = True; + cli->sign_info.mandatory_signing = true; } /**************************************************************************** @@ -470,7 +508,7 @@ struct cli_state *cli_initialise(void) cli->outbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN); cli->inbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN); cli->oplock_handler = cli_oplock_ack; - cli->case_sensitive = False; + cli->case_sensitive = false; cli->smb_rw_error = SMB_READ_OK; cli->use_spnego = lp_client_use_spnego(); @@ -481,13 +519,13 @@ struct cli_state *cli_initialise(void) client routines using DOS errors instead of STATUS32 ones. This intended only as a temporary hack. */ if (getenv("CLI_FORCE_DOSERR")) - cli->force_dos_errors = True; + cli->force_dos_errors = true; if (lp_client_signing()) - cli->sign_info.allow_smb_signing = True; + cli->sign_info.allow_smb_signing = true; if (lp_client_signing() == Required) - cli->sign_info.mandatory_signing = True; + cli->sign_info.mandatory_signing = true; if (!cli->outbuf || !cli->inbuf) goto error; @@ -522,7 +560,7 @@ struct cli_state *cli_initialise(void) /**************************************************************************** External interface. Close an open named pipe over SMB. Free any authentication data. - Returns False if the cli_close call failed. + Returns false if the cli_close call failed. ****************************************************************************/ bool cli_rpc_pipe_close(struct rpc_pipe_client *cli) @@ -530,7 +568,7 @@ bool cli_rpc_pipe_close(struct rpc_pipe_client *cli) bool ret; if (!cli) { - return False; + return false; } ret = cli_close(cli->cli, cli->fnum); @@ -650,15 +688,15 @@ bool cli_send_keepalive(struct cli_state *cli) { if (cli->fd == -1) { DEBUG(3, ("cli_send_keepalive: fd == -1\n")); - return False; + return false; } if (!send_keepalive(cli->fd)) { close(cli->fd); cli->fd = -1; DEBUG(0,("Error sending keepalive packet to client.\n")); - return False; + return false; } - return True; + return true; } /**************************************************************************** @@ -674,7 +712,7 @@ bool cli_echo(struct cli_state *cli, uint16 num_echos, SMB_ASSERT(length < 1024); memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,1,length,True); + cli_set_message(cli->outbuf,1,length,true); SCVAL(cli->outbuf,smb_com,SMBecho); SSVAL(cli->outbuf,smb_tid,65535); SSVAL(cli->outbuf,smb_vwv0,num_echos); @@ -689,13 +727,13 @@ bool cli_echo(struct cli_state *cli, uint16 num_echos, for (i=0; ioutbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,1, 0, true); + cli_set_message(cli->outbuf,1, 0, true); SCVAL(cli->outbuf,smb_com,SMBmv); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -470,7 +470,7 @@ bool cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fnam memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf, 4, 0, true); + cli_set_message(cli->outbuf, 4, 0, true); SCVAL(cli->outbuf,smb_com,SMBntrename); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -512,7 +512,7 @@ bool cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *f memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf, 4, 0, true); + cli_set_message(cli->outbuf, 4, 0, true); SCVAL(cli->outbuf,smb_com,SMBntrename); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -554,7 +554,7 @@ bool cli_unlink_full(struct cli_state *cli, const char *fname, uint16 attrs) memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,1, 0, true); + cli_set_message(cli->outbuf,1, 0, true); SCVAL(cli->outbuf,smb_com,SMBunlink); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -600,7 +600,7 @@ bool cli_mkdir(struct cli_state *cli, const char *dname) memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,0, 0, true); + cli_set_message(cli->outbuf,0, 0, true); SCVAL(cli->outbuf,smb_com,SMBmkdir); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -636,7 +636,7 @@ bool cli_rmdir(struct cli_state *cli, const char *dname) memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,0, 0, true); + cli_set_message(cli->outbuf,0, 0, true); SCVAL(cli->outbuf,smb_com,SMBrmdir); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -719,7 +719,7 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,24,0, true); + cli_set_message(cli->outbuf,24,0, true); SCVAL(cli->outbuf,smb_com,SMBntcreateX); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -815,7 +815,7 @@ int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,15,0, true); + cli_set_message(cli->outbuf,15,0, true); SCVAL(cli->outbuf,smb_com,SMBopenX); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -863,7 +863,7 @@ bool cli_close(struct cli_state *cli, int fnum) memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,3,0,True); + cli_set_message(cli->outbuf,3,0,True); SCVAL(cli->outbuf,smb_com,SMBclose); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -896,7 +896,7 @@ NTSTATUS cli_locktype(struct cli_state *cli, int fnum, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0', smb_size); - set_message(cli->outbuf,8,0,True); + cli_set_message(cli->outbuf,8,0,True); SCVAL(cli->outbuf,smb_com,SMBlockingX); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -948,7 +948,7 @@ bool cli_lock(struct cli_state *cli, int fnum, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0', smb_size); - set_message(cli->outbuf,8,0,True); + cli_set_message(cli->outbuf,8,0,True); SCVAL(cli->outbuf,smb_com,SMBlockingX); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -1001,7 +1001,7 @@ bool cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len) memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,8,0,True); + cli_set_message(cli->outbuf,8,0,True); SCVAL(cli->outbuf,smb_com,SMBlockingX); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -1053,7 +1053,7 @@ bool cli_lock64(struct cli_state *cli, int fnum, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0', smb_size); - set_message(cli->outbuf,8,0,True); + cli_set_message(cli->outbuf,8,0,True); SCVAL(cli->outbuf,smb_com,SMBlockingX); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -1108,7 +1108,7 @@ bool cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_ memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,8,0,True); + cli_set_message(cli->outbuf,8,0,True); SCVAL(cli->outbuf,smb_com,SMBlockingX); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -1255,7 +1255,7 @@ bool cli_getattrE(struct cli_state *cli, int fd, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,1,0,True); + cli_set_message(cli->outbuf,1,0,True); SCVAL(cli->outbuf,smb_com,SMBgetattrE); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -1307,7 +1307,7 @@ bool cli_getatr(struct cli_state *cli, const char *fname, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,0,0,True); + cli_set_message(cli->outbuf,0,0,True); SCVAL(cli->outbuf,smb_com,SMBgetatr); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -1359,7 +1359,7 @@ bool cli_setattrE(struct cli_state *cli, int fd, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,7,0,True); + cli_set_message(cli->outbuf,7,0,True); SCVAL(cli->outbuf,smb_com,SMBsetattrE); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -1398,7 +1398,7 @@ bool cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t) memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,8,0,True); + cli_set_message(cli->outbuf,8,0,True); SCVAL(cli->outbuf,smb_com,SMBsetatr); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -1452,7 +1452,7 @@ bool cli_chkpath(struct cli_state *cli, const char *path) } memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,0,0,True); + cli_set_message(cli->outbuf,0,0,True); SCVAL(cli->outbuf,smb_com,SMBcheckpath); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -1483,7 +1483,7 @@ bool cli_chkpath(struct cli_state *cli, const char *path) bool cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail) { memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,0,0,True); + cli_set_message(cli->outbuf,0,0,True); SCVAL(cli->outbuf,smb_com,SMBdskattr); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -1512,7 +1512,7 @@ int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path) memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,3,0,True); + cli_set_message(cli->outbuf,3,0,True); SCVAL(cli->outbuf,smb_com,SMBctemp); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -1565,7 +1565,7 @@ NTSTATUS cli_raw_ioctl(struct cli_state *cli, int fnum, uint32 code, DATA_BLOB * memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf, 3, 0, True); + cli_set_message(cli->outbuf, 3, 0, True); SCVAL(cli->outbuf,smb_com,SMBioctl); cli_setup_packet(cli); diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c index 1a75d144b2..107613c618 100644 --- a/source3/libsmb/clifsinfo.c +++ b/source3/libsmb/clifsinfo.c @@ -2,6 +2,7 @@ Unix SMB/CIFS implementation. FS info functions Copyright (C) Stefan (metze) Metzmacher 2003 + Copyright (C) Jeremy Allison 2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -301,3 +302,335 @@ cleanup: return ret; } + +/****************************************************************************** + Send/receive the request encryption blob. +******************************************************************************/ + +static NTSTATUS enc_blob_send_receive(struct cli_state *cli, DATA_BLOB *in, DATA_BLOB *out, DATA_BLOB *param_out) +{ + uint16 setup; + char param[4]; + char *rparam=NULL, *rdata=NULL; + unsigned int rparam_count=0, rdata_count=0; + NTSTATUS status = NT_STATUS_OK; + + setup = TRANSACT2_SETFSINFO; + + SSVAL(param,0,0); + SSVAL(param,2,SMB_REQUEST_TRANSPORT_ENCRYPTION); + + if (!cli_send_trans(cli, SMBtrans2, + NULL, + 0, 0, + &setup, 1, 0, + param, 4, 0, + (char *)in->data, in->length, CLI_BUFFER_SIZE)) { + status = cli_nt_error(cli); + goto out; + } + + if (!cli_receive_trans(cli, SMBtrans2, + &rparam, &rparam_count, + &rdata, &rdata_count)) { + status = cli_nt_error(cli); + goto out; + } + + if (cli_is_error(cli)) { + status = cli_nt_error(cli); + if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { + goto out; + } + } + + *out = data_blob(rdata, rdata_count); + *param_out = data_blob(rparam, rparam_count); + + out: + + SAFE_FREE(rparam); + SAFE_FREE(rdata); + return status; +} + +/****************************************************************************** + Make a client state struct. +******************************************************************************/ + +static struct smb_trans_enc_state *make_cli_enc_state(enum smb_trans_enc_type smb_enc_type) +{ + struct smb_trans_enc_state *es = NULL; + es = SMB_MALLOC_P(struct smb_trans_enc_state); + if (!es) { + return NULL; + } + ZERO_STRUCTP(es); + es->smb_enc_type = smb_enc_type; + + if (smb_enc_type == SMB_TRANS_ENC_GSS) { +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + es->s.gss_state = SMB_MALLOC_P(struct smb_tran_enc_state_gss); + if (!es->s.gss_state) { + SAFE_FREE(es); + return NULL; + } + ZERO_STRUCTP(es->s.gss_state); +#else + DEBUG(0,("make_cli_enc_state: no krb5 compiled.\n")); + SAFE_FREE(es); + return NULL; +#endif + } + return es; +} + +/****************************************************************************** + Start a raw ntlmssp encryption. +******************************************************************************/ + +NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli, + const char *user, + const char *pass, + const char *domain) +{ + DATA_BLOB blob_in = data_blob_null; + DATA_BLOB blob_out = data_blob_null; + DATA_BLOB param_out = data_blob_null; + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + struct smb_trans_enc_state *es = make_cli_enc_state(SMB_TRANS_ENC_NTLM); + + if (!es) { + return NT_STATUS_NO_MEMORY; + } + status = ntlmssp_client_start(&es->s.ntlmssp_state); + if (!NT_STATUS_IS_OK(status)) { + goto fail; + } + + ntlmssp_want_feature(es->s.ntlmssp_state, NTLMSSP_FEATURE_SESSION_KEY); + es->s.ntlmssp_state->neg_flags |= (NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL); + + if (!NT_STATUS_IS_OK(status = ntlmssp_set_username(es->s.ntlmssp_state, user))) { + goto fail; + } + if (!NT_STATUS_IS_OK(status = ntlmssp_set_domain(es->s.ntlmssp_state, domain))) { + goto fail; + } + if (!NT_STATUS_IS_OK(status = ntlmssp_set_password(es->s.ntlmssp_state, pass))) { + goto fail; + } + + do { + status = ntlmssp_update(es->s.ntlmssp_state, blob_in, &blob_out); + data_blob_free(&blob_in); + data_blob_free(¶m_out); + if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) || NT_STATUS_IS_OK(status)) { + NTSTATUS trans_status = enc_blob_send_receive(cli, + &blob_out, + &blob_in, + ¶m_out); + if (!NT_STATUS_EQUAL(trans_status, + NT_STATUS_MORE_PROCESSING_REQUIRED) && + !NT_STATUS_IS_OK(trans_status)) { + status = trans_status; + } else { + if (param_out.length == 2) { + es->enc_ctx_num = SVAL(param_out.data, 0); + } + } + } + data_blob_free(&blob_out); + } while (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)); + + data_blob_free(&blob_in); + + if (NT_STATUS_IS_OK(status)) { + /* Replace the old state, if any. */ + if (cli->trans_enc_state) { + common_free_encryption_state(&cli->trans_enc_state); + } + cli->trans_enc_state = es; + cli->trans_enc_state->enc_on = True; + es = NULL; + } + + fail: + + common_free_encryption_state(&es); + return status; +} + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + +#ifndef SMB_GSS_REQUIRED_FLAGS +#define SMB_GSS_REQUIRED_FLAGS (GSS_C_CONF_FLAG|GSS_C_INTEG_FLAG|GSS_C_MUTUAL_FLAG|GSS_C_REPLAY_FLAG|GSS_C_SEQUENCE_FLAG) +#endif + +/****************************************************************************** + Get client gss blob to send to a server. +******************************************************************************/ + +static NTSTATUS make_cli_gss_blob(struct smb_trans_enc_state *es, + const char *service, + const char *host, + NTSTATUS status_in, + DATA_BLOB spnego_blob_in, + DATA_BLOB *p_blob_out) +{ + const char *krb_mechs[] = {OID_KERBEROS5, NULL}; + OM_uint32 ret; + OM_uint32 min; + gss_name_t srv_name; + gss_buffer_desc input_name; + gss_buffer_desc *p_tok_in; + gss_buffer_desc tok_out, tok_in; + DATA_BLOB blob_out = data_blob_null; + DATA_BLOB blob_in = data_blob_null; + char *host_princ_s = NULL; + OM_uint32 ret_flags = 0; + NTSTATUS status = NT_STATUS_OK; + + gss_OID_desc nt_hostbased_service = + {10, CONST_DISCARD(char *,"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04")}; + + memset(&tok_out, '\0', sizeof(tok_out)); + + /* Get a ticket for the service@host */ + asprintf(&host_princ_s, "%s@%s", service, host); + if (host_princ_s == NULL) { + return NT_STATUS_NO_MEMORY; + } + + input_name.value = host_princ_s; + input_name.length = strlen(host_princ_s) + 1; + + ret = gss_import_name(&min, + &input_name, + &nt_hostbased_service, + &srv_name); + + if (ret != GSS_S_COMPLETE) { + SAFE_FREE(host_princ_s); + return map_nt_error_from_gss(ret, min); + } + + if (spnego_blob_in.length == 0) { + p_tok_in = GSS_C_NO_BUFFER; + } else { + /* Remove the SPNEGO wrapper */ + if (!spnego_parse_auth_response(spnego_blob_in, status_in, OID_KERBEROS5, &blob_in)) { + status = NT_STATUS_UNSUCCESSFUL; + goto fail; + } + tok_in.value = blob_in.data; + tok_in.length = blob_in.length; + p_tok_in = &tok_in; + } + + ret = gss_init_sec_context(&min, + GSS_C_NO_CREDENTIAL, /* Use our default cred. */ + &es->s.gss_state->gss_ctx, + srv_name, + GSS_C_NO_OID, /* default OID. */ + GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG | GSS_C_SEQUENCE_FLAG, + GSS_C_INDEFINITE, /* requested ticket lifetime. */ + NULL, /* no channel bindings */ + p_tok_in, + NULL, /* ignore mech type */ + &tok_out, + &ret_flags, + NULL); /* ignore time_rec */ + + status = map_nt_error_from_gss(ret, min); + if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED)) { + ADS_STATUS adss = ADS_ERROR_GSS(ret, min); + DEBUG(10,("make_cli_gss_blob: gss_init_sec_context failed with %s\n", + ads_errstr(adss))); + goto fail; + } + + if ((ret_flags & SMB_GSS_REQUIRED_FLAGS) != SMB_GSS_REQUIRED_FLAGS) { + status = NT_STATUS_ACCESS_DENIED; + } + + blob_out = data_blob(tok_out.value, tok_out.length); + + /* Wrap in an SPNEGO wrapper */ + *p_blob_out = gen_negTokenTarg(krb_mechs, blob_out); + + fail: + + data_blob_free(&blob_out); + data_blob_free(&blob_in); + SAFE_FREE(host_princ_s); + gss_release_name(&min, &srv_name); + if (tok_out.value) { + gss_release_buffer(&min, &tok_out); + } + return status; +} + +/****************************************************************************** + Start a SPNEGO gssapi encryption context. +******************************************************************************/ + +NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli) +{ + DATA_BLOB blob_recv = data_blob_null; + DATA_BLOB blob_send = data_blob_null; + DATA_BLOB param_out = data_blob_null; + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + fstring fqdn; + const char *servicename; + struct smb_trans_enc_state *es = make_cli_enc_state(SMB_TRANS_ENC_GSS); + + if (!es) { + return NT_STATUS_NO_MEMORY; + } + + name_to_fqdn(fqdn, cli->desthost); + strlower_m(fqdn); + + servicename = "cifs"; + status = make_cli_gss_blob(es, servicename, fqdn, NT_STATUS_OK, blob_recv, &blob_send); + if (!NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED)) { + servicename = "host"; + status = make_cli_gss_blob(es, servicename, fqdn, NT_STATUS_OK, blob_recv, &blob_send); + if (!NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED)) { + goto fail; + } + } + + do { + data_blob_free(&blob_recv); + status = enc_blob_send_receive(cli, &blob_send, &blob_recv, ¶m_out); + if (param_out.length == 2) { + es->enc_ctx_num = SVAL(param_out.data, 0); + } + data_blob_free(&blob_send); + status = make_cli_gss_blob(es, servicename, fqdn, status, blob_recv, &blob_send); + } while (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)); + data_blob_free(&blob_recv); + + if (NT_STATUS_IS_OK(status)) { + /* Replace the old state, if any. */ + if (cli->trans_enc_state) { + common_free_encryption_state(&cli->trans_enc_state); + } + cli->trans_enc_state = es; + cli->trans_enc_state->enc_on = True; + es = NULL; + } + + fail: + + common_free_encryption_state(&es); + return status; +} +#else +NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli) +{ + return NT_STATUS_NOT_SUPPORTED; +} +#endif diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 2e4c360507..d5c7db09e9 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -521,7 +521,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,2,0,True); + cli_set_message(cli->outbuf,2,0,True); SCVAL(cli->outbuf,smb_com,SMBsearch); @@ -581,7 +581,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,2,0,True); + cli_set_message(cli->outbuf,2,0,True); SCVAL(cli->outbuf,smb_com,SMBfclose); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); diff --git a/source3/libsmb/climessage.c b/source3/libsmb/climessage.c index 13ef1d43d4..00c25aa725 100644 --- a/source3/libsmb/climessage.c +++ b/source3/libsmb/climessage.c @@ -29,7 +29,7 @@ int cli_message_start_build(struct cli_state *cli, const char *host, const char /* construct a SMBsendstrt command */ memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,0,0,True); + cli_set_message(cli->outbuf,0,0,True); SCVAL(cli->outbuf,smb_com,SMBsendstrt); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -75,7 +75,7 @@ int cli_message_text_build(struct cli_state *cli, const char *msg, int len, int char *p; memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,1,0,True); + cli_set_message(cli->outbuf,1,0,True); SCVAL(cli->outbuf,smb_com,SMBsendtxt); SSVAL(cli->outbuf,smb_tid,cli->cnum); cli_setup_packet(cli); @@ -132,7 +132,7 @@ int cli_message_end_build(struct cli_state *cli, int grp) char *p; memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,1,0,True); + cli_set_message(cli->outbuf,1,0,True); SCVAL(cli->outbuf,smb_com,SMBsendend); SSVAL(cli->outbuf,smb_tid,cli->cnum); diff --git a/source3/libsmb/clioplock.c b/source3/libsmb/clioplock.c index 2e54f5a781..ef8b396461 100644 --- a/source3/libsmb/clioplock.c +++ b/source3/libsmb/clioplock.c @@ -32,7 +32,7 @@ bool cli_oplock_ack(struct cli_state *cli, int fnum, unsigned char level) cli->outbuf = buf; memset(buf,'\0',smb_size); - set_message(buf,8,0,True); + cli_set_message(buf,8,0,True); SCVAL(buf,smb_com,SMBlockingX); SSVAL(buf,smb_tid, cli->cnum); diff --git a/source3/libsmb/cliprint.c b/source3/libsmb/cliprint.c index 7fbdb97c01..223ddb4186 100644 --- a/source3/libsmb/cliprint.c +++ b/source3/libsmb/cliprint.c @@ -195,7 +195,7 @@ int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_ memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,15,0,True); + cli_set_message(cli->outbuf,15,0,True); SCVAL(cli->outbuf,smb_com,SMBsplopen); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -242,7 +242,7 @@ bool cli_spl_close(struct cli_state *cli, int fnum) memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,3,0,True); + cli_set_message(cli->outbuf,3,0,True); SCVAL(cli->outbuf,smb_com,SMBsplclose); SSVAL(cli->outbuf,smb_tid,cli->cnum); diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index d77875bae5..0b33e43563 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -34,7 +34,7 @@ static bool cli_issue_read(struct cli_state *cli, int fnum, off_t offset, if ((SMB_BIG_UINT)offset >> 32) bigoffset = True; - set_message(cli->outbuf,bigoffset ? 12 : 10,0,True); + cli_set_message(cli->outbuf,bigoffset ? 12 : 10,0,True); SCVAL(cli->outbuf,smb_com,SMBreadX); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -65,8 +65,8 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_ size_t size2; size_t readsize; ssize_t total = 0; - /* We can only do direct reads if not signing. */ - bool direct_reads = !client_is_signing_on(cli); + /* We can only do direct reads if not signing or encrypting. */ + bool direct_reads = !client_is_signing_on(cli) && !cli_encryption_on(cli); if (size == 0) return 0; @@ -76,7 +76,9 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_ * rounded down to a multiple of 1024. */ - if (client_is_signing_on(cli) == False && (cli->posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) { + if (client_is_signing_on(cli) == false && + cli_encryption_on(cli) == false && + (cli->posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) { readsize = CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE; } else if (cli->capabilities & CAP_LARGE_READX) { if (cli->is_samba) { @@ -203,7 +205,7 @@ static bool cli_issue_readraw(struct cli_state *cli, int fnum, off_t offset, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,10,0,True); + cli_set_message(cli->outbuf,10,0,True); SCVAL(cli->outbuf,smb_com,SMBreadbraw); SSVAL(cli->outbuf,smb_tid,cli->cnum); @@ -295,8 +297,8 @@ static bool cli_issue_write(struct cli_state *cli, { char *p; bool large_writex = false; - /* We can only do direct writes if not signing. */ - bool direct_writes = !client_is_signing_on(cli); + /* We can only do direct writes if not signing and not encrypting. */ + bool direct_writes = !client_is_signing_on(cli) && !cli_encryption_on(cli); if (!direct_writes && size + 1 > cli->bufsize) { cli->outbuf = (char *)SMB_REALLOC(cli->outbuf, size + 1024); @@ -319,9 +321,9 @@ static bool cli_issue_write(struct cli_state *cli, } if (large_writex) { - set_message(cli->outbuf,14,0,True); + cli_set_message(cli->outbuf,14,0,True); } else { - set_message(cli->outbuf,12,0,True); + cli_set_message(cli->outbuf,12,0,True); } SCVAL(cli->outbuf,smb_com,SMBwriteX); @@ -404,16 +406,17 @@ ssize_t cli_write(struct cli_state *cli, if (write_mode == 0 && !client_is_signing_on(cli) && + !cli_encryption_on(cli) && (cli->posix_capabilities & CIFS_UNIX_LARGE_WRITE_CAP) && (cli->capabilities & CAP_LARGE_FILES)) { /* Only do massive writes if we can do them direct - * with no signing - not on a pipe. */ + * with no signing or encrypting - not on a pipe. */ writesize = CLI_SAMBA_MAX_POSIX_LARGE_WRITEX_SIZE; - } else if (cli->capabilities & CAP_LARGE_READX) { + } else if (cli->capabilities & CAP_LARGE_WRITEX) { if (cli->is_samba) { - writesize = CLI_SAMBA_MAX_LARGE_READX_SIZE; + writesize = CLI_SAMBA_MAX_LARGE_WRITEX_SIZE; } else { - writesize = CLI_WINDOWS_MAX_LARGE_READX_SIZE; + writesize = CLI_WINDOWS_MAX_LARGE_WRITEX_SIZE; } } else { writesize = (cli->max_xmit - (smb_size+32)) & ~1023; @@ -471,7 +474,7 @@ ssize_t cli_smbwrite(struct cli_state *cli, memset(cli->outbuf,'\0',smb_size); memset(cli->inbuf,'\0',smb_size); - set_message(cli->outbuf,5, 0,True); + cli_set_message(cli->outbuf,5, 0,True); SCVAL(cli->outbuf,smb_com,SMBwrite); SSVAL(cli->outbuf,smb_tid,cli->cnum); diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index a6f7f7fec1..bfb31fdb74 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -43,7 +43,7 @@ bool cli_send_trans(struct cli_state *cli, int trans, this_ldata = MIN(ldata,cli->max_xmit - (500+lsetup*2+this_lparam)); memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,14+lsetup,0,True); + cli_set_message(cli->outbuf,14+lsetup,0,True); SCVAL(cli->outbuf,smb_com,trans); SSVAL(cli->outbuf,smb_tid, cli->cnum); cli_setup_packet(cli); @@ -107,7 +107,7 @@ bool cli_send_trans(struct cli_state *cli, int trans, this_lparam = MIN(lparam-tot_param,cli->max_xmit - 500); /* hack */ this_ldata = MIN(ldata-tot_data,cli->max_xmit - (500+this_lparam)); - set_message(cli->outbuf,trans==SMBtrans?8:9,0,True); + cli_set_message(cli->outbuf,trans==SMBtrans?8:9,0,True); SCVAL(cli->outbuf,smb_com,(trans==SMBtrans ? SMBtranss : SMBtranss2)); outparam = smb_buf(cli->outbuf); @@ -368,7 +368,7 @@ bool cli_send_nt_trans(struct cli_state *cli, this_ldata = MIN(ldata,cli->max_xmit - (500+lsetup*2+this_lparam)); memset(cli->outbuf,'\0',smb_size); - set_message(cli->outbuf,19+lsetup,0,True); + cli_set_message(cli->outbuf,19+lsetup,0,True); SCVAL(cli->outbuf,smb_com,SMBnttrans); SSVAL(cli->outbuf,smb_tid, cli->cnum); cli_setup_packet(cli); @@ -424,7 +424,7 @@ bool cli_send_nt_trans(struct cli_state *cli, this_lparam = MIN(lparam-tot_param,cli->max_xmit - 500); /* hack */ this_ldata = MIN(ldata-tot_data,cli->max_xmit - (500+this_lparam)); - set_message(cli->outbuf,18,0,True); + cli_set_message(cli->outbuf,18,0,True); SCVAL(cli->outbuf,smb_com,SMBnttranss); /* XXX - these should probably be aligned */ diff --git a/source3/libsmb/errormap.c b/source3/libsmb/errormap.c index ce826ae999..4ec30f7e17 100644 --- a/source3/libsmb/errormap.c +++ b/source3/libsmb/errormap.c @@ -1502,3 +1502,108 @@ WERROR ntstatus_to_werror(NTSTATUS error) /* a lame guess */ return W_ERROR(NT_STATUS_V(error) & 0xffff); } + +#if defined(HAVE_GSSAPI) +/******************************************************************************* + Map between gssapi errors and NT status. I made these up :-(. JRA. +*******************************************************************************/ + +static const struct { + unsigned long gss_err; + NTSTATUS ntstatus; +} gss_to_ntstatus_errormap[] = { +#if defined(GSS_S_CALL_INACCESSIBLE_READ) + {GSS_S_CALL_INACCESSIBLE_READ, NT_STATUS_INVALID_PARAMETER}, +#endif +#if defined(GSS_S_CALL_INACCESSIBLE_WRITE) + {GSS_S_CALL_INACCESSIBLE_WRITE, NT_STATUS_INVALID_PARAMETER}, +#endif +#if defined(GSS_S_CALL_BAD_STRUCTURE) + {GSS_S_CALL_BAD_STRUCTURE, NT_STATUS_INVALID_PARAMETER}, +#endif +#if defined(GSS_S_BAD_MECH) + {GSS_S_BAD_MECH, NT_STATUS_INVALID_PARAMETER}, +#endif +#if defined(GSS_S_BAD_NAME) + {GSS_S_BAD_NAME, NT_STATUS_INVALID_ACCOUNT_NAME}, +#endif +#if defined(GSS_S_BAD_NAMETYPE) + {GSS_S_BAD_NAMETYPE, NT_STATUS_INVALID_PARAMETER}, +#endif +#if defined(GSS_S_BAD_BINDINGS) + {GSS_S_BAD_BINDINGS, NT_STATUS_INVALID_PARAMETER}, +#endif +#if defined(GSS_S_BAD_STATUS) + {GSS_S_BAD_STATUS, NT_STATUS_UNSUCCESSFUL}, +#endif +#if defined(GSS_S_BAD_SIG) + {GSS_S_BAD_SIG, NT_STATUS_ACCESS_DENIED}, +#endif +#if defined(GSS_S_NO_CRED) + {GSS_S_NO_CRED, NT_STATUS_ACCESS_DENIED}, +#endif +#if defined(GSS_S_NO_CONTEXT) + {GSS_S_NO_CONTEXT, NT_STATUS_ACCESS_DENIED}, +#endif +#if defined(GSS_S_DEFECTIVE_TOKEN) + {GSS_S_DEFECTIVE_TOKEN, NT_STATUS_ACCESS_DENIED}, +#endif +#if defined(GSS_S_DEFECTIVE_CREDENTIAL) + {GSS_S_DEFECTIVE_CREDENTIAL, NT_STATUS_ACCESS_DENIED}, +#endif +#if defined(GSS_S_CREDENTIALS_EXPIRED) + {GSS_S_CREDENTIALS_EXPIRED, NT_STATUS_PASSWORD_EXPIRED}, +#endif +#if defined(GSS_S_CONTEXT_EXPIRED) + {GSS_S_CONTEXT_EXPIRED, NT_STATUS_PASSWORD_EXPIRED}, +#endif +#if defined(GSS_S_BAD_QOP) + {GSS_S_BAD_QOP, NT_STATUS_ACCESS_DENIED}, +#endif +#if defined(GSS_S_UNAUTHORIZED) + {GSS_S_UNAUTHORIZED, NT_STATUS_ACCESS_DENIED}, +#endif +#if defined(GSS_S_UNAVAILABLE) + {GSS_S_UNAVAILABLE, NT_STATUS_UNSUCCESSFUL}, +#endif +#if defined(GSS_S_DUPLICATE_ELEMENT) + {GSS_S_DUPLICATE_ELEMENT, NT_STATUS_INVALID_PARAMETER}, +#endif +#if defined(GSS_S_NAME_NOT_MN) + {GSS_S_NAME_NOT_MN, NT_STATUS_INVALID_PARAMETER}, +#endif + { 0, NT_STATUS_OK } +}; + +/********************************************************************* + Map an NT error code from a gssapi error code. +*********************************************************************/ + +NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor) +{ + int i = 0; + + if (gss_maj == GSS_S_COMPLETE) { + return NT_STATUS_OK; + } + + if (gss_maj == GSS_S_CONTINUE_NEEDED) { + return NT_STATUS_MORE_PROCESSING_REQUIRED; + } + + if (gss_maj == GSS_S_FAILURE) { + return map_nt_error_from_unix((int)minor); + } + + /* Look through list */ + while(gss_to_ntstatus_errormap[i].gss_err != 0) { + if (gss_to_ntstatus_errormap[i].gss_err == gss_maj) { + return gss_to_ntstatus_errormap[i].ntstatus; + } + i++; + } + + /* Default return */ + return NT_STATUS_ACCESS_DENIED; +} +#endif diff --git a/source3/libsmb/smb_seal.c b/source3/libsmb/smb_seal.c new file mode 100644 index 0000000000..055a27d05a --- /dev/null +++ b/source3/libsmb/smb_seal.c @@ -0,0 +1,496 @@ +/* + Unix SMB/CIFS implementation. + SMB Transport encryption (sealing) code. + Copyright (C) Jeremy Allison 2007. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" + +/****************************************************************************** + Pull out the encryption context for this packet. 0 means global context. +******************************************************************************/ + +NTSTATUS get_enc_ctx_num(const char *buf, uint16 *p_enc_ctx_num) +{ + if (smb_len(buf) < 8) { + return NT_STATUS_INVALID_BUFFER_SIZE; + } + + if (buf[4] == (char)0xFF) { + if (buf[5] == 'S' && buf [6] == 'M' && buf[7] == 'B') { + /* Not an encrypted buffer. */ + return NT_STATUS_NOT_FOUND; + } + if (buf[5] == 'E') { + *p_enc_ctx_num = SVAL(buf,6); + return NT_STATUS_OK; + } + } + return NT_STATUS_INVALID_NETWORK_RESPONSE; +} + +/****************************************************************************** + Generic code for client and server. + Is encryption turned on ? +******************************************************************************/ + +bool common_encryption_on(struct smb_trans_enc_state *es) +{ + return ((es != NULL) && es->enc_on); +} + +/****************************************************************************** + Generic code for client and server. + NTLM decrypt an incoming buffer. + Abartlett tells me that SSPI puts the signature first before the encrypted + output, so cope with the same for compatibility. +******************************************************************************/ + +NTSTATUS common_ntlm_decrypt_buffer(NTLMSSP_STATE *ntlmssp_state, char *buf) +{ + NTSTATUS status; + size_t buf_len = smb_len(buf) + 4; /* Don't forget the 4 length bytes. */ + size_t data_len; + char *inbuf; + DATA_BLOB sig; + + if (buf_len < 8 + NTLMSSP_SIG_SIZE) { + return NT_STATUS_BUFFER_TOO_SMALL; + } + + inbuf = (char *)smb_xmemdup(buf, buf_len); + + /* Adjust for the signature. */ + data_len = buf_len - 8 - NTLMSSP_SIG_SIZE; + + /* Point at the signature. */ + sig = data_blob_const(inbuf+8, NTLMSSP_SIG_SIZE); + + status = ntlmssp_unseal_packet(ntlmssp_state, + (unsigned char *)inbuf + 8 + NTLMSSP_SIG_SIZE, /* 4 byte len + 0xFF 'E' */ + data_len, + (unsigned char *)inbuf + 8 + NTLMSSP_SIG_SIZE, + data_len, + &sig); + + if (!NT_STATUS_IS_OK(status)) { + SAFE_FREE(inbuf); + return status; + } + + memcpy(buf + 8, inbuf + 8 + NTLMSSP_SIG_SIZE, data_len); + + /* Reset the length. */ + _smb_setlen(buf,data_len + 4); + + SAFE_FREE(inbuf); + return NT_STATUS_OK; +} + +/****************************************************************************** + Generic code for client and server. + NTLM encrypt an outgoing buffer. Return the encrypted pointer in ppbuf_out. + Abartlett tells me that SSPI puts the signature first before the encrypted + output, so do the same for compatibility. +******************************************************************************/ + +NTSTATUS common_ntlm_encrypt_buffer(NTLMSSP_STATE *ntlmssp_state, + uint16 enc_ctx_num, + char *buf, + char **ppbuf_out) +{ + NTSTATUS status; + char *buf_out; + size_t data_len = smb_len(buf) - 4; /* Ignore the 0xFF SMB bytes. */ + DATA_BLOB sig; + + *ppbuf_out = NULL; + + if (data_len == 0) { + return NT_STATUS_BUFFER_TOO_SMALL; + } + + /* + * We know smb_len can't return a value > 128k, so no int overflow + * check needed. + */ + + buf_out = SMB_XMALLOC_ARRAY(char, 8 + NTLMSSP_SIG_SIZE + data_len); + + /* Copy the data from the original buffer. */ + + memcpy(buf_out + 8 + NTLMSSP_SIG_SIZE, buf + 8, data_len); + + smb_set_enclen(buf_out, smb_len(buf) + NTLMSSP_SIG_SIZE, enc_ctx_num); + + sig = data_blob(NULL, NTLMSSP_SIG_SIZE); + + status = ntlmssp_seal_packet(ntlmssp_state, + (unsigned char *)buf_out + 8 + NTLMSSP_SIG_SIZE, /* 4 byte len + 0xFF 'S' */ + data_len, + (unsigned char *)buf_out + 8 + NTLMSSP_SIG_SIZE, + data_len, + &sig); + + if (!NT_STATUS_IS_OK(status)) { + data_blob_free(&sig); + SAFE_FREE(buf_out); + return status; + } + + /* First 16 data bytes are signature for SSPI compatibility. */ + memcpy(buf_out + 8, sig.data, NTLMSSP_SIG_SIZE); + *ppbuf_out = buf_out; + return NT_STATUS_OK; +} + +/****************************************************************************** + Generic code for client and server. + gss-api decrypt an incoming buffer. We insist that the size of the + unwrapped buffer must be smaller or identical to the incoming buffer. +******************************************************************************/ + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) +static NTSTATUS common_gss_decrypt_buffer(struct smb_tran_enc_state_gss *gss_state, char *buf) +{ + gss_ctx_id_t gss_ctx = gss_state->gss_ctx; + OM_uint32 ret = 0; + OM_uint32 minor = 0; + int flags_got = 0; + gss_buffer_desc in_buf, out_buf; + size_t buf_len = smb_len(buf) + 4; /* Don't forget the 4 length bytes. */ + + if (buf_len < 8) { + return NT_STATUS_BUFFER_TOO_SMALL; + } + + in_buf.value = buf + 8; + in_buf.length = buf_len - 8; + + ret = gss_unwrap(&minor, + gss_ctx, + &in_buf, + &out_buf, + &flags_got, /* did we get sign+seal ? */ + (gss_qop_t *) NULL); + + if (ret != GSS_S_COMPLETE) { + ADS_STATUS adss = ADS_ERROR_GSS(ret, minor); + DEBUG(0,("common_gss_encrypt_buffer: gss_unwrap failed. Error %s\n", + ads_errstr(adss) )); + return map_nt_error_from_gss(ret, minor); + } + + if (out_buf.length > in_buf.length) { + DEBUG(0,("common_gss_encrypt_buffer: gss_unwrap size (%u) too large (%u) !\n", + (unsigned int)out_buf.length, + (unsigned int)in_buf.length )); + gss_release_buffer(&minor, &out_buf); + return NT_STATUS_INVALID_PARAMETER; + } + + memcpy(buf + 8, out_buf.value, out_buf.length); + _smb_setlen(buf, out_buf.length + 4); + + gss_release_buffer(&minor, &out_buf); + return NT_STATUS_OK; +} + +/****************************************************************************** + Generic code for client and server. + gss-api encrypt an outgoing buffer. Return the alloced encrypted pointer in buf_out. +******************************************************************************/ + +static NTSTATUS common_gss_encrypt_buffer(struct smb_tran_enc_state_gss *gss_state, + uint16 enc_ctx_num, + char *buf, + char **ppbuf_out) +{ + gss_ctx_id_t gss_ctx = gss_state->gss_ctx; + OM_uint32 ret = 0; + OM_uint32 minor = 0; + int flags_got = 0; + gss_buffer_desc in_buf, out_buf; + size_t buf_len = smb_len(buf) + 4; /* Don't forget the 4 length bytes. */ + + *ppbuf_out = NULL; + + if (buf_len < 8) { + return NT_STATUS_BUFFER_TOO_SMALL; + } + + in_buf.value = buf + 8; + in_buf.length = buf_len - 8; + + ret = gss_wrap(&minor, + gss_ctx, + true, /* we want sign+seal. */ + GSS_C_QOP_DEFAULT, + &in_buf, + &flags_got, /* did we get sign+seal ? */ + &out_buf); + + if (ret != GSS_S_COMPLETE) { + ADS_STATUS adss = ADS_ERROR_GSS(ret, minor); + DEBUG(0,("common_gss_encrypt_buffer: gss_wrap failed. Error %s\n", + ads_errstr(adss) )); + return map_nt_error_from_gss(ret, minor); + } + + if (!flags_got) { + /* Sign+seal not supported. */ + gss_release_buffer(&minor, &out_buf); + return NT_STATUS_NOT_SUPPORTED; + } + + /* Ya see - this is why I *hate* gss-api. I don't + * want to have to malloc another buffer of the + * same size + 8 bytes just to get a continuous + * header + buffer, but gss won't let me pass in + * a pre-allocated buffer. Bastards (and you know + * who you are....). I might fix this by + * going to "encrypt_and_send" passing in a file + * descriptor and doing scatter-gather write with + * TCP cork on Linux. But I shouldn't have to + * bother :-*(. JRA. + */ + + *ppbuf_out = (char *)SMB_MALLOC(out_buf.length + 8); /* We know this can't wrap. */ + if (!*ppbuf_out) { + gss_release_buffer(&minor, &out_buf); + return NT_STATUS_NO_MEMORY; + } + + memcpy(*ppbuf_out+8, out_buf.value, out_buf.length); + smb_set_enclen(*ppbuf_out, out_buf.length + 4, enc_ctx_num); + + gss_release_buffer(&minor, &out_buf); + return NT_STATUS_OK; +} +#endif + +/****************************************************************************** + Generic code for client and server. + Encrypt an outgoing buffer. Return the alloced encrypted pointer in buf_out. +******************************************************************************/ + +NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out) +{ + if (!common_encryption_on(es)) { + /* Not encrypting. */ + *buf_out = buffer; + return NT_STATUS_OK; + } + + switch (es->smb_enc_type) { + case SMB_TRANS_ENC_NTLM: + return common_ntlm_encrypt_buffer(es->s.ntlmssp_state, es->enc_ctx_num, buffer, buf_out); +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + case SMB_TRANS_ENC_GSS: + return common_gss_encrypt_buffer(es->s.gss_state, es->enc_ctx_num, buffer, buf_out); +#endif + default: + return NT_STATUS_NOT_SUPPORTED; + } +} + +/****************************************************************************** + Generic code for client and server. + Decrypt an incoming SMB buffer. Replaces the data within it. + New data must be less than or equal to the current length. +******************************************************************************/ + +NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf) +{ + if (!common_encryption_on(es)) { + /* Not decrypting. */ + return NT_STATUS_OK; + } + + switch (es->smb_enc_type) { + case SMB_TRANS_ENC_NTLM: + return common_ntlm_decrypt_buffer(es->s.ntlmssp_state, buf); +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + case SMB_TRANS_ENC_GSS: + return common_gss_decrypt_buffer(es->s.gss_state, buf); +#endif + default: + return NT_STATUS_NOT_SUPPORTED; + } +} + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) +/****************************************************************************** + Shutdown a gss encryption state. +******************************************************************************/ + +static void common_free_gss_state(struct smb_tran_enc_state_gss **pp_gss_state) +{ + OM_uint32 minor = 0; + struct smb_tran_enc_state_gss *gss_state = *pp_gss_state; + + if (gss_state->creds != GSS_C_NO_CREDENTIAL) { + gss_release_cred(&minor, &gss_state->creds); + } + if (gss_state->gss_ctx != GSS_C_NO_CONTEXT) { + gss_delete_sec_context(&minor, &gss_state->gss_ctx, NULL); + } + SAFE_FREE(*pp_gss_state); +} +#endif + +/****************************************************************************** + Shutdown an encryption state. +******************************************************************************/ + +void common_free_encryption_state(struct smb_trans_enc_state **pp_es) +{ + struct smb_trans_enc_state *es = *pp_es; + + if (es == NULL) { + return; + } + + if (es->smb_enc_type == SMB_TRANS_ENC_NTLM) { + if (es->s.ntlmssp_state) { + ntlmssp_end(&es->s.ntlmssp_state); + } + } +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + if (es->smb_enc_type == SMB_TRANS_ENC_GSS) { + /* Free the gss context handle. */ + if (es->s.gss_state) { + common_free_gss_state(&es->s.gss_state); + } + } +#endif + SAFE_FREE(es); + *pp_es = NULL; +} + +/****************************************************************************** + Free an encryption-allocated buffer. +******************************************************************************/ + +void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf) +{ + if (!common_encryption_on(es)) { + return; + } + + if (es->smb_enc_type == SMB_TRANS_ENC_NTLM) { + SAFE_FREE(buf); + return; + } + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + if (es->smb_enc_type == SMB_TRANS_ENC_GSS) { + OM_uint32 min; + gss_buffer_desc rel_buf; + rel_buf.value = buf; + rel_buf.length = smb_len(buf) + 4; + gss_release_buffer(&min, &rel_buf); + } +#endif +} + +/****************************************************************************** + Client side encryption. +******************************************************************************/ + +/****************************************************************************** + Is client encryption on ? +******************************************************************************/ + +bool cli_encryption_on(struct cli_state *cli) +{ + /* If we supported multiple encrytion contexts + * here we'd look up based on tid. + */ + return common_encryption_on(cli->trans_enc_state); +} + +/****************************************************************************** + Shutdown a client encryption state. +******************************************************************************/ + +void cli_free_encryption_context(struct cli_state *cli) +{ + common_free_encryption_state(&cli->trans_enc_state); +} + +/****************************************************************************** + Free an encryption-allocated buffer. +******************************************************************************/ + +void cli_free_enc_buffer(struct cli_state *cli, char *buf) +{ + /* We know this is an smb buffer, and we + * didn't malloc, only copy, for a keepalive, + * so ignore session keepalives. */ + + if(CVAL(buf,0) == SMBkeepalive) { + return; + } + + /* If we supported multiple encrytion contexts + * here we'd look up based on tid. + */ + common_free_enc_buffer(cli->trans_enc_state, buf); +} + +/****************************************************************************** + Decrypt an incoming buffer. +******************************************************************************/ + +NTSTATUS cli_decrypt_message(struct cli_state *cli) +{ + NTSTATUS status; + uint16 enc_ctx_num; + + /* Ignore session keepalives. */ + if(CVAL(cli->inbuf,0) == SMBkeepalive) { + return NT_STATUS_OK; + } + + status = get_enc_ctx_num(cli->inbuf, &enc_ctx_num); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (enc_ctx_num != cli->trans_enc_state->enc_ctx_num) { + return NT_STATUS_INVALID_HANDLE; + } + + return common_decrypt_buffer(cli->trans_enc_state, cli->inbuf); +} + +/****************************************************************************** + Encrypt an outgoing buffer. Return the encrypted pointer in buf_out. +******************************************************************************/ + +NTSTATUS cli_encrypt_message(struct cli_state *cli, char **buf_out) +{ + /* Ignore session keepalives. */ + if(CVAL(cli->outbuf,0) == SMBkeepalive) { + return NT_STATUS_OK; + } + + /* If we supported multiple encrytion contexts + * here we'd look up based on tid. + */ + return common_encrypt_buffer(cli->trans_enc_state, cli->outbuf, buf_out); +} diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 349d36ce70..3bb1514203 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1924,7 +1924,7 @@ bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len, return false; } - set_message(ptr,17,strlen(mailslot) + 1 + len,True); + cli_set_message(ptr,17,strlen(mailslot) + 1 + len,True); memcpy(ptr,tmp,4); SCVAL(ptr,smb_com,SMBtrans); diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 5b009fc964..7186d4f075 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -6209,7 +6209,7 @@ uint32 lp_get_spoolss_state( void ) } /******************************************************************* - Ensure we don't use sendfile if server smb signing is active. + Ensure we don't use sendfile if server smb signing or selaing is active. ********************************************************************/ bool lp_use_sendfile(int snum) @@ -6218,7 +6218,10 @@ bool lp_use_sendfile(int snum) if (Protocol < PROTOCOL_NT1) { return False; } - return (_lp_use_sendfile(snum) && (get_remote_arch() != RA_WIN95) && !srv_is_signing_active()); + return (_lp_use_sendfile(snum) && + (get_remote_arch() != RA_WIN95) && + !srv_is_signing_active() && + !srv_encryption_on()); } /******************************************************************* diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index 994b10d6a8..f13393b764 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -236,7 +236,7 @@ bool schedule_aio_read_and_X(connection_struct *conn, } construct_reply_common((char *)req->inbuf, aio_ex->outbuf); - set_message(aio_ex->outbuf, 12, 0, True); + srv_set_message((const char *)req->inbuf, aio_ex->outbuf, 12, 0, True); SCVAL(aio_ex->outbuf,smb_vwv0,0xFF); /* Never a chained reply. */ a = &aio_ex->acb; @@ -387,6 +387,7 @@ static int handle_aio_read_complete(struct aio_extra *aio_ex) int ret = 0; int outsize; char *outbuf = aio_ex->outbuf; + const char *inbuf = aio_ex->inbuf; char *data = smb_buf(outbuf); ssize_t nread = SMB_VFS_AIO_RETURN(aio_ex->fsp,&aio_ex->acb); @@ -407,10 +408,11 @@ static int handle_aio_read_complete(struct aio_extra *aio_ex) "Error = %s\n", aio_ex->fsp->fsp_name, strerror(errno) )); - outsize = (UNIXERROR(ERRDOS,ERRnoaccess)); ret = errno; + ERROR_NT(map_nt_error_from_unix(ret)); + outsize = srv_set_message(inbuf,outbuf,0,0,true); } else { - outsize = set_message(outbuf,12,nread,False); + outsize = srv_set_message(inbuf, outbuf,12,nread,False); SSVAL(outbuf,smb_vwv2,0xFFFF); /* Remaining - must be * -1. */ SSVAL(outbuf,smb_vwv5,nread); SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf)); @@ -423,7 +425,7 @@ static int handle_aio_read_complete(struct aio_extra *aio_ex) (int)aio_ex->acb.aio_nbytes, (int)nread ) ); } - smb_setlen(outbuf,outsize - 4); + _smb_setlen(outbuf,outsize - 4); show_msg(outbuf); if (!send_smb(smbd_server_fd(),outbuf)) { exit_server_cleanly("handle_aio_read_complete: send_smb " @@ -448,6 +450,7 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex) int ret = 0; files_struct *fsp = aio_ex->fsp; char *outbuf = aio_ex->outbuf; + const char *inbuf = aio_ex->inbuf; ssize_t numtowrite = aio_ex->acb.aio_nbytes; ssize_t nwritten = SMB_VFS_AIO_RETURN(fsp,&aio_ex->acb); @@ -492,8 +495,9 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex) return 0; } - UNIXERROR(ERRHRD,ERRdiskfull); ret = errno; + ERROR_BOTH(ERRHRD, ERRdiskfull, map_nt_error_from_unix(ret)); + srv_set_message(inbuf,outbuf,0,0,true); } else { bool write_through = BITSETW(aio_ex->inbuf+smb_vwv7,0); NTSTATUS status; @@ -509,8 +513,9 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex) fsp->fnum, (int)numtowrite, (int)nwritten)); status = sync_file(fsp->conn,fsp, write_through); if (!NT_STATUS_IS_OK(status)) { - UNIXERROR(ERRHRD,ERRdiskfull); ret = errno; + ERROR_BOTH(ERRHRD, ERRdiskfull, map_nt_error_from_unix(ret)); + srv_set_message(inbuf,outbuf,0,0,true); DEBUG(5,("handle_aio_write: sync_file for %s returned %s\n", fsp->fsp_name, nt_errstr(status) )); } diff --git a/source3/smbd/error.c b/source3/smbd/error.c index 12eff42023..c669e74146 100644 --- a/source3/smbd/error.c +++ b/source3/smbd/error.c @@ -24,34 +24,6 @@ extern struct unix_error_map unix_dos_nt_errmap[]; extern uint32 global_client_caps; -/**************************************************************************** - Create an error packet from errno. -****************************************************************************/ - -int unix_error_packet(char *outbuf,int def_class,uint32 def_code, NTSTATUS def_status, int line, const char *file) -{ - int eclass=def_class; - int ecode=def_code; - NTSTATUS ntstatus = def_status; - int i=0; - - if (errno != 0) { - DEBUG(3,("unix_error_packet: error string = %s\n",strerror(errno))); - - while (unix_dos_nt_errmap[i].dos_class != 0) { - if (unix_dos_nt_errmap[i].unix_error == errno) { - eclass = unix_dos_nt_errmap[i].dos_class; - ecode = unix_dos_nt_errmap[i].dos_code; - ntstatus = unix_dos_nt_errmap[i].nt_error; - break; - } - i++; - } - } - - return error_packet(outbuf,eclass,ecode,ntstatus,line,file); -} - bool use_nt_status(void) { return lp_nt_status_support() && (global_client_caps & CAP_STATUS32); @@ -109,9 +81,9 @@ void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatu } } -int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file) +int error_packet(const char *inbuf, char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file) { - int outsize = set_message(outbuf,0,0,True); + int outsize = srv_set_message(inbuf, outbuf,0,0,True); error_packet_set(outbuf, eclass, ecode, ntstatus, line, file); return outsize; } @@ -150,8 +122,24 @@ void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode, line, file); } +void reply_openerror(struct smb_request *req, NTSTATUS status) +{ + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { + /* + * We hit an existing file, and if we're returning DOS + * error codes OBJECT_NAME_COLLISION would map to + * ERRDOS/183, we need to return ERRDOS/80, see bug + * 4852. + */ + reply_botherror(req, NT_STATUS_OBJECT_NAME_COLLISION, + ERRDOS, ERRfilexists); + } else { + reply_nterror(req, status); + } +} + void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode, - NTSTATUS defstatus, int line, const char *file) + NTSTATUS defstatus, int line, const char *file) { int eclass=defclass; int ecode=defcode; @@ -163,7 +151,7 @@ void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode, if (errno != 0) { DEBUG(3,("unix_error_packet: error string = %s\n", - strerror(errno))); + strerror(errno))); while (unix_dos_nt_errmap[i].dos_class != 0) { if (unix_dos_nt_errmap[i].unix_error == errno) { @@ -177,22 +165,5 @@ void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode, } error_packet_set((char *)req->outbuf, eclass, ecode, ntstatus, - line, file); + line, file); } - -void reply_openerror(struct smb_request *req, NTSTATUS status) -{ - if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { - /* - * We hit an existing file, and if we're returning DOS - * error codes OBJECT_NAME_COLLISION would map to - * ERRDOS/183, we need to return ERRDOS/80, see bug - * 4852. - */ - reply_botherror(req, NT_STATUS_OBJECT_NAME_COLLISION, - ERRDOS, ERRfilexists); - } else { - reply_nterror(req, status); - } -} - diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 0dd7fbb20e..baab48f77e 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -131,6 +131,7 @@ static bool notify_marshall_changes(int num_changes, static void change_notify_reply_packet(const uint8 *request_buf, NTSTATUS error_code) { + const char *inbuf = (const char *)request_buf; char outbuf[smb_size+38]; memset(outbuf, '\0', sizeof(outbuf)); @@ -142,7 +143,7 @@ static void change_notify_reply_packet(const uint8 *request_buf, * Seems NT needs a transact command with an error code * in it. This is a longer packet than a simple error. */ - set_message(outbuf,18,0,False); + srv_set_message((const char *)request_buf, outbuf,18,0,False); show_msg(outbuf); if (!send_smb(smbd_server_fd(),outbuf)) diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 961abd277b..2c3313606a 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -252,7 +252,11 @@ static char *new_break_smb_message(TALLOC_CTX *mem_ctx, } memset(result,'\0',smb_size); - set_message(result,8,0,True); + /* We use cli_set_message here as this is an + * asynchronous message that doesn't belong in + * the stream. + */ + cli_set_message(result,8,0,True); SCVAL(result,smb_com,SMBlockingX); SSVAL(result,smb_tid,fsp->conn->cnum); SSVAL(result,smb_pid,0xFFFF); diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 0ddc00c767..88b67c03e5 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -291,7 +291,8 @@ void reply_pipe_read_and_X(struct smb_request *req) return; } - set_message((char *)req->outbuf, 12, nread, False); + srv_set_message((const char *)req->inbuf, + (char *)req->outbuf, 12, nread, False); SSVAL(req->outbuf,smb_vwv5,nread); SSVAL(req->outbuf,smb_vwv6,smb_offset(data,req->outbuf)); diff --git a/source3/smbd/process.c b/source3/smbd/process.c index ee76f90bf5..1260d52c77 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -50,6 +50,43 @@ enum smb_read_errors *get_srv_read_error(void) return &smb_read_error; } +/******************************************************************* + Setup the word count and byte count for a smb message. + copying the '0xFF X X X' bytes from incoming + buffer (so we copy any encryption context). +********************************************************************/ + +int srv_set_message(const char *frombuf, + char *buf, + int num_words, + int num_bytes, + bool zero) +{ + if (zero && (num_words || num_bytes)) { + memset(buf + smb_size,'\0',num_words*2 + num_bytes); + } + SCVAL(buf,smb_wct,num_words); + SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); + _smb_setlen(buf,(smb_size + num_words*2 + num_bytes - 4)); + if (buf != frombuf) { + memcpy(buf+4, frombuf+4, 4); + } + return (smb_size + num_words*2 + num_bytes); +} + +static bool valid_smb_header(const char *inbuf) +{ + if (srv_encryption_on()) { + uint16_t enc_num; + NTSTATUS status = get_enc_ctx_num(inbuf, &enc_num); + if (!NT_STATUS_IS_OK(status)) { + return false; + } + return (enc_num == 0); + } + return (strncmp(smb_base(inbuf),"\377SMB",4) == 0); +} + /* Socket functions for smbd packet processing. */ static bool valid_packet_size(size_t len) @@ -324,6 +361,18 @@ ssize_t receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd, char **buffer, return -1; } + if (srv_encryption_on()) { + NTSTATUS status = srv_decrypt_buffer(*buffer); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("receive_smb_talloc: SMB decryption failed on " + "incoming packet! Error %s\n", + nt_errstr(status) )); + cond_set_smb_read_error(get_srv_read_error(), + SMB_READ_BAD_DECRYPT); + return -1; + } + } + /* Check the incoming SMB signature. */ if (!srv_check_sign_mac(*buffer, true)) { DEBUG(0, ("receive_smb: SMB Signature verification failed on " @@ -1239,7 +1288,8 @@ void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes) } construct_reply_common((char *)req->inbuf, (char *)req->outbuf); - set_message((char *)req->outbuf, num_words, num_bytes, False); + srv_set_message((const char *)req->inbuf, + (char *)req->outbuf, num_words, num_bytes, false); /* * Zero out the word area, the caller has to take care of the bcc area * himself @@ -1309,7 +1359,7 @@ static void switch_message(uint8 type, struct smb_request *req, int size) /* Make sure this is an SMB packet. smb_size contains NetBIOS header * so subtract 4 from it. */ - if ((strncmp(smb_base(req->inbuf),"\377SMB",4) != 0) + if (!valid_smb_header((const char *)req->inbuf) || (size < (smb_size - 4))) { DEBUG(2,("Non-SMB packet of length %d. Terminating server\n", smb_len(req->inbuf))); @@ -1551,7 +1601,7 @@ void remove_from_common_flags2(uint32 v) void construct_reply_common(const char *inbuf, char *outbuf) { - set_message(outbuf,0,0,False); + srv_set_message(inbuf,outbuf,0,0,false); SCVAL(outbuf,smb_com,CVAL(inbuf,smb_com)); SIVAL(outbuf,smb_rcls,0); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 575ca13ff6..2707aee9c8 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2791,8 +2791,8 @@ void reply_readbraw(connection_struct *conn, struct smb_request *req) START_PROFILE(SMBreadbraw); - if (srv_is_signing_active()) { - exit_server_cleanly("reply_readbraw: SMB signing is active - " + if (srv_is_signing_active() || srv_encryption_on()) { + exit_server_cleanly("reply_readbraw: SMB signing/sealing is active - " "raw reads/writes are disallowed."); } @@ -3017,7 +3017,8 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", return; } - set_message((char *)req->outbuf, 5, nread+3, False); + srv_set_message((const char *)req->inbuf, + (char *)req->outbuf, 5, nread+3, False); SSVAL(req->outbuf,smb_vwv0,nread); SSVAL(req->outbuf,smb_vwv5,nread+3); @@ -3104,7 +3105,8 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", return; } - set_message((char *)req->outbuf, 5, nread+3, False); + srv_set_message((const char *)req->inbuf, + (char *)req->outbuf, 5, nread+3, False); SSVAL(req->outbuf,smb_vwv0,nread); SSVAL(req->outbuf,smb_vwv5,nread+3); @@ -3122,12 +3124,12 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", Setup readX header. ****************************************************************************/ -static int setup_readX_header(char *outbuf, size_t smb_maxcnt) +static int setup_readX_header(const char *inbuf, char *outbuf, size_t smb_maxcnt) { int outsize; char *data; - outsize = set_message(outbuf,12,smb_maxcnt,False); + outsize = srv_set_message(inbuf, outbuf,12,smb_maxcnt,False); data = smb_buf(outbuf); memset(outbuf+smb_vwv0,'\0',24); /* valgrind init. */ @@ -3190,7 +3192,8 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req, header = data_blob_const(headerbuf, sizeof(headerbuf)); construct_reply_common((char *)req->inbuf, (char *)headerbuf); - setup_readX_header((char *)headerbuf, smb_maxcnt); + setup_readX_header((const char *)req->inbuf, + (char *)headerbuf, smb_maxcnt); if ((nread = SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp->fh->fd, &header, startpos, smb_maxcnt)) == -1) { /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */ @@ -3241,7 +3244,8 @@ normal_read: uint8 headerbuf[smb_size + 2*12]; construct_reply_common((char *)req->inbuf, (char *)headerbuf); - setup_readX_header((char *)headerbuf, smb_maxcnt); + setup_readX_header((const char *)req->inbuf, + (char *)headerbuf, smb_maxcnt); /* Send out the header. */ if (write_data(smbd_server_fd(), (char *)headerbuf, @@ -3268,7 +3272,8 @@ normal_read: return; } - setup_readX_header((char *)req->outbuf, nread); + setup_readX_header((const char *)req->inbuf, + (char *)req->outbuf, nread); DEBUG( 3, ( "send_file_readX fnum=%d max=%d nread=%d\n", fsp->fnum, (int)smb_maxcnt, (int)nread ) ); @@ -3332,8 +3337,8 @@ void reply_read_and_X(connection_struct *conn, struct smb_request *req) END_PROFILE(SMBreadX); return; } - /* We currently don't do this on signed data. */ - if (srv_is_signing_active()) { + /* We currently don't do this on signed or sealed data. */ + if (srv_is_signing_active() || srv_encryption_on()) { reply_nterror(req, NT_STATUS_NOT_SUPPORTED); END_PROFILE(SMBreadX); return; @@ -3524,7 +3529,7 @@ void reply_writebraw(connection_struct *conn, struct smb_request *req) * it to send more bytes */ memcpy(buf, req->inbuf, smb_size); - outsize = set_message(buf, + outsize = srv_set_message((const char *)req->inbuf, buf, Protocol>PROTOCOL_COREPLUS?1:0,0,True); SCVAL(buf,smb_com,SMBwritebraw); SSVALS(buf,smb_vwv0,0xFFFF); @@ -3856,6 +3861,12 @@ bool is_valid_writeX_buffer(const char *inbuf) unsigned int doff = 0; size_t len = smb_len_large(inbuf); + if (srv_encryption_on()) { + /* Can't do this on encrypted + * connections. */ + return false; + } + if (CVAL(inbuf,smb_com) != SMBwriteX) { return false; } diff --git a/source3/smbd/seal.c b/source3/smbd/seal.c new file mode 100644 index 0000000000..14a427bb9c --- /dev/null +++ b/source3/smbd/seal.c @@ -0,0 +1,703 @@ +/* + Unix SMB/CIFS implementation. + SMB Transport encryption (sealing) code - server code. + Copyright (C) Jeremy Allison 2007. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "includes.h" + +/****************************************************************************** + Server side encryption. +******************************************************************************/ + +/****************************************************************************** + Global server state. +******************************************************************************/ + +struct smb_srv_trans_enc_ctx { + struct smb_trans_enc_state *es; + AUTH_NTLMSSP_STATE *auth_ntlmssp_state; /* Must be kept in sync with pointer in ec->ntlmssp_state. */ +}; + +static struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx; +static struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx; + +/****************************************************************************** + Is server encryption on ? +******************************************************************************/ + +bool srv_encryption_on(void) +{ + if (srv_trans_enc_ctx) { + return common_encryption_on(srv_trans_enc_ctx->es); + } + return false; +} + +/****************************************************************************** + Create an auth_ntlmssp_state and ensure pointer copy is correct. +******************************************************************************/ + +static NTSTATUS make_auth_ntlmssp(struct smb_srv_trans_enc_ctx *ec) +{ + NTSTATUS status = auth_ntlmssp_start(&ec->auth_ntlmssp_state); + if (!NT_STATUS_IS_OK(status)) { + return nt_status_squash(status); + } + + /* + * We must remember to update the pointer copy for the common + * functions after any auth_ntlmssp_start/auth_ntlmssp_end. + */ + ec->es->s.ntlmssp_state = ec->auth_ntlmssp_state->ntlmssp_state; + return status; +} + +/****************************************************************************** + Destroy an auth_ntlmssp_state and ensure pointer copy is correct. +******************************************************************************/ + +static void destroy_auth_ntlmssp(struct smb_srv_trans_enc_ctx *ec) +{ + /* + * We must remember to update the pointer copy for the common + * functions after any auth_ntlmssp_start/auth_ntlmssp_end. + */ + + if (ec->auth_ntlmssp_state) { + auth_ntlmssp_end(&ec->auth_ntlmssp_state); + /* The auth_ntlmssp_end killed this already. */ + ec->es->s.ntlmssp_state = NULL; + } +} + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + +/****************************************************************************** + Import a name. +******************************************************************************/ + +static NTSTATUS get_srv_gss_creds(const char *service, + const char *name, + gss_cred_usage_t cred_type, + gss_cred_id_t *p_srv_cred) +{ + OM_uint32 ret; + OM_uint32 min; + gss_name_t srv_name; + gss_buffer_desc input_name; + char *host_princ_s = NULL; + NTSTATUS status = NT_STATUS_OK; + + gss_OID_desc nt_hostbased_service = + {10, CONST_DISCARD(char *,"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04")}; + + asprintf(&host_princ_s, "%s@%s", service, name); + if (host_princ_s == NULL) { + return NT_STATUS_NO_MEMORY; + } + + input_name.value = host_princ_s; + input_name.length = strlen(host_princ_s) + 1; + + ret = gss_import_name(&min, + &input_name, + &nt_hostbased_service, + &srv_name); + + DEBUG(10,("get_srv_gss_creds: imported name %s\n", + host_princ_s )); + + if (ret != GSS_S_COMPLETE) { + SAFE_FREE(host_princ_s); + return map_nt_error_from_gss(ret, min); + } + + /* + * We're accessing the krb5.keytab file here. + * ensure we have permissions to do so. + */ + become_root(); + + ret = gss_acquire_cred(&min, + srv_name, + GSS_C_INDEFINITE, + GSS_C_NULL_OID_SET, + cred_type, + p_srv_cred, + NULL, + NULL); + unbecome_root(); + + if (ret != GSS_S_COMPLETE) { + ADS_STATUS adss = ADS_ERROR_GSS(ret, min); + DEBUG(10,("get_srv_gss_creds: gss_acquire_cred failed with %s\n", + ads_errstr(adss))); + status = map_nt_error_from_gss(ret, min); + } + + SAFE_FREE(host_princ_s); + gss_release_name(&min, &srv_name); + return status; +} + +/****************************************************************************** + Create a gss state. + Try and get the cifs/server@realm principal first, then fall back to + host/server@realm. +******************************************************************************/ + +static NTSTATUS make_auth_gss(struct smb_srv_trans_enc_ctx *ec) +{ + NTSTATUS status; + gss_cred_id_t srv_cred; + fstring fqdn; + + name_to_fqdn(fqdn, global_myname()); + strlower_m(fqdn); + + status = get_srv_gss_creds("cifs", fqdn, GSS_C_ACCEPT, &srv_cred); + if (!NT_STATUS_IS_OK(status)) { + status = get_srv_gss_creds("host", fqdn, GSS_C_ACCEPT, &srv_cred); + if (!NT_STATUS_IS_OK(status)) { + return nt_status_squash(status); + } + } + + ec->es->s.gss_state = SMB_MALLOC_P(struct smb_tran_enc_state_gss); + if (!ec->es->s.gss_state) { + OM_uint32 min; + gss_release_cred(&min, &srv_cred); + return NT_STATUS_NO_MEMORY; + } + ZERO_STRUCTP(ec->es->s.gss_state); + ec->es->s.gss_state->creds = srv_cred; + + /* No context yet. */ + ec->es->s.gss_state->gss_ctx = GSS_C_NO_CONTEXT; + + return NT_STATUS_OK; +} +#endif + +/****************************************************************************** + Shutdown a server encryption context. +******************************************************************************/ + +static void srv_free_encryption_context(struct smb_srv_trans_enc_ctx **pp_ec) +{ + struct smb_srv_trans_enc_ctx *ec = *pp_ec; + + if (!ec) { + return; + } + + if (ec->es) { + switch (ec->es->smb_enc_type) { + case SMB_TRANS_ENC_NTLM: + destroy_auth_ntlmssp(ec); + break; +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + case SMB_TRANS_ENC_GSS: + break; +#endif + } + common_free_encryption_state(&ec->es); + } + + SAFE_FREE(ec); + *pp_ec = NULL; +} + +/****************************************************************************** + Create a server encryption context. +******************************************************************************/ + +static NTSTATUS make_srv_encryption_context(enum smb_trans_enc_type smb_enc_type, struct smb_srv_trans_enc_ctx **pp_ec) +{ + struct smb_srv_trans_enc_ctx *ec; + + *pp_ec = NULL; + + ec = SMB_MALLOC_P(struct smb_srv_trans_enc_ctx); + if (!ec) { + return NT_STATUS_NO_MEMORY; + } + ZERO_STRUCTP(partial_srv_trans_enc_ctx); + ec->es = SMB_MALLOC_P(struct smb_trans_enc_state); + if (!ec->es) { + SAFE_FREE(ec); + return NT_STATUS_NO_MEMORY; + } + ZERO_STRUCTP(ec->es); + ec->es->smb_enc_type = smb_enc_type; + switch (smb_enc_type) { + case SMB_TRANS_ENC_NTLM: + { + NTSTATUS status = make_auth_ntlmssp(ec); + if (!NT_STATUS_IS_OK(status)) { + srv_free_encryption_context(&ec); + return status; + } + } + break; + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + case SMB_TRANS_ENC_GSS: + /* Acquire our credentials by calling gss_acquire_cred here. */ + { + NTSTATUS status = make_auth_gss(ec); + if (!NT_STATUS_IS_OK(status)) { + srv_free_encryption_context(&ec); + return status; + } + } + break; +#endif + default: + srv_free_encryption_context(&ec); + return NT_STATUS_INVALID_PARAMETER; + } + *pp_ec = ec; + return NT_STATUS_OK; +} + +/****************************************************************************** + Free an encryption-allocated buffer. +******************************************************************************/ + +void srv_free_enc_buffer(char *buf) +{ + /* We know this is an smb buffer, and we + * didn't malloc, only copy, for a keepalive, + * so ignore session keepalives. */ + + if(CVAL(buf,0) == SMBkeepalive) { + return; + } + + if (srv_trans_enc_ctx) { + common_free_enc_buffer(srv_trans_enc_ctx->es, buf); + } +} + +/****************************************************************************** + Decrypt an incoming buffer. +******************************************************************************/ + +NTSTATUS srv_decrypt_buffer(char *buf) +{ + /* Ignore session keepalives. */ + if(CVAL(buf,0) == SMBkeepalive) { + return NT_STATUS_OK; + } + + if (srv_trans_enc_ctx) { + return common_decrypt_buffer(srv_trans_enc_ctx->es, buf); + } + + return NT_STATUS_OK; +} + +/****************************************************************************** + Encrypt an outgoing buffer. Return the encrypted pointer in buf_out. +******************************************************************************/ + +NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out) +{ + *buf_out = buf; + + /* Ignore session keepalives. */ + if(CVAL(buf,0) == SMBkeepalive) { + return NT_STATUS_OK; + } + + if (srv_trans_enc_ctx) { + return common_encrypt_buffer(srv_trans_enc_ctx->es, buf, buf_out); + } + /* Not encrypting. */ + return NT_STATUS_OK; +} + +/****************************************************************************** + Do the gss encryption negotiation. Parameters are in/out. + Until success we do everything on the partial enc ctx. +******************************************************************************/ + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) +static NTSTATUS srv_enc_spnego_gss_negotiate(unsigned char **ppdata, size_t *p_data_size, DATA_BLOB secblob) +{ + OM_uint32 ret; + OM_uint32 min; + OM_uint32 flags = 0; + gss_buffer_desc in_buf, out_buf; + struct smb_tran_enc_state_gss *gss_state; + DATA_BLOB auth_reply = data_blob_null; + DATA_BLOB response = data_blob_null; + NTSTATUS status; + + if (!partial_srv_trans_enc_ctx) { + status = make_srv_encryption_context(SMB_TRANS_ENC_GSS, &partial_srv_trans_enc_ctx); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + } + + gss_state = partial_srv_trans_enc_ctx->es->s.gss_state; + + in_buf.value = secblob.data; + in_buf.length = secblob.length; + + out_buf.value = NULL; + out_buf.length = 0; + + become_root(); + + ret = gss_accept_sec_context(&min, + &gss_state->gss_ctx, + gss_state->creds, + &in_buf, + GSS_C_NO_CHANNEL_BINDINGS, + NULL, + NULL, /* Ignore oids. */ + &out_buf, /* To return. */ + &flags, + NULL, /* Ingore time. */ + NULL); /* Ignore delegated creds. */ + unbecome_root(); + + status = gss_err_to_ntstatus(ret, min); + if (ret != GSS_S_COMPLETE && ret != GSS_S_CONTINUE_NEEDED) { + return status; + } + + /* Ensure we've got sign+seal available. */ + if (ret == GSS_S_COMPLETE) { + if ((flags & (GSS_C_INTEG_FLAG|GSS_C_CONF_FLAG|GSS_C_REPLAY_FLAG|GSS_C_SEQUENCE_FLAG)) != + (GSS_C_INTEG_FLAG|GSS_C_CONF_FLAG|GSS_C_REPLAY_FLAG|GSS_C_SEQUENCE_FLAG)) { + DEBUG(0,("srv_enc_spnego_gss_negotiate: quality of service not good enough " + "for SMB sealing.\n")); + gss_release_buffer(&min, &out_buf); + return NT_STATUS_ACCESS_DENIED; + } + } + + auth_reply = data_blob(out_buf.value, out_buf.length); + gss_release_buffer(&min, &out_buf); + + /* Wrap in SPNEGO. */ + response = spnego_gen_auth_response(&auth_reply, status, OID_KERBEROS5); + data_blob_free(&auth_reply); + + SAFE_FREE(*ppdata); + *ppdata = response.data; + *p_data_size = response.length; + + return status; +} +#endif + +/****************************************************************************** + Do the NTLM SPNEGO (or raw) encryption negotiation. Parameters are in/out. + Until success we do everything on the partial enc ctx. +******************************************************************************/ + +static NTSTATUS srv_enc_ntlm_negotiate(unsigned char **ppdata, size_t *p_data_size, DATA_BLOB secblob, bool spnego_wrap) +{ + NTSTATUS status; + DATA_BLOB chal = data_blob_null; + DATA_BLOB response = data_blob_null; + + status = make_srv_encryption_context(SMB_TRANS_ENC_NTLM, &partial_srv_trans_enc_ctx); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + status = auth_ntlmssp_update(partial_srv_trans_enc_ctx->auth_ntlmssp_state, secblob, &chal); + + /* status here should be NT_STATUS_MORE_PROCESSING_REQUIRED + * for success ... */ + + if (spnego_wrap) { + response = spnego_gen_auth_response(&chal, status, OID_NTLMSSP); + data_blob_free(&chal); + } else { + /* Return the raw blob. */ + response = chal; + } + + SAFE_FREE(*ppdata); + *ppdata = response.data; + *p_data_size = response.length; + return status; +} + +/****************************************************************************** + Do the SPNEGO encryption negotiation. Parameters are in/out. + Based off code in smbd/sesssionsetup.c + Until success we do everything on the partial enc ctx. +******************************************************************************/ + +static NTSTATUS srv_enc_spnego_negotiate(connection_struct *conn, + unsigned char **ppdata, + size_t *p_data_size, + unsigned char **pparam, + size_t *p_param_size) +{ + NTSTATUS status; + DATA_BLOB blob = data_blob_null; + DATA_BLOB secblob = data_blob_null; + bool got_kerberos_mechanism = false; + + blob = data_blob_const(*ppdata, *p_data_size); + + status = parse_spnego_mechanisms(blob, &secblob, &got_kerberos_mechanism); + if (!NT_STATUS_IS_OK(status)) { + return nt_status_squash(status); + } + + /* We should have no partial context at this point. */ + + srv_free_encryption_context(&partial_srv_trans_enc_ctx); + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + if (got_kerberos_mechanism && lp_use_kerberos_keytab() ) { + status = srv_enc_spnego_gss_negotiate(ppdata, p_data_size, secblob); + } else +#endif + { + status = srv_enc_ntlm_negotiate(ppdata, p_data_size, secblob, true); + } + + data_blob_free(&secblob); + + if (!NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED) && !NT_STATUS_IS_OK(status)) { + srv_free_encryption_context(&partial_srv_trans_enc_ctx); + return nt_status_squash(status); + } + + if (NT_STATUS_IS_OK(status)) { + /* Return the context we're using for this encryption state. */ + if (!(*pparam = SMB_MALLOC_ARRAY(unsigned char, 2))) { + return NT_STATUS_NO_MEMORY; + } + SSVAL(*pparam,0,partial_srv_trans_enc_ctx->es->enc_ctx_num); + *p_param_size = 2; + } + + return status; +} + +/****************************************************************************** + Complete a SPNEGO encryption negotiation. Parameters are in/out. + We only get this for a NTLM auth second stage. +******************************************************************************/ + +static NTSTATUS srv_enc_spnego_ntlm_auth(connection_struct *conn, + unsigned char **ppdata, + size_t *p_data_size, + unsigned char **pparam, + size_t *p_param_size) +{ + NTSTATUS status; + DATA_BLOB blob = data_blob_null; + DATA_BLOB auth = data_blob_null; + DATA_BLOB auth_reply = data_blob_null; + DATA_BLOB response = data_blob_null; + struct smb_srv_trans_enc_ctx *ec = partial_srv_trans_enc_ctx; + + /* We must have a partial context here. */ + + if (!ec || !ec->es || ec->auth_ntlmssp_state == NULL || ec->es->smb_enc_type != SMB_TRANS_ENC_NTLM) { + srv_free_encryption_context(&partial_srv_trans_enc_ctx); + return NT_STATUS_INVALID_PARAMETER; + } + + blob = data_blob_const(*ppdata, *p_data_size); + if (!spnego_parse_auth(blob, &auth)) { + srv_free_encryption_context(&partial_srv_trans_enc_ctx); + return NT_STATUS_INVALID_PARAMETER; + } + + status = auth_ntlmssp_update(ec->auth_ntlmssp_state, auth, &auth_reply); + data_blob_free(&auth); + + response = spnego_gen_auth_response(&auth_reply, status, OID_NTLMSSP); + data_blob_free(&auth_reply); + + if (NT_STATUS_IS_OK(status)) { + /* Return the context we're using for this encryption state. */ + if (!(*pparam = SMB_MALLOC_ARRAY(unsigned char, 2))) { + return NT_STATUS_NO_MEMORY; + } + SSVAL(*pparam,0,ec->es->enc_ctx_num); + *p_param_size = 2; + } + + SAFE_FREE(*ppdata); + *ppdata = response.data; + *p_data_size = response.length; + return status; +} + +/****************************************************************************** + Raw NTLM encryption negotiation. Parameters are in/out. + This function does both steps. +******************************************************************************/ + +static NTSTATUS srv_enc_raw_ntlm_auth(connection_struct *conn, + unsigned char **ppdata, + size_t *p_data_size, + unsigned char **pparam, + size_t *p_param_size) +{ + NTSTATUS status; + DATA_BLOB blob = data_blob_const(*ppdata, *p_data_size); + DATA_BLOB response = data_blob_null; + struct smb_srv_trans_enc_ctx *ec; + + if (!partial_srv_trans_enc_ctx) { + /* This is the initial step. */ + status = srv_enc_ntlm_negotiate(ppdata, p_data_size, blob, false); + if (!NT_STATUS_EQUAL(status,NT_STATUS_MORE_PROCESSING_REQUIRED) && !NT_STATUS_IS_OK(status)) { + srv_free_encryption_context(&partial_srv_trans_enc_ctx); + return nt_status_squash(status); + } + return status; + } + + ec = partial_srv_trans_enc_ctx; + if (!ec || !ec->es || ec->auth_ntlmssp_state == NULL || ec->es->smb_enc_type != SMB_TRANS_ENC_NTLM) { + srv_free_encryption_context(&partial_srv_trans_enc_ctx); + return NT_STATUS_INVALID_PARAMETER; + } + + /* Second step. */ + status = auth_ntlmssp_update(partial_srv_trans_enc_ctx->auth_ntlmssp_state, blob, &response); + + if (NT_STATUS_IS_OK(status)) { + /* Return the context we're using for this encryption state. */ + if (!(*pparam = SMB_MALLOC_ARRAY(unsigned char, 2))) { + return NT_STATUS_NO_MEMORY; + } + SSVAL(*pparam,0,ec->es->enc_ctx_num); + *p_param_size = 2; + } + + /* Return the raw blob. */ + SAFE_FREE(*ppdata); + *ppdata = response.data; + *p_data_size = response.length; + return status; +} + +/****************************************************************************** + Do the SPNEGO encryption negotiation. Parameters are in/out. +******************************************************************************/ + +NTSTATUS srv_request_encryption_setup(connection_struct *conn, + unsigned char **ppdata, + size_t *p_data_size, + unsigned char **pparam, + size_t *p_param_size) +{ + unsigned char *pdata = *ppdata; + + SAFE_FREE(*pparam); + *p_param_size = 0; + + if (*p_data_size < 1) { + return NT_STATUS_INVALID_PARAMETER; + } + + if (pdata[0] == ASN1_APPLICATION(0)) { + /* its a negTokenTarg packet */ + return srv_enc_spnego_negotiate(conn, ppdata, p_data_size, pparam, p_param_size); + } + + if (pdata[0] == ASN1_CONTEXT(1)) { + /* It's an auth packet */ + return srv_enc_spnego_ntlm_auth(conn, ppdata, p_data_size, pparam, p_param_size); + } + + /* Maybe it's a raw unwrapped auth ? */ + if (*p_data_size < 7) { + return NT_STATUS_INVALID_PARAMETER; + } + + if (strncmp((char *)pdata, "NTLMSSP", 7) == 0) { + return srv_enc_raw_ntlm_auth(conn, ppdata, p_data_size, pparam, p_param_size); + } + + DEBUG(1,("srv_request_encryption_setup: Unknown packet\n")); + + return NT_STATUS_LOGON_FAILURE; +} + +/****************************************************************************** + Negotiation was successful - turn on server-side encryption. +******************************************************************************/ + +static NTSTATUS check_enc_good(struct smb_srv_trans_enc_ctx *ec) +{ + if (!ec || !ec->es) { + return NT_STATUS_LOGON_FAILURE; + } + + if (ec->es->smb_enc_type == SMB_TRANS_ENC_NTLM) { + if ((ec->es->s.ntlmssp_state->neg_flags & (NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL)) != + (NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL)) { + return NT_STATUS_INVALID_PARAMETER; + } + } + /* Todo - check gssapi case. */ + + return NT_STATUS_OK; +} + +/****************************************************************************** + Negotiation was successful - turn on server-side encryption. +******************************************************************************/ + +NTSTATUS srv_encryption_start(connection_struct *conn) +{ + NTSTATUS status; + + /* Check that we are really doing sign+seal. */ + status = check_enc_good(partial_srv_trans_enc_ctx); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + /* Throw away the context we're using currently (if any). */ + srv_free_encryption_context(&srv_trans_enc_ctx); + + /* Steal the partial pointer. Deliberate shallow copy. */ + srv_trans_enc_ctx = partial_srv_trans_enc_ctx; + srv_trans_enc_ctx->es->enc_on = true; + + partial_srv_trans_enc_ctx = NULL; + return NT_STATUS_OK; +} + +/****************************************************************************** + Shutdown all server contexts. +******************************************************************************/ + +void server_encryption_shutdown(void) +{ + srv_free_encryption_context(&partial_srv_trans_enc_ctx); + srv_free_encryption_context(&srv_trans_enc_ctx); +} diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index e37f6ffbfd..0e34284443 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2998,6 +2998,55 @@ cap_low = 0x%x, cap_high = 0x%x\n", } break; } + + case SMB_REQUEST_TRANSPORT_ENCRYPTION: + { + NTSTATUS status; + size_t param_len = 0; + size_t data_len = total_data; + + if (!lp_unix_extensions()) { + reply_nterror( + req, + NT_STATUS_INVALID_LEVEL); + return; + } + + DEBUG( 4,("call_trans2setfsinfo: " + "request transport encrption.\n")); + + status = srv_request_encryption_setup(conn, + (unsigned char **)ppdata, + &data_len, + (unsigned char **)pparams, + ¶m_len); + + if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) && + !NT_STATUS_IS_OK(status)) { + reply_nterror(req, status); + return; + } + + send_trans2_replies(req, + *pparams, + param_len, + *ppdata, + data_len, + max_data_bytes); + + if (NT_STATUS_IS_OK(status)) { + /* Server-side transport + * encryption is now *on*. */ + status = srv_encryption_start(conn); + if (!NT_STATUS_IS_OK(status)) { + exit_server_cleanly( + "Failure in setting " + "up encrypted transport"); + } + } + return; + } + case SMB_FS_QUOTA_INFORMATION: { files_struct *fsp = NULL; -- cgit From 3a52874815b2b58f361ef4eb104f0bebd0cdb6ae Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 26 Dec 2007 17:17:36 -0800 Subject: Encryption works better when you add the client decrypt code :-). Jeremy. (This used to be commit d67b2634068be9c69082a2b8c22c831aba371cd9) --- source3/libsmb/clientgen.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index da225ebc24..ecef293d07 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -86,6 +86,17 @@ static ssize_t client_receive_smb(struct cli_state *cli, size_t maxlen) break; } } + + if (cli_encryption_on(cli)) { + NTSTATUS status = cli_decrypt_message(cli); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("SMB decryption failed on incoming packet! Error %s\n", + nt_errstr(status))); + cli->smb_rw_error = SMB_READ_BAD_DECRYPT; + return -1; + } + } + show_msg(cli->inbuf); return len; } -- cgit From 5413ad4aca69245c575b621db33b61eae5db4a35 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 27 Dec 2007 10:18:22 -0800 Subject: Add CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP capability to our reported caps. Jeremy. (This used to be commit e86d027823c85173c64e7b85406e98f6f7345b10) --- source3/include/trans2.h | 3 ++- source3/smbd/trans2.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source3/include/trans2.h b/source3/include/trans2.h index 8ed075d418..3759d59681 100644 --- a/source3/include/trans2.h +++ b/source3/include/trans2.h @@ -530,7 +530,8 @@ findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2. #define CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP 0x20 /* We can cope with POSIX open/mkdir/unlink etc. */ #define CIFS_UNIX_LARGE_READ_CAP 0x40 /* We can cope with 24 bit reads in readX. */ #define CIFS_UNIX_LARGE_WRITE_CAP 0x80 /* We can cope with 24 bit writes in writeX. */ - +#define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP 0x100 /* We can do SPNEGO negotiations for encryption. */ +#define CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP 0x200 /* We *must* SPNEGO negotiations for encryption. */ #define SMB_QUERY_POSIX_FS_INFO 0x201 diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 0e34284443..5a8fe41d27 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2737,7 +2737,10 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned data_len = 12; SSVAL(pdata,0,CIFS_UNIX_MAJOR_VERSION); SSVAL(pdata,2,CIFS_UNIX_MINOR_VERSION); - /* We have POSIX ACLs, pathname and locking capability. */ + + /* We have POSIX ACLs, pathname, encryption, + * large read/write, and locking capability. */ + SBIG_UINT(pdata,4,((SMB_BIG_UINT)( CIFS_UNIX_POSIX_ACLS_CAP| CIFS_UNIX_POSIX_PATHNAMES_CAP| @@ -2745,6 +2748,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned CIFS_UNIX_EXTATTR_CAP| CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP| CIFS_UNIX_LARGE_READ_CAP| + CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP| (large_write ? CIFS_UNIX_LARGE_WRITE_CAP : 0)))); break; -- cgit From ee8212472d29a5a23011d0331ad693494dcd1034 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Dec 2007 17:41:19 +0100 Subject: Wrap the DEBUG checks in a "unlikely" On my Laptop with some limited netbench runs this gains about 1.5% of performance. When looking at the assembler output I would suspect the biggest gain is by the fact that with this in place the calls to the debug functions is moved to the function end, out of the way of the normal code paths. valgrind tests pending I would suspect this to be much more cache friendly. Comments? Volker (This used to be commit 51448a9dca95de9d35dd8eea68fde2554cb69921) --- source3/include/debug.h | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/source3/include/debug.h b/source3/include/debug.h index 46e5620cc7..41d1c82366 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -161,9 +161,24 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; * will remove the extra conditional test. */ +/* + * From talloc.c: + */ + +/* these macros gain us a few percent of speed on gcc */ +#if (__GNUC__ >= 3) +/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 + as its first argument */ +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define likely(x) x +#define unlikely(x) x +#endif + #define DEBUGLVL( level ) \ ( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) @@ -171,7 +186,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define DEBUGLVLC( dbgc_class, level ) \ ( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) @@ -179,7 +194,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define DEBUG( level, body ) \ (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ @@ -187,7 +202,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define DEBUGC( dbgc_class, level, body ) \ (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ @@ -195,14 +210,14 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define DEBUGADD( level, body ) \ (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbgtext body) ) #define DEBUGADDC( dbgc_class, level, body ) \ (void)( ((level) <= MAX_DEBUG_LEVEL) && \ - ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && (dbgtext body) ) -- cgit From bd7fc51f2d26ba238b68db83106883bfa1fe1d7b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Dec 2007 19:56:44 +0100 Subject: Fix the build (This used to be commit 7fb858b350856d626fed6f062029fcf09b8251e2) --- source3/smbd/aio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index f13393b764..a439c3a4f0 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -496,7 +496,7 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex) } ret = errno; - ERROR_BOTH(ERRHRD, ERRdiskfull, map_nt_error_from_unix(ret)); + ERROR_BOTH(map_nt_error_from_unix(ret), ERRHRD, ERRdiskfull); srv_set_message(inbuf,outbuf,0,0,true); } else { bool write_through = BITSETW(aio_ex->inbuf+smb_vwv7,0); @@ -514,7 +514,8 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex) status = sync_file(fsp->conn,fsp, write_through); if (!NT_STATUS_IS_OK(status)) { ret = errno; - ERROR_BOTH(ERRHRD, ERRdiskfull, map_nt_error_from_unix(ret)); + ERROR_BOTH(map_nt_error_from_unix(ret), + ERRHRD, ERRdiskfull); srv_set_message(inbuf,outbuf,0,0,true); DEBUG(5,("handle_aio_write: sync_file for %s returned %s\n", fsp->fsp_name, nt_errstr(status) )); -- cgit From e9b8eb14468c37e772476f6d32188d6e85c2083c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Dec 2007 21:30:15 +0100 Subject: Remove a silly static (This used to be commit ef75dcc9ffda85d77c8f22d0db702efbf8e642ed) --- source3/rpc_server/srv_srvsvc_nt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 3cc2472116..842a28c776 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -870,13 +870,11 @@ static void init_srv_sess_info_0(pipes_struct *p, SRV_SESS_INFO_0 *ss0, uint32 * /******************************************************************* ********************************************************************/ -/* global needed to make use of the share_mode_forall() callback */ -static struct sess_file_count s_file_cnt; - static void sess_file_fn( const struct share_mode_entry *e, - const char *sharepath, const char *fname, void *state ) + const char *sharepath, const char *fname, + void *data ) { - struct sess_file_count *sess = &s_file_cnt; + struct sess_file_count *sess = (struct sess_file_count *)data; if ( procid_equal(&e->pid, &sess->pid) && (sess->uid == e->uid) ) { sess->count++; @@ -890,11 +888,13 @@ static void sess_file_fn( const struct share_mode_entry *e, static int net_count_files( uid_t uid, struct server_id pid ) { + struct sess_file_count s_file_cnt; + s_file_cnt.count = 0; s_file_cnt.uid = uid; s_file_cnt.pid = pid; - share_mode_forall( sess_file_fn, NULL ); + share_mode_forall( sess_file_fn, &s_file_cnt ); return s_file_cnt.count; } -- cgit From 94ee39c23f6e4a8c31701240795c288299d6bb08 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 00:12:14 +0100 Subject: Fix the non-gcc branch of "likely" (This used to be commit 1e07368b5f96e4ada622682e38d260eb0c6185f2) --- source3/include/debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/include/debug.h b/source3/include/debug.h index 41d1c82366..284671c730 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -172,8 +172,8 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else -#define likely(x) x -#define unlikely(x) x +#define likely(x) (x) +#define unlikely(x) (x) #endif #define DEBUGLVL( level ) \ -- cgit From 675f41dc144fc0c150b44d931a9242f1ac1ebe5f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 27 Dec 2007 16:54:07 -0800 Subject: Add "smb encrypt" parameter. Can be set to "no, yes, required". Currently if set required this is not enforced. I'll be adding that soon. Jeremy. (This used to be commit df7e447623ac03d81bec384f5cfe83c3976cf7b2) --- source3/param/loadparm.c | 4 ++++ source3/smbd/trans2.c | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 7186d4f075..16e9372009 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -472,6 +472,7 @@ typedef struct { int iAioWriteSize; int iMap_readonly; int iDirectoryNameCacheSize; + int ismb_encrypt; param_opt_struct *param_opt; char dummy[3]; /* for alignment */ @@ -617,6 +618,7 @@ static service sDefault = { #else 100, /* iDirectoryNameCacheSize */ #endif + Auto, /* ismb_encrypt */ NULL, /* Parametric options */ "" /* dummy */ @@ -1027,6 +1029,7 @@ static struct parm_struct parm_table[] = { {"use spnego", P_BOOL, P_GLOBAL, &Globals.bUseSpnego, NULL, NULL, FLAG_ADVANCED}, {"client signing", P_ENUM, P_GLOBAL, &Globals.client_signing, NULL, enum_smb_signing_vals, FLAG_ADVANCED}, {"server signing", P_ENUM, P_GLOBAL, &Globals.server_signing, NULL, enum_smb_signing_vals, FLAG_ADVANCED}, + {"smb encrypt", P_ENUM, P_LOCAL, &sDefault.ismb_encrypt, NULL, enum_smb_signing_vals, FLAG_ADVANCED}, {"client use spnego", P_BOOL, P_GLOBAL, &Globals.bClientUseSpnego, NULL, NULL, FLAG_ADVANCED}, {"client ldap sasl wrapping", P_ENUM, P_GLOBAL, &Globals.client_ldap_sasl_wrapping, NULL, enum_ldap_sasl_wrapping, FLAG_ADVANCED}, {"enable asu support", P_BOOL, P_GLOBAL, &Globals.bASUSupport, NULL, NULL, FLAG_ADVANCED}, @@ -2173,6 +2176,7 @@ FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize) FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize) FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly) FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize) +FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt) FN_LOCAL_CHAR(lp_magicchar, magic_char) FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time) FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 5a8fe41d27..ee4787199e 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2729,11 +2729,27 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned { bool large_write = lp_min_receive_file_size() && !srv_is_signing_active(); + int encrypt_caps = 0; if (!lp_unix_extensions()) { reply_nterror(req, NT_STATUS_INVALID_LEVEL); return; } + + switch (lp_smb_encrypt(SNUM(conn))) { + case 0: + encrypt_caps = 0; + break; + case 1: + case Auto: + encrypt_caps = CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP; + break; + case Required: + encrypt_caps = CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP| + CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP; + break; + } + data_len = 12; SSVAL(pdata,0,CIFS_UNIX_MAJOR_VERSION); SSVAL(pdata,2,CIFS_UNIX_MINOR_VERSION); @@ -2748,7 +2764,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned CIFS_UNIX_EXTATTR_CAP| CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP| CIFS_UNIX_LARGE_READ_CAP| - CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP| + encrypt_caps| (large_write ? CIFS_UNIX_LARGE_WRITE_CAP : 0)))); break; @@ -3016,6 +3032,13 @@ cap_low = 0x%x, cap_high = 0x%x\n", return; } + if (lp_smb_encrypt(SNUM(conn)) == false) { + reply_nterror( + req, + NT_STATUS_NOT_SUPPORTED); + return; + } + DEBUG( 4,("call_trans2setfsinfo: " "request transport encrption.\n")); -- cgit From 33f01360e0a40f6d1fa03035979d816ff9198d85 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Dec 2007 21:31:08 +0100 Subject: Fix setting the initial permission bits This fixes a make test failure on Solaris. When creating a new file, file_set_dosmode() called from open_file_ntcreate calculates a new permission mask, very likely different from what had been calculated in open_file_ntcreate. Further down we overwrote the newly calculated value with SMB_FCHMOD_ACL, ignoring what file_set_dosmode had calculated. Why did Linux not see this? fchmod_acl on a newly created file without acls would not retrieve an acl at all, whereas under Solaris acl(2) returns something even for files with just posix permissions returns something. Jeremy, given that we have very similar code in 3.0.28 this might also explain some of the bug reports that people have concerning ACLs on new files. Volker P.S: This one took a while to find... (This used to be commit 2135dfe91bf1ae114a18c15286b535662200677d) --- source3/smbd/dosmode.c | 18 ++++++++++++++++-- source3/smbd/open.c | 13 +++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 8e3c9b4c91..a96f80ee0e 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -438,12 +438,19 @@ int file_set_dosmode(connection_struct *conn, const char *fname, dosmode &= SAMBA_ATTRIBUTES_MASK; DEBUG(10,("file_set_dosmode: setting dos mode 0x%x on file %s\n", dosmode, fname)); - if (!st || (st && !VALID_STAT(*st))) { + + if (st == NULL) { + SET_STAT_INVALID(st1); st = &st1; + } + + if (!VALID_STAT(*st)) { if (SMB_VFS_STAT(conn,fname,st)) return(-1); } + unixmode = st->st_mode; + get_acl_group_bits(conn, fname, &st->st_mode); if (S_ISDIR(st->st_mode)) @@ -451,8 +458,10 @@ int file_set_dosmode(connection_struct *conn, const char *fname, else dosmode &= ~aDIR; - if (dos_mode(conn,fname,st) == dosmode) + if (dos_mode(conn,fname,st) == dosmode) { + st->st_mode = unixmode; return(0); + } /* Store the DOS attributes in an EA by preference. */ if (set_ea_dos_attribute(conn, fname, st, dosmode)) { @@ -460,6 +469,7 @@ int file_set_dosmode(connection_struct *conn, const char *fname, notify_fname(conn, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_ATTRIBUTES, fname); } + st->st_mode = unixmode; return 0; } @@ -500,6 +510,7 @@ int file_set_dosmode(connection_struct *conn, const char *fname, notify_fname(conn, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_ATTRIBUTES, fname); } + st->st_mode = unixmode; return 0; } @@ -534,6 +545,9 @@ int file_set_dosmode(connection_struct *conn, const char *fname, notify_fname(conn, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_ATTRIBUTES, fname); } + if (ret == 0) { + st->st_mode = unixmode; + } } return( ret ); diff --git a/source3/smbd/open.c b/source3/smbd/open.c index f30808b30a..d3ba9e076c 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1864,10 +1864,15 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, if (lp_map_archive(SNUM(conn)) || lp_store_dos_attributes(SNUM(conn))) { if (!posix_open) { - file_set_dosmode(conn, fname, - new_dos_attributes | aARCH, NULL, - parent_dir, - true); + SMB_STRUCT_STAT tmp_sbuf; + SET_STAT_INVALID(tmp_sbuf); + if (file_set_dosmode( + conn, fname, + new_dos_attributes | aARCH, + &tmp_sbuf, parent_dir, + true) == 0) { + unx_mode = tmp_sbuf.st_mode; + } } } } -- cgit From afce2b245a8ff137a4ecea547c3cfb65ab58dc15 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 27 Dec 2007 23:51:03 -0800 Subject: Add the capability to set "smb encrypt = required" on a share (or global) and have the server reply with ACCESS_DENIED for all non-encrypted traffic (except that used to query encryption requirements and set encryption state). Jeremy. (This used to be commit d241bfa57729bb934ada6beabf842a2ca7b4f8a2) --- source3/client/client.c | 17 +++++++++++++++-- source3/include/smb.h | 1 + source3/smbd/process.c | 10 ++++++++++ source3/smbd/service.c | 2 ++ source3/smbd/trans2.c | 33 ++++++++++++++++++++++++++++++++- 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 665a051190..53669bc8d0 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -2466,17 +2466,30 @@ static int cmd_posix(void) return 1; } } + if (caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP) { + caps = talloc_asprintf_append(caps, "posix_encrypt "); + if (!caps) { + return 1; + } + } + if (caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP) { + caps = talloc_asprintf_append(caps, "mandatory_posix_encrypt "); + if (!caps) { + return 1; + } + } if (*caps && caps[strlen(caps)-1] == ' ') { caps[strlen(caps)-1] = '\0'; } + + d_printf("Server supports CIFS capabilities %s\n", caps); + if (!cli_set_unix_extensions_capabilities(cli, major, minor, caplow, caphigh)) { d_printf("Can't set UNIX CIFS extensions capabilities. %s.\n", cli_errstr(cli)); return 1; } - d_printf("Selecting server supported CIFS capabilities %s\n", caps); - if (caplow & CIFS_UNIX_POSIX_PATHNAMES_CAP) { CLI_DIRSEP_CHAR = '/'; *CLI_DIRSEP_STR = '/'; diff --git a/source3/include/smb.h b/source3/include/smb.h index 2ffd530fb0..aca0009688 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -658,6 +658,7 @@ typedef struct connection_struct { bool used; int num_files_open; unsigned int num_smb_operations; /* Count of smb operations on this tree. */ + int encrypt_level; /* Semantics requested by the client or forced by the server config. */ bool case_sensitive; diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 1260d52c77..48a6d18bc9 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1457,6 +1457,16 @@ static void switch_message(uint8 type, struct smb_request *req, int size) reply_doserror(req, ERRSRV, ERRaccess); return; } + + if (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF ) { + /* An encrypted packet has 0xFF 'E' at offset 4 + * which is little endian 0x45FF */ + uint8 com = CVAL(req->inbuf,smb_com); + if (com != SMBtrans2 && com != SMBtranss2) { + reply_nterror(req, NT_STATUS_ACCESS_DENIED); + return; + } + } conn->num_smb_operations++; } diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 8e69a3b381..65fc818144 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -795,6 +795,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, conn->case_preserve = lp_preservecase(snum); conn->short_case_preserve = lp_shortpreservecase(snum); + conn->encrypt_level = lp_smb_encrypt(snum); + conn->veto_list = NULL; conn->hide_list = NULL; conn->veto_oplock_list = NULL; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index ee4787199e..7625eaed7d 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2430,6 +2430,16 @@ static void call_trans2qfsinfo(connection_struct *conn, info_level = SVAL(params,0); + if (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF ) { + if (info_level != SMB_QUERY_CIFS_UNIX_INFO) { + DEBUG(0,("call_trans2qfsinfo: encryption required " + "and info level 0x%x sent.\n", + (unsigned int)info_level)); + reply_nterror(req, NT_STATUS_ACCESS_DENIED); + return; + } + } + DEBUG(3,("call_trans2qfsinfo: level = %d\n", info_level)); if(SMB_VFS_STAT(conn,".",&st)!=0) { @@ -2736,7 +2746,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned return; } - switch (lp_smb_encrypt(SNUM(conn))) { + switch (conn->encrypt_level) { case 0: encrypt_caps = 0; break; @@ -2968,6 +2978,16 @@ static void call_trans2setfsinfo(connection_struct *conn, info_level = SVAL(params,2); + if (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF ) { + if (info_level != SMB_REQUEST_TRANSPORT_ENCRYPTION) { + DEBUG(0,("call_trans2setfsinfo: encryption required " + "and info level 0x%x sent.\n", + (unsigned int)info_level)); + reply_nterror(req, NT_STATUS_ACCESS_DENIED); + return; + } + } + switch(info_level) { case SMB_SET_CIFS_UNIX_INFO: { @@ -7060,6 +7080,17 @@ static void handle_trans2(connection_struct *conn, struct smb_request *req, SSVAL(req->inbuf,smb_flg2,req->flags2); } + if (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF ) { + if (state->call != TRANSACT2_QFSINFO && + state->call != TRANSACT2_SETFSINFO) { + DEBUG(0,("handle_trans2: encryption required " + "with call 0x%x\n", + (unsigned int)state->call)); + reply_nterror(req, NT_STATUS_ACCESS_DENIED); + return; + } + } + /* Now we must call the relevant TRANS2 function */ switch(state->call) { case TRANSACT2_OPEN: -- cgit From 38369ba74190259b437e9a875ac75a33d3ff3c24 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 28 Dec 2007 00:02:13 -0800 Subject: Ensure we turn off POSIX large read/write if encryption is mandatory or signing is on. Jeremy. (This used to be commit 5088b704791be2f36641fa0ec59dff7f289ae868) --- source3/smbd/trans2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 7625eaed7d..b1f57a9b3e 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2739,6 +2739,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned { bool large_write = lp_min_receive_file_size() && !srv_is_signing_active(); + bool large_read = !srv_is_signing_active(); int encrypt_caps = 0; if (!lp_unix_extensions()) { @@ -2757,6 +2758,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned case Required: encrypt_caps = CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP| CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP; + large_write = false; + large_read = false; break; } @@ -2773,8 +2776,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned CIFS_UNIX_FCNTL_LOCKS_CAP| CIFS_UNIX_EXTATTR_CAP| CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP| - CIFS_UNIX_LARGE_READ_CAP| encrypt_caps| + (large_read ? CIFS_UNIX_LARGE_READ_CAP : 0) | (large_write ? CIFS_UNIX_LARGE_WRITE_CAP : 0)))); break; -- cgit From 9dfde0ebec14edc25ac79336b77c133c8319ea92 Mon Sep 17 00:00:00 2001 From: Karolin Seeger Date: Thu, 27 Dec 2007 14:08:40 +0100 Subject: Improve error messages of 'net rpc user [add|delete]' commands. Karolin (This used to be commit 4260c79bf7687bd2ebcc4ca5e0a5f020a759c1fb) --- source3/utils/net_rpc.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index ab0cc73e49..155cda64df 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -682,10 +682,10 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid, } done: if (!NT_STATUS_IS_OK(result)) { - d_fprintf(stderr, "Failed to add user %s - %s\n", acct_name, - nt_errstr(result)); + d_fprintf(stderr, "Failed to add user '%s' with %s.\n", + acct_name, nt_errstr(result)); } else { - d_printf("Added user %s\n", acct_name); + d_printf("Added user '%s'.\n", acct_name); } return result; } @@ -732,12 +732,16 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid, { NTSTATUS result = NT_STATUS_UNSUCCESSFUL; POLICY_HND connect_pol, domain_pol, user_pol; + const char *acct_name; if (argc < 1) { d_printf("User must be specified\n"); rpc_user_usage(argc, argv); return NT_STATUS_OK; } + + acct_name = argv[0]; + /* Get sam policy and domain handles */ result = rpccli_samr_connect(pipe_hnd, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -762,7 +766,7 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid, uint32 flags = 0x000003e8; /* Unknown */ result = rpccli_samr_lookup_names(pipe_hnd, mem_ctx, &domain_pol, - flags, 1, &argv[0], + flags, 1, &acct_name, &num_rids, &user_rids, &name_types); @@ -787,14 +791,14 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid, goto done; } - /* Display results */ + done: if (!NT_STATUS_IS_OK(result)) { - d_fprintf(stderr, "Failed to delete user account - %s\n", nt_errstr(result)); - } else { - d_printf("Deleted user account\n"); - } + d_fprintf(stderr, "Failed to delete user '%s' with %s.\n", + acct_name, nt_errstr(result)); + } else { + d_printf("Deleted user '%s'.\n", acct_name); + } - done: return result; } -- cgit From c2b5cf58f598e0c4018fac639007e8b4306db8d6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 22 Dec 2007 12:02:33 +0100 Subject: bin/vlp needs a dependency on @LIBWBCLIENT_SHARED@ This failed to link if you compile with -j. (This used to be commit fed8f2abd704d1993146ad462d81f69367537cfb) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 9d8ad3e68b..01f2988b88 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1531,7 +1531,7 @@ bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ @LIBWBCLIEN @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ @WINBIND_LIBS@ -bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) +bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @LIBWBCLIENT_SHARED@ @echo "Linking $@" @$(CC) $(FLAGS) -o $@ $(VLP_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) @LIBWBCLIENT_SHARED@ -- cgit From 3c99b7773ef62d13a7e3611be0603a5807315d9d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 13:13:29 +0100 Subject: Convert csamuser to memcache (This used to be commit 476d3abf9c6142d99822212141fc3d843aca4798) --- source3/include/memcache.h | 1 + source3/lib/memcache.c | 1 + source3/passdb/pdb_interface.c | 53 +++++++++++++++++++++--------------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/source3/include/memcache.h b/source3/include/memcache.h index c4a2974b62..c615efa695 100644 --- a/source3/include/memcache.h +++ b/source3/include/memcache.h @@ -33,6 +33,7 @@ enum memcache_number { GETWD_CACHE, GETPWNAM_CACHE, /* talloc */ MANGLE_HASH2_CACHE, + PDB_GETPWSID_CACHE, /* talloc */ SINGLETON_CACHE }; diff --git a/source3/lib/memcache.c b/source3/lib/memcache.c index 457586bd68..c06e7ceacc 100644 --- a/source3/lib/memcache.c +++ b/source3/lib/memcache.c @@ -46,6 +46,7 @@ static bool memcache_is_talloc(enum memcache_number n) switch (n) { case GETPWNAM_CACHE: + case PDB_GETPWSID_CACHE: result = true; break; default: diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 2102b579ec..0ab45bafc3 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -25,10 +25,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB -/* Cache of latest SAM lookup query */ - -static struct samu *csamuser = NULL; - static_decl_pdb; static struct pdb_init_function_entry *backends = NULL; @@ -211,25 +207,29 @@ static struct pdb_methods *pdb_get_methods(void) bool pdb_getsampwnam(struct samu *sam_acct, const char *username) { struct pdb_methods *pdb = pdb_get_methods(); + struct samu *cache_copy; + const struct dom_sid *user_sid; if (!NT_STATUS_IS_OK(pdb->getsampwnam(pdb, sam_acct, username))) { return False; } - if ( csamuser ) { - TALLOC_FREE(csamuser); - } - - csamuser = samu_new( NULL ); - if (!csamuser) { + cache_copy = samu_new(NULL); + if (cache_copy == NULL) { return False; } - if (!pdb_copy_sam_account(csamuser, sam_acct)) { - TALLOC_FREE(csamuser); + if (!pdb_copy_sam_account(cache_copy, sam_acct)) { + TALLOC_FREE(cache_copy); return False; } + user_sid = pdb_get_user_sid(cache_copy); + + memcache_add_talloc(NULL, PDB_GETPWSID_CACHE, + data_blob_const(user_sid, sizeof(*user_sid)), + cache_copy); + return True; } @@ -262,6 +262,7 @@ bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid) { struct pdb_methods *pdb = pdb_get_methods(); uint32 rid; + void *cache_data; /* hard code the Guest RID of 501 */ @@ -274,9 +275,16 @@ bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid) } /* check the cache first */ - - if ( csamuser && sid_equal(sid, pdb_get_user_sid(csamuser) ) ) - return pdb_copy_sam_account(sam_acct, csamuser); + + cache_data = memcache_lookup_talloc( + NULL, PDB_GETPWSID_CACHE, data_blob_const(sid, sizeof(*sid))); + + if (cache_data != NULL) { + struct samu *cache_copy = talloc_get_type_abort( + cache_data, struct samu); + + return pdb_copy_sam_account(sam_acct, cache_copy); + } return NT_STATUS_IS_OK(pdb->getsampwsid(pdb, sam_acct, sid)); } @@ -471,10 +479,7 @@ NTSTATUS pdb_update_sam_account(struct samu *sam_acct) { struct pdb_methods *pdb = pdb_get_methods(); - if (csamuser != NULL) { - TALLOC_FREE(csamuser); - csamuser = NULL; - } + memcache_flush(NULL, PDB_GETPWSID_CACHE); return pdb->update_sam_account(pdb, sam_acct); } @@ -483,10 +488,7 @@ NTSTATUS pdb_delete_sam_account(struct samu *sam_acct) { struct pdb_methods *pdb = pdb_get_methods(); - if (csamuser != NULL) { - TALLOC_FREE(csamuser); - csamuser = NULL; - } + memcache_flush(NULL, PDB_GETPWSID_CACHE); return pdb->delete_sam_account(pdb, sam_acct); } @@ -497,10 +499,7 @@ NTSTATUS pdb_rename_sam_account(struct samu *oldname, const char *newname) uid_t uid; NTSTATUS status; - if (csamuser != NULL) { - TALLOC_FREE(csamuser); - csamuser = NULL; - } + memcache_flush(NULL, PDB_GETPWSID_CACHE); /* sanity check to make sure we don't rename root */ -- cgit From 4cdce5b50e286aab457611d2c634cb79990795fd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 17:02:07 +0100 Subject: Remove a static array This might be worth it, mangle_hash is hardly used these days (This used to be commit 44775ea38bc320ac8e2208769a8cde2c6f44f640) --- source3/smbd/mangle_hash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index c369f6eda4..1dc9c67dcc 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -57,8 +57,7 @@ static char magic_char = '~'; static const char basechars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%"; #define MANGLE_BASE (sizeof(basechars)/sizeof(char)-1) -static unsigned char chartest[256] = { 0 }; -static bool ct_initialized = False; +static unsigned char *chartest; #define mangle(V) ((char)(basechars[(V) % MANGLE_BASE])) #define BASECHAR_MASK 0xf0 @@ -334,13 +333,13 @@ static void init_chartest( void ) { const unsigned char *s; - memset( (char *)chartest, '\0', 256 ); + chartest = SMB_MALLOC_ARRAY(unsigned char, 256); + + SMB_ASSERT(chartest != NULL); for( s = (const unsigned char *)basechars; *s; s++ ) { chartest[*s] |= BASECHAR_MASK; } - - ct_initialized = True; } /* ************************************************************************** ** @@ -367,8 +366,9 @@ static bool is_mangled(const char *s, const struct share_params *p) magic_char = lp_magicchar(p); - if( !ct_initialized ) + if (chartest == NULL) { init_chartest(); + } magic = strchr_m( s, magic_char ); while( magic && magic[1] && magic[2] ) { /* 3 chars, 1st is magic. */ -- cgit From 533d6f617efc4dfe1e145785cb9736df07671bdf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 17:02:34 +0100 Subject: Remove static zeros (This used to be commit dbcc213710a9af31b6094d4741a6f68f573dcdad) --- source3/auth/auth_util.c | 9 ++++++--- source3/libsmb/ntlm_check.c | 5 ++++- source3/libsmb/ntlmssp.c | 7 +++++-- source3/rpc_client/cli_netlogon.c | 10 ++++++---- source3/rpc_parse/parse_prs.c | 14 ++++++++++---- 5 files changed, 31 insertions(+), 14 deletions(-) diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 3f65e6b126..fea1b2d761 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -1103,7 +1103,7 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf struct samu *sampass = NULL; DOM_SID guest_sid; bool ret; - static const char zeros[16] = { 0, }; + char zeros[16]; if ( !(sampass = samu_new( NULL )) ) { return NT_STATUS_NO_MEMORY; @@ -1138,6 +1138,7 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf /* annoying, but the Guest really does have a session key, and it is all zeros! */ + ZERO_STRUCT(zeros); (*server_info)->user_session_key = data_blob(zeros, sizeof(zeros)); (*server_info)->lm_session_key = data_blob(zeros, sizeof(zeros)); @@ -1420,7 +1421,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, auth_serversupplied_info **server_info, NET_USER_INFO_3 *info3) { - static const char zeros[16] = { 0, }; + char zeros[16]; NTSTATUS nt_status = NT_STATUS_OK; char *found_username = NULL; @@ -1624,7 +1625,9 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, &(info3->uni_logon_srv)); /* ensure we are never given NULL session keys */ - + + ZERO_STRUCT(zeros); + if (memcmp(info3->user_sess_key, zeros, sizeof(zeros)) == 0) { result->user_session_key = data_blob_null; } else { diff --git a/source3/libsmb/ntlm_check.c b/source3/libsmb/ntlm_check.c index f8ed044f8a..ae10d7373d 100644 --- a/source3/libsmb/ntlm_check.c +++ b/source3/libsmb/ntlm_check.c @@ -182,7 +182,10 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, DATA_BLOB *user_sess_key, DATA_BLOB *lm_sess_key) { - static const unsigned char zeros[8] = { 0, }; + unsigned char zeros[8]; + + ZERO_STRUCT(zeros); + if (nt_pw == NULL) { DEBUG(3,("ntlm_password_check: NO NT password stored for user %s.\n", username)); diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c index ed08e8102b..35c20ed647 100644 --- a/source3/libsmb/ntlmssp.c +++ b/source3/libsmb/ntlmssp.c @@ -823,7 +823,8 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state, session_key.data); DEBUG(10,("ntlmssp_server_auth: Created NTLM session key.\n")); } else { - static const uint8 zeros[24] = { 0, }; + uint8 zeros[24]; + ZERO_STRUCT(zeros); session_key = data_blob_talloc( ntlmssp_state->mem_ctx, NULL, 16); if (session_key.data == NULL) { @@ -1066,9 +1067,11 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state, } if (!ntlmssp_state->nt_hash || !ntlmssp_state->lm_hash) { - static const uchar zeros[16] = { 0, }; + uchar zeros[16]; /* do nothing - blobs are zero length */ + ZERO_STRUCT(zeros); + /* session key is all zeros */ session_key = data_blob_talloc(ntlmssp_state->mem_ctx, zeros, 16); diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 26d2124da0..e192e4ca26 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -978,11 +978,12 @@ NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli, int validation_level = 3; const char *workstation_name_slash; const char *server_name_slash; - static uint8 zeros[16]; + uint8 zeros[16]; DOM_CRED clnt_creds; DOM_CRED ret_creds; int i; - + + ZERO_STRUCT(zeros); ZERO_STRUCT(q); ZERO_STRUCT(r); ZERO_STRUCT(ret_creds); @@ -1084,9 +1085,10 @@ NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli, int validation_level = 3; const char *workstation_name_slash; const char *server_name_slash; - static uint8 zeros[16]; + uint8 zeros[16]; int i; - + + ZERO_STRUCT(zeros); ZERO_STRUCT(q); ZERO_STRUCT(r); diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 23dae9f3a1..638d71a73e 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1544,9 +1544,11 @@ static void schannel_digest(struct schannel_auth_struct *a, uchar digest_final[16]) { uchar whole_packet_digest[16]; - static const uchar zeros[4] = { 0, }; + uchar zeros[4]; struct MD5Context ctx3; - + + ZERO_STRUCT(zeros); + /* verfiy the signature on the packet by MD5 over various bits */ MD5Init(&ctx3); /* use our sequence number, which ensures the packet is not @@ -1573,11 +1575,13 @@ static void schannel_get_sealing_key(struct schannel_auth_struct *a, RPC_AUTH_SCHANNEL_CHK *verf, uchar sealing_key[16]) { - static const uchar zeros[4] = { 0, }; + uchar zeros[4]; uchar digest2[16]; uchar sess_kf0[16]; int i; + ZERO_STRUCT(zeros); + for (i = 0; i < sizeof(sess_kf0); i++) { sess_kf0[i] = a->sess_key[i] ^ 0xf0; } @@ -1600,10 +1604,12 @@ static void schannel_get_sealing_key(struct schannel_auth_struct *a, static void schannel_deal_with_seq_num(struct schannel_auth_struct *a, RPC_AUTH_SCHANNEL_CHK *verf) { - static const uchar zeros[4] = { 0, }; + uchar zeros[4]; uchar sequence_key[16]; uchar digest1[16]; + ZERO_STRUCT(zeros); + hmac_md5(a->sess_key, zeros, sizeof(zeros), digest1); dump_data_pw("(sequence key) digest1:\n", digest1, sizeof(digest1)); -- cgit From 3ba59d461665a16cf87b991a8135821208457f67 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 17:09:57 +0100 Subject: don't store cache_readonly in gencache tdb won't allow us to write anyway (This used to be commit 069cd6d63a61065be7926230235e198c456d38ae) --- source3/lib/gencache.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index a50e5d01fa..663385cfe3 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -32,7 +32,6 @@ #define BLOB_TYPE_LEN 9 static TDB_CONTEXT *cache; -static bool cache_readonly; /** * @file gencache.c @@ -67,7 +66,6 @@ bool gencache_init(void) if (!cache && (errno == EACCES)) { cache = tdb_open_log(cache_fname, 0, TDB_DEFAULT, O_RDONLY, 0644); if (cache) { - cache_readonly = True; DEBUG(5, ("gencache_init: Opening cache file %s read-only.\n", cache_fname)); } } @@ -95,7 +93,6 @@ bool gencache_shutdown(void) DEBUG(5, ("Closing cache file\n")); ret = tdb_close(cache); cache = NULL; - cache_readonly = False; return ret != -1; } @@ -123,10 +120,6 @@ bool gencache_set(const char *keystr, const char *value, time_t timeout) if (!gencache_init()) return False; - if (cache_readonly) { - return False; - } - asprintf(&valstr, CACHE_DATA_FMT, (int)timeout, value); if (!valstr) return False; @@ -161,10 +154,6 @@ bool gencache_del(const char *keystr) if (!gencache_init()) return False; - if (cache_readonly) { - return False; - } - DEBUG(10, ("Deleting cache entry (key = %s)\n", keystr)); ret = tdb_delete_bystring(cache, keystr); @@ -351,10 +340,6 @@ bool gencache_set_data_blob(const char *keystr, DATA_BLOB *blob, time_t timeout) return False; } - if (cache_readonly) { - return False; - } - asprintf(&valstr, "%12u/%s", (int)timeout, BLOB_TYPE); if (!valstr) { return False; -- cgit From d826fcf6dfb0e2203a114cbd427badc0abeea559 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 17:16:35 +0100 Subject: Remove a global (This used to be commit 515f6a8cff7e28b0e98136f3214ef52512cfaf37) --- source3/printing/printing.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/source3/printing/printing.c b/source3/printing/printing.c index fa6ed89edd..9f2c08629d 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -373,13 +373,17 @@ static struct printjob *print_job_find(const char *sharename, uint32 jobid) /* Convert a unix jobid to a smb jobid */ -static uint32 sysjob_to_jobid_value; +struct unixjob_traverse_state { + int sysjob; + uint32 sysjob_to_jobid_value; +}; static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, - TDB_DATA data, void *state) + TDB_DATA data, void *private_data) { struct printjob *pjob; - int *sysjob = (int *)state; + struct unixjob_traverse_state *state = + (struct unixjob_traverse_state *)private_data; if (!data.dptr || data.dsize == 0) return 0; @@ -388,10 +392,10 @@ static int unixjob_traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, if (key.dsize != sizeof(uint32)) return 0; - if (*sysjob == pjob->sysjob) { + if (state->sysjob == pjob->sysjob) { uint32 jobid = IVAL(key.dptr,0); - sysjob_to_jobid_value = jobid; + state->sysjob_to_jobid_value = jobid; return 1; } @@ -407,8 +411,10 @@ uint32 sysjob_to_jobid(int unix_jobid) { int services = lp_numservices(); int snum; + struct unixjob_traverse_state state; - sysjob_to_jobid_value = (uint32)-1; + state.sysjob = unix_jobid; + state.sysjob_to_jobid_value = (uint32)-1; for (snum = 0; snum < services; snum++) { struct tdb_print_db *pdb; @@ -418,10 +424,10 @@ uint32 sysjob_to_jobid(int unix_jobid) if (!pdb) { continue; } - tdb_traverse(pdb->tdb, unixjob_traverse_fn, &unix_jobid); + tdb_traverse(pdb->tdb, unixjob_traverse_fn, &state); release_print_db(pdb); - if (sysjob_to_jobid_value != (uint32)-1) - return sysjob_to_jobid_value; + if (state.sysjob_to_jobid_value != (uint32)-1) + return state.sysjob_to_jobid_value; } return (uint32)-1; } -- cgit From 245537f9bd1bddc496da0155012c34a2c7a18668 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 28 Dec 2007 17:24:39 +0100 Subject: Convert get_root_nt_token to memcache (This used to be commit fada689893314bed2fc78588b3fd9b144f4c808a) --- source3/auth/token_util.c | 18 +++++++++++++++--- source3/include/memcache.h | 1 + source3/lib/memcache.c | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c index 27c98c9581..a1b4edfb7a 100644 --- a/source3/auth/token_util.c +++ b/source3/auth/token_util.c @@ -77,12 +77,19 @@ bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid ) NT_USER_TOKEN *get_root_nt_token( void ) { - static NT_USER_TOKEN *token = NULL; + struct nt_user_token *token = NULL; DOM_SID u_sid, g_sid; struct passwd *pw; + void *cache_data; - if ( token ) - return token; + cache_data = memcache_lookup_talloc( + NULL, SINGLETON_CACHE_TALLOC, + data_blob_string_const("root_nt_token")); + + if (cache_data != NULL) { + return talloc_get_type_abort( + cache_data, struct nt_user_token); + } if ( !(pw = sys_getpwnam( "root" )) ) { DEBUG(0,("get_root_nt_token: getpwnam(\"root\") failed!\n")); @@ -97,6 +104,11 @@ NT_USER_TOKEN *get_root_nt_token( void ) token = create_local_nt_token(NULL, &u_sid, False, 1, &global_sid_Builtin_Administrators); + + memcache_add_talloc( + NULL, SINGLETON_CACHE_TALLOC, + data_blob_string_const("root_nt_token"), token); + return token; } diff --git a/source3/include/memcache.h b/source3/include/memcache.h index c615efa695..5a0ce63cb7 100644 --- a/source3/include/memcache.h +++ b/source3/include/memcache.h @@ -34,6 +34,7 @@ enum memcache_number { GETPWNAM_CACHE, /* talloc */ MANGLE_HASH2_CACHE, PDB_GETPWSID_CACHE, /* talloc */ + SINGLETON_CACHE_TALLOC, /* talloc */ SINGLETON_CACHE }; diff --git a/source3/lib/memcache.c b/source3/lib/memcache.c index c06e7ceacc..6dee61af50 100644 --- a/source3/lib/memcache.c +++ b/source3/lib/memcache.c @@ -47,6 +47,7 @@ static bool memcache_is_talloc(enum memcache_number n) switch (n) { case GETPWNAM_CACHE: case PDB_GETPWSID_CACHE: + case SINGLETON_CACHE_TALLOC: result = true; break; default: -- cgit From dfa8d9356cea0dd6a1b013a72c3d68c026deb511 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 00:05:23 +0100 Subject: Move format_value() to libnet_conf.c. Michael (This used to be commit 3422a5048ad4b7f789ec233356885d78dbdacf9a) --- source3/libnet/libnet_conf.c | 34 ++++++++++++++++++++++++++++++++++ source3/utils/net_conf.c | 33 --------------------------------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 93e13009a4..5389d856b3 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -222,6 +222,40 @@ done: return werr; } +char *format_value(TALLOC_CTX *mem_ctx, struct registry_value *value) +{ + char *result = NULL; + + /* what if mem_ctx = NULL? */ + + switch (value->type) { + case REG_DWORD: + result = talloc_asprintf(mem_ctx, "%d", value->v.dword); + break; + case REG_SZ: + case REG_EXPAND_SZ: + result = talloc_asprintf(mem_ctx, "%s", value->v.sz.str); + break; + case REG_MULTI_SZ: { + uint32 j; + for (j = 0; j < value->v.multi_sz.num_strings; j++) { + result = talloc_asprintf(mem_ctx, "\"%s\" ", + value->v.multi_sz.strings[j]); + } + break; + } + case REG_BINARY: + result = talloc_asprintf(mem_ctx, "binary (%d bytes)", + (int)value->v.binary.length); + break; + default: + result = talloc_asprintf(mem_ctx, ""); + break; + } + return result; +} + + /********************************************************************** * * The actual net conf api functions, that are exported. diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 8b89f2fa6f..98cc1ee198 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -110,39 +110,6 @@ static int net_conf_delparm_usage(int argc, const char **argv) * Helper functions */ -static char *format_value(TALLOC_CTX *mem_ctx, struct registry_value *value) -{ - char *result = NULL; - - /* what if mem_ctx = NULL? */ - - switch (value->type) { - case REG_DWORD: - result = talloc_asprintf(mem_ctx, "%d", value->v.dword); - break; - case REG_SZ: - case REG_EXPAND_SZ: - result = talloc_asprintf(mem_ctx, "%s", value->v.sz.str); - break; - case REG_MULTI_SZ: { - uint32 j; - for (j = 0; j < value->v.multi_sz.num_strings; j++) { - result = talloc_asprintf(mem_ctx, "\"%s\" ", - value->v.multi_sz.strings[j]); - } - break; - } - case REG_BINARY: - result = talloc_asprintf(mem_ctx, "binary (%d bytes)", - (int)value->v.binary.length); - break; - default: - result = talloc_asprintf(mem_ctx, ""); - break; - } - return result; -} - static WERROR list_values(TALLOC_CTX *ctx, struct registry_key *key) { WERROR werr = WERR_OK; -- cgit From 4b75bc63bb82f2322acdb013f1cfa9eb36419856 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 01:17:39 +0100 Subject: Rename format_value() to libnet_smbconf_format_registry_value(). Michael (This used to be commit 95d5dd9bb0546181cd499e6deabff562166412e3) --- source3/libnet/libnet_conf.c | 4 +++- source3/utils/net_conf.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 5389d856b3..dfea724497 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -222,7 +222,8 @@ done: return werr; } -char *format_value(TALLOC_CTX *mem_ctx, struct registry_value *value) +char *libnet_smbconf_format_registry_value(TALLOC_CTX *mem_ctx, + struct registry_value *value) { char *result = NULL; @@ -362,6 +363,7 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, { WERROR werr; struct registry_key *key = NULL; + struct registry_value *value = NULL; if (!libnet_smbconf_key_exists(service)) { werr = WERR_NO_SUCH_SERVICE; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 98cc1ee198..fb6cb58840 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -122,7 +122,8 @@ static WERROR list_values(TALLOC_CTX *ctx, struct registry_key *key) &valvalue)); idx++) { - d_printf("\t%s = %s\n", valname, format_value(ctx, valvalue)); + d_printf("\t%s = %s\n", valname, + libnet_smbconf_format_registry_value(ctx, valvalue)); } if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { d_fprintf(stderr, "Error enumerating values: %s\n", @@ -798,7 +799,7 @@ static int net_conf_getparm(int argc, const char **argv) goto done; } - d_printf("%s\n", format_value(ctx, value)); + d_printf("%s\n", libnet_smbconf_format_registry_value(ctx, value)); ret = 0; done: -- cgit From eb356fbafc4b6e0d94b1ba75c6c466262e3221e5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 02:12:33 +0100 Subject: Hide the registry backend from libnet_smbconf_getparm(). Return a formatted string of the value instead. Michael (This used to be commit 7d0ec5bae155cda6620db04dcb7bd43db59241aa) --- source3/libnet/libnet_conf.c | 21 ++++++++++++++++++--- source3/utils/net_conf.c | 6 +++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index dfea724497..1e9e033205 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -359,12 +359,17 @@ done: WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, const char *service, const char *param, - struct registry_value **value) + char **valstr) { - WERROR werr; + WERROR werr = WERR_OK; struct registry_key *key = NULL; struct registry_value *value = NULL; + if (valstr == NULL) { + werr = WERR_INVALID_PARAM; + goto done; + } + if (!libnet_smbconf_key_exists(service)) { werr = WERR_NO_SUCH_SERVICE; goto done; @@ -381,10 +386,20 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - werr = reg_queryvalue(mem_ctx, key, param, value); + werr = reg_queryvalue(mem_ctx, key, param, &value); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + *valstr = libnet_smbconf_format_registry_value(mem_ctx, value); + + if (*valstr == NULL) { + werr = WERR_NOMEM; + } done: TALLOC_FREE(key); + TALLOC_FREE(value); return werr; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index fb6cb58840..e607d099dc 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -769,7 +769,7 @@ static int net_conf_getparm(int argc, const char **argv) WERROR werr = WERR_OK; char *service = NULL; char *param = NULL; - struct registry_value *value = NULL; + char *valstr = NULL; TALLOC_CTX *ctx; ctx = talloc_init("getparm"); @@ -781,7 +781,7 @@ static int net_conf_getparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - werr = libnet_smbconf_getparm(ctx, service, param, &value); + werr = libnet_smbconf_getparm(ctx, service, param, &valstr); if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, @@ -799,7 +799,7 @@ static int net_conf_getparm(int argc, const char **argv) goto done; } - d_printf("%s\n", libnet_smbconf_format_registry_value(ctx, value)); + d_printf("%s\n", valstr); ret = 0; done: -- cgit From 618b0efbbcc42beff60da4fe57ad6a6162b5e3f0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 02:16:38 +0100 Subject: Handle NULL talloc context in libnet_smbconf_format_registry_value(). Maybe we should generate a new context instead of returning NULL? Michael (This used to be commit d7aaec713e17f93eed5177f0c3468deb625402a8) --- source3/libnet/libnet_conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 1e9e033205..3335c37299 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -227,7 +227,10 @@ char *libnet_smbconf_format_registry_value(TALLOC_CTX *mem_ctx, { char *result = NULL; - /* what if mem_ctx = NULL? */ + /* alternatively, create a new talloc context? */ + if (mem_ctx == NULL) { + return result; + } switch (value->type) { case REG_DWORD: -- cgit From b5b51b530fedf2190f675adbc1ba6e333a86ac0d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 02:18:44 +0100 Subject: Add a comment header for libnet_smbconf_format_registry_value(). Michael (This used to be commit 80e73407ea326cc68cd8728845c7a1c0907e2201) --- source3/libnet/libnet_conf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 3335c37299..6603de0199 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -222,6 +222,13 @@ done: return werr; } +/** + * format a registry_value into a string. + * + * This is intended to be used for smbconf registry values, + * which are ar stored as REG_SZ values, so the incomplete + * handling should be ok. + */ char *libnet_smbconf_format_registry_value(TALLOC_CTX *mem_ctx, struct registry_value *value) { -- cgit From 27f0130434d978cf98bab4db38718cd1d3856535 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 02:26:33 +0100 Subject: Add a couple of comment headers to the main libnet_conf functions. Michael (This used to be commit e9694ae20e1da1d8c1cbb252e630815b561647dd) --- source3/libnet/libnet_conf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 6603de0199..a8a8e01538 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -340,6 +340,9 @@ done: return werr; } +/** + * set a configuration parameter to the value provided. + */ WERROR libnet_smbconf_setparm(const char *service, const char *param, const char *valstr) @@ -366,6 +369,9 @@ done: return werr; } +/** + * get the value of a configuration parameter as a string + */ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, const char *service, const char *param, @@ -413,6 +419,9 @@ done: return werr; } +/** + * delete a parameter from configuration + */ WERROR libnet_smbconf_delparm(const char *service, const char *param) { -- cgit From 8093a75d6f44644b70023272f186575c2372c54b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 02:27:20 +0100 Subject: Make the main net_conf functions static in net_conf.c Michael (This used to be commit dd6e09a65e67a9a16b35b078ebfb41da09926029) --- source3/utils/net_conf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index e607d099dc..8140941da2 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -296,7 +296,7 @@ static bool globals_exist(void) * the conf functions */ -int net_conf_list(int argc, const char **argv) +static int net_conf_list(int argc, const char **argv) { WERROR werr = WERR_OK; int ret = -1; @@ -369,7 +369,7 @@ done: return ret; } -int net_conf_import(int argc, const char **argv) +static int net_conf_import(int argc, const char **argv) { int ret = -1; const char *filename = NULL; @@ -455,7 +455,7 @@ done: return ret; } -int net_conf_listshares(int argc, const char **argv) +static int net_conf_listshares(int argc, const char **argv) { WERROR werr = WERR_OK; int ret = -1; @@ -497,7 +497,7 @@ done: return ret; } -int net_conf_drop(int argc, const char **argv) +static int net_conf_drop(int argc, const char **argv) { int ret = -1; WERROR werr; @@ -520,7 +520,7 @@ done: return ret; } -int net_conf_showshare(int argc, const char **argv) +static int net_conf_showshare(int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; @@ -552,7 +552,7 @@ done: return ret; } -int net_conf_addshare(int argc, const char **argv) +static int net_conf_addshare(int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; @@ -707,7 +707,7 @@ done: return ret; } -int net_conf_delshare(int argc, const char **argv) +static int net_conf_delshare(int argc, const char **argv) { int ret = -1; const char *sharename = NULL; -- cgit From 40bf6730aaca0409d17619c49e9eea59d68a6f10 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 24 Dec 2007 14:12:54 +0100 Subject: passdb.tdb is located in the private directory Jerry, as part of d6cdbfd87 the default location of passdb.tdb has changed from the private directory to the state directory. I think because passdb.tdb holds the password hashes, it is reasonable to keep this next to the smbpasswd file. Please review and potentially push. Thanks, Volker (This used to be commit c9c7607c402c0a9df9796c767b689d207d67d8e4) --- source3/passdb/pdb_tdb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 1277b9c395..5e21c46abf 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -1613,7 +1613,8 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc /* save the path for later */ if (!location) { - if (asprintf(&tdbfile, "%s/%s", get_dyn_STATEDIR(), PASSDB_FILE_NAME) < 0) { + if (asprintf(&tdbfile, "%s/%s", get_dyn_PRIVATE_DIR(), + PASSDB_FILE_NAME) < 0) { return NT_STATUS_NO_MEMORY; } pfile = tdbfile; -- cgit From f8c39cbb7b3e4df3c07735575bc5f31717b22f66 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 03:38:13 +0100 Subject: Move functionality of net_conf_showshare() to libnet_conf.c The functionality is moved to a new function libnet_smbconf_getshare(). This returns the parameters of the given share as two lists: the list of parameter names and the list of matching (formatted) parameter values. The retrieval and formatting is done in a new internal helper function libnet_smbconf_reg_get_values() that is to become the replacement for list_values() from net_conf.c once functionality of net_conf_list() has been moved to libnet_conf, too. Michael (This used to be commit 198232bd525cfac933b4885e6b330ebf4ac2c8ae) --- source3/libnet/libnet_conf.c | 89 ++++++++++++++++++++++++++++++++++++++++++++ source3/utils/net_conf.c | 19 ++++++++-- 2 files changed, 104 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index a8a8e01538..ca25a5cc50 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -266,6 +266,71 @@ char *libnet_smbconf_format_registry_value(TALLOC_CTX *mem_ctx, return result; } +/** + * Get the values of a key as a list of value names + * and a list of value strings (ordered) + */ +static WERROR libnet_smbconf_reg_get_values(TALLOC_CTX *mem_ctx, + struct registry_key *key, + uint32_t *num_values, + char ***value_names, + char ***value_strings) +{ + TALLOC_CTX *tmp_ctx; + WERROR werr = WERR_OK; + uint32_t count; + struct registry_value *valvalue = NULL; + char *valname = NULL; + char **tmp_valnames = NULL; + char **tmp_valstrings = NULL; + + if ((num_values == NULL) || (value_names == NULL) || + (value_strings == NULL)) + { + werr = WERR_INVALID_PARAM; + goto done; + } + + tmp_ctx = talloc_new(mem_ctx); + if (tmp_ctx == NULL) { + werr = WERR_NOMEM; + goto done; + } + + for (count = 0; + W_ERROR_IS_OK(werr = reg_enumvalue(tmp_ctx, key, count, &valname, + &valvalue)); + count++) + { + tmp_valnames = TALLOC_REALLOC_ARRAY(tmp_ctx, tmp_valnames, + char *, count + 1); + tmp_valstrings = TALLOC_REALLOC_ARRAY(tmp_ctx, tmp_valstrings, + char *, count + 1); + if ((tmp_valstrings == NULL) || (tmp_valnames == NULL)) { + werr = WERR_NOMEM; + goto done; + } + tmp_valnames[count] = talloc_strdup(tmp_valnames, valname); + tmp_valstrings[count] = + libnet_smbconf_format_registry_value(tmp_valstrings, + valvalue); + } + if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { + goto done; + } + + werr = WERR_OK; + + *num_values = count - 1; + if (count > 0) { + *value_names = talloc_move(mem_ctx, &tmp_valnames); + *value_strings = talloc_move(mem_ctx, &tmp_valstrings); + } + +done: + TALLOC_FREE(tmp_ctx); + return werr; +} /********************************************************************** * @@ -319,6 +384,30 @@ done: return werr; } +/** + * get a definition of a share (service) from configuration. + */ +WERROR libnet_smbconf_getshare(TALLOC_CTX *mem_ctx, const char *servicename, + uint32_t *num_params, char ***param_names, + char ***param_values) +{ + WERROR werr = WERR_OK; + struct registry_key *key = NULL; + + werr = libnet_smbconf_reg_open_path(mem_ctx, servicename, REG_KEY_READ, + &key); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + werr = libnet_smbconf_reg_get_values(mem_ctx, key, num_params, + param_names, param_values); + +done: + TALLOC_FREE(key); + return werr; +} + /** * delete a service from configuration */ diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 8140941da2..9a7c8c9097 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -525,7 +525,12 @@ static int net_conf_showshare(int argc, const char **argv) int ret = -1; WERROR werr = WERR_OK; struct registry_key *key = NULL; + char *sharename = NULL; TALLOC_CTX *ctx; + uint32_t num_params; + uint32_t count; + char **param_names; + char **param_values; ctx = talloc_init("showshare"); @@ -534,15 +539,21 @@ static int net_conf_showshare(int argc, const char **argv) goto done; } - werr = libnet_smbconf_reg_open_path(ctx, argv[0], REG_KEY_READ, &key); + sharename = argv[0]; + + werr = libnet_smbconf_getshare(ctx, sharename, &num_params, + ¶m_names, ¶m_values); if (!W_ERROR_IS_OK(werr)) { + d_printf("error getting share parameters: %s\n", + dos_errstr(werr)); goto done; } - d_printf("[%s]\n", argv[0]); + d_printf("[%s]\n", sharename); - if (!W_ERROR_IS_OK(list_values(ctx, key))) { - goto done; + for (count = 0; count <= num_params; count++) { + d_printf("\t%s = %s\n", param_names[count], + param_values[count]); } ret = 0; -- cgit From 2a642a6e2b42c2b111870f95fe6dd38e875766f1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 12:52:09 +0100 Subject: Move functionality of net_conf_listshares() to libnet_conf.c into new function libnet_smbconf_getshares(). Michael (This used to be commit 306c7e4d9cecac4c2c0ea1172bd585c3c17d4541) --- source3/libnet/libnet_conf.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ source3/utils/net_conf.c | 20 +++++------------ 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ca25a5cc50..a67a361f6e 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -384,6 +384,59 @@ done: return werr; } +WERROR libnet_smbconf_getshares(TALLOC_CTX *mem_ctx, uint32_t *num_shares, + char ***share_names) +{ + uint32_t count; + TALLOC_CTX *tmp_ctx; + WERROR werr = WERR_OK; + struct registry_key *key = NULL; + char *subkey_name = NULL; + char **tmp_share_names = NULL; + + if ((num_shares == NULL) || (share_names == NULL)) { + werr = WERR_INVALID_PARAM; + goto done; + } + + tmp_ctx = talloc_new(mem_ctx); + if (tmp_ctx == NULL) { + werr = WERR_NOMEM; + goto done; + } + + werr = libnet_smbconf_reg_open_basepath(tmp_ctx, + SEC_RIGHTS_ENUM_SUBKEYS, + &key); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + for (count = 0; + W_ERROR_IS_OK(werr = reg_enumkey(tmp_ctx, key, count, + &subkey_name, NULL)); + count++) + { + tmp_share_names = TALLOC_REALLOC_ARRAY(tmp_ctx, tmp_share_names, + char *, count + 1); + tmp_share_names[count] = talloc_strdup(tmp_ctx, subkey_name); + } + if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { + goto done; + } + + werr = WERR_OK; + + *num_shares = count - 1; + if (count > 0) { + *share_names = talloc_move(mem_ctx, &tmp_share_names); + } + +done: + TALLOC_FREE(tmp_ctx); + return werr; +} + /** * get a definition of a share (service) from configuration. */ diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 9a7c8c9097..5c0d6c6376 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -459,9 +459,8 @@ static int net_conf_listshares(int argc, const char **argv) { WERROR werr = WERR_OK; int ret = -1; - struct registry_key *key; - uint32 idx = 0; - char *subkey_name = NULL; + uint32_t count, num_shares = 0; + char **share_names = NULL; TALLOC_CTX *ctx; ctx = talloc_init("listshares"); @@ -471,23 +470,14 @@ static int net_conf_listshares(int argc, const char **argv) goto done; } - werr = libnet_smbconf_reg_open_basepath(ctx, SEC_RIGHTS_ENUM_SUBKEYS, - &key); + werr = libnet_smbconf_getshares(ctx, &num_shares, &share_names); if (!W_ERROR_IS_OK(werr)) { goto done; } - for (idx = 0; - W_ERROR_IS_OK(werr = reg_enumkey(ctx, key, idx, - &subkey_name, NULL)); - idx++) + for (count = 0; count <= num_shares; count++) { - d_printf("%s\n", subkey_name); - } - if (! W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { - d_fprintf(stderr, "Error enumerating subkeys: %s\n", - dos_errstr(werr)); - goto done; + d_printf("%s\n", share_names[count]); } ret = 0; -- cgit From cf90b67d59340e55d2941c63db5cef98d0d71613 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 12:53:19 +0100 Subject: Add a comment header for libnet_smbconf_getshares(). Michael (This used to be commit 7b51535f2f76b5c3c18620ffd9ac64505357e6db) --- source3/libnet/libnet_conf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index a67a361f6e..5d15c88252 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -384,6 +384,9 @@ done: return werr; } +/** + * get the list of share names defined in the configuration. + */ WERROR libnet_smbconf_getshares(TALLOC_CTX *mem_ctx, uint32_t *num_shares, char ***share_names) { -- cgit From 1c03f6b6081a54f6b6e684d9a76be039fd468444 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 12:55:42 +0100 Subject: Rename libnet_smbconf_getshares() to libnet_smbconf_get_share_names(). Michael (This used to be commit 9b3b9aa7e1044719a5112b9e5446e6fbdd7cecf9) --- source3/libnet/libnet_conf.c | 4 ++-- source3/utils/net_conf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 5d15c88252..99fde86adc 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -387,8 +387,8 @@ done: /** * get the list of share names defined in the configuration. */ -WERROR libnet_smbconf_getshares(TALLOC_CTX *mem_ctx, uint32_t *num_shares, - char ***share_names) +WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, + char ***share_names) { uint32_t count; TALLOC_CTX *tmp_ctx; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 5c0d6c6376..42af824508 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -470,7 +470,7 @@ static int net_conf_listshares(int argc, const char **argv) goto done; } - werr = libnet_smbconf_getshares(ctx, &num_shares, &share_names); + werr = libnet_smbconf_get_share_names(ctx, &num_shares, &share_names); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From 0b7aafff116fc297a0c2fb31a440a62652fe6fc9 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 13:02:22 +0100 Subject: Fix a const warning. Michael (This used to be commit e276e48177f890531ee8b4024c90352f284d4608) --- source3/utils/net_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 42af824508..651948c07c 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -515,7 +515,7 @@ static int net_conf_showshare(int argc, const char **argv) int ret = -1; WERROR werr = WERR_OK; struct registry_key *key = NULL; - char *sharename = NULL; + const char *sharename = NULL; TALLOC_CTX *ctx; uint32_t num_params; uint32_t count; -- cgit From 519277fcb77701f3fdb60aae79dea06d3bdbecda Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 29 Dec 2007 13:10:25 +0100 Subject: Attempt to fix the AIX make test failures For some reason AIX does not return the sender address in the AF_UNIX recvfrom. So the faked netbios name lookup does not work with socket wrapper, nmbd can't know where to send the reply. This patch works around this by telling smbclient explicitly where to connect. If there's any AIX experts listening -- how do I get the sender address from AF_UNIX recvfrom? Volker (This used to be commit 8ba3b8cf7aca657ad8426981d810c36ee6a34a2f) --- source3/script/tests/test_smbclient_s3.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index 3a8f3bd5b6..fdade5a617 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -24,7 +24,7 @@ test_noninteractive_no_prompt() prompt="smb" echo du | \ - $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp 2>&1 | \ + $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I SERVER_IP 2>&1 | \ grep $prompt if [ $? = 0 ] ; then @@ -48,7 +48,7 @@ quit EOF CLI_FORCE_INTERACTIVE=yes \ - $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp \ + $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP \ < $tmpfile 2>/dev/null | \ grep $prompt @@ -64,7 +64,7 @@ EOF } testit "smbclient -L $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1` -testit "smbclient -L $SERVER" $SMBCLIENT $CONFIGURATION -L $SERVER -N -p 139 || failed=`expr $failed + 1` +testit "smbclient -L $SERVER -I $SERVER_IP" $SMBCLIENT $CONFIGURATION -L $SERVER -I $SERVER_IP -N -p 139 || failed=`expr $failed + 1` testit "noninteractive smbclient does not prompt" \ test_noninteractive_no_prompt || \ -- cgit From d38aa8d0371dd48a0bed3a38069b9125d3dfb440 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 29 Dec 2007 16:35:51 +0100 Subject: Fix uninitalized variables (This used to be commit 2322fe718728178990fdc3696b84f5de7ae7701b) --- source3/libnet/libnet_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 99fde86adc..23b9131bae 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -276,7 +276,7 @@ static WERROR libnet_smbconf_reg_get_values(TALLOC_CTX *mem_ctx, char ***value_names, char ***value_strings) { - TALLOC_CTX *tmp_ctx; + TALLOC_CTX *tmp_ctx = NULL; WERROR werr = WERR_OK; uint32_t count; struct registry_value *valvalue = NULL; @@ -391,7 +391,7 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, char ***share_names) { uint32_t count; - TALLOC_CTX *tmp_ctx; + TALLOC_CTX *tmp_ctx = NULL; WERROR werr = WERR_OK; struct registry_key *key = NULL; char *subkey_name = NULL; -- cgit From 0e8ca78720ed0fff3853b8dbd407d41044aa4275 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 14:32:13 +0100 Subject: Move talloc-appending a string to an array to its own helper function libnet_smbconf_add_string_to_array(). Michael (This used to be commit f4a4c1b26a03cd0f334e00912d32f15c73474ff1) --- source3/libnet/libnet_conf.c | 62 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 23b9131bae..ad8deda04c 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -27,6 +27,33 @@ **********************************************************************/ +/** + * add a string to a talloced array of strings. + */ +static WERROR libnet_smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, + char ***array, + uint32_t count, + const char *string) +{ + WERROR werr = WERR_OK; + char **new_array = NULL; + + if ((array == NULL) || (string == NULL)) { + return WERR_INVALID_PARAM; + } + + new_array = TALLOC_REALLOC_ARRAY(mem_ctx, *array, char *, count + 1); + if (new_array == NULL) { + return WERR_NOMEM; + } + + new_array[count] = talloc_strdup(new_array, string); + + *array = new_array; + + return WERR_OK; +} + /* * Open a subkey of KEY_SMBCONF (i.e a service) */ @@ -302,18 +329,24 @@ static WERROR libnet_smbconf_reg_get_values(TALLOC_CTX *mem_ctx, &valvalue)); count++) { - tmp_valnames = TALLOC_REALLOC_ARRAY(tmp_ctx, tmp_valnames, - char *, count + 1); - tmp_valstrings = TALLOC_REALLOC_ARRAY(tmp_ctx, tmp_valstrings, - char *, count + 1); - if ((tmp_valstrings == NULL) || (tmp_valnames == NULL)) { - werr = WERR_NOMEM; + char *valstring; + + werr = libnet_smbconf_add_string_to_array(tmp_ctx, + &tmp_valnames, + count, valname); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + valstring = libnet_smbconf_format_registry_value(tmp_ctx, + valvalue); + werr = libnet_smbconf_add_string_to_array(tmp_ctx, + &tmp_valstrings, + count, + valstring); + if (!W_ERROR_IS_OK(werr)) { goto done; } - tmp_valnames[count] = talloc_strdup(tmp_valnames, valname); - tmp_valstrings[count] = - libnet_smbconf_format_registry_value(tmp_valstrings, - valvalue); } if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { goto done; @@ -420,9 +453,12 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, &subkey_name, NULL)); count++) { - tmp_share_names = TALLOC_REALLOC_ARRAY(tmp_ctx, tmp_share_names, - char *, count + 1); - tmp_share_names[count] = talloc_strdup(tmp_ctx, subkey_name); + werr = libnet_smbconf_add_string_to_array(tmp_ctx, + &tmp_share_names, + count, subkey_name); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } } if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { goto done; -- cgit From e8cb7cecf2dde62f271a37376cefa5179eb7b7bc Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 14:38:42 +0100 Subject: Make sure libnet_smbconf_get_share_names() always lists "global" first. And don't return count-1 but count. Michael (This used to be commit b7cb9b78231512dc4a88c307048d7fb5334fa319) --- source3/libnet/libnet_conf.c | 25 +++++++++++++++++++++---- source3/utils/net_conf.c | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ad8deda04c..636e966a37 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -424,6 +424,7 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, char ***share_names) { uint32_t count; + uint32_t added_count = 0; TALLOC_CTX *tmp_ctx = NULL; WERROR werr = WERR_OK; struct registry_key *key = NULL; @@ -441,6 +442,17 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, goto done; } + /* make sure "global" is always listed first */ + if (libnet_smbconf_key_exists(GLOBAL_NAME)) { + werr = libnet_smbconf_add_string_to_array(tmp_ctx, + &tmp_share_names, + 0, GLOBAL_NAME); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + added_count++; + } + werr = libnet_smbconf_reg_open_basepath(tmp_ctx, SEC_RIGHTS_ENUM_SUBKEYS, &key); @@ -453,21 +465,26 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, &subkey_name, NULL)); count++) { + if (strequal(subkey_name, GLOBAL_NAME)) { + continue; + } + werr = libnet_smbconf_add_string_to_array(tmp_ctx, &tmp_share_names, - count, subkey_name); + added_count, + subkey_name); if (!W_ERROR_IS_OK(werr)) { goto done; } + added_count++; } if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { goto done; } - werr = WERR_OK; - *num_shares = count - 1; - if (count > 0) { + *num_shares = added_count; + if (added_count > 0) { *share_names = talloc_move(mem_ctx, &tmp_share_names); } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 651948c07c..8791d7cbdd 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -475,7 +475,7 @@ static int net_conf_listshares(int argc, const char **argv) goto done; } - for (count = 0; count <= num_shares; count++) + for (count = 0; count < num_shares; count++) { d_printf("%s\n", share_names[count]); } -- cgit From a6d6fbb73d56d3b96ccf55c1d028c5af00d83386 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 17:02:27 +0100 Subject: Dont return count - 1 but count from libnet_smbconf_reg_get_values(). Michael (This used to be commit ded60dec7d75db7df485a159fb6bf628d8e24805) --- source3/libnet/libnet_conf.c | 2 +- source3/utils/net_conf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 636e966a37..300ea916cd 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -354,7 +354,7 @@ static WERROR libnet_smbconf_reg_get_values(TALLOC_CTX *mem_ctx, werr = WERR_OK; - *num_values = count - 1; + *num_values = count; if (count > 0) { *value_names = talloc_move(mem_ctx, &tmp_valnames); *value_strings = talloc_move(mem_ctx, &tmp_valstrings); diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 8791d7cbdd..8957408bd6 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -541,7 +541,7 @@ static int net_conf_showshare(int argc, const char **argv) d_printf("[%s]\n", sharename); - for (count = 0; count <= num_params; count++) { + for (count = 0; count < num_params; count++) { d_printf("\t%s = %s\n", param_names[count], param_values[count]); } -- cgit From 397b4d5397e87fa60e35ac1f36facf2411ebc126 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 17:06:49 +0100 Subject: Return NULL (instead of unchanged) for no shares/parameters defined. Michael (This used to be commit bfe3d1462f52d2849611fc58ad70fa08b4917077) --- source3/libnet/libnet_conf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 300ea916cd..3f5265a452 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -358,6 +358,9 @@ static WERROR libnet_smbconf_reg_get_values(TALLOC_CTX *mem_ctx, if (count > 0) { *value_names = talloc_move(mem_ctx, &tmp_valnames); *value_strings = talloc_move(mem_ctx, &tmp_valstrings); + } else { + *value_names = NULL; + *value_strings = NULL; } done: @@ -486,6 +489,8 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, *num_shares = added_count; if (added_count > 0) { *share_names = talloc_move(mem_ctx, &tmp_share_names); + } else { + *share_names = NULL; } done: -- cgit From a60867b67e53d8a0f08de402e160478efc089a72 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Dec 2007 20:00:13 +0100 Subject: Apply some const (This used to be commit 241b72141e3d9e31e30977517f871a97d74bbf7d) --- source3/smbd/vfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index fefae38932..ed0406211d 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -31,7 +31,7 @@ static_decl_vfs; struct vfs_init_function_entry { char *name; - vfs_op_tuple *vfs_op_tuples; + const vfs_op_tuple *vfs_op_tuples; struct vfs_init_function_entry *prev, *next; }; @@ -55,7 +55,7 @@ static struct vfs_init_function_entry *vfs_find_backend_entry(const char *name) return NULL; } -NTSTATUS smb_register_vfs(int version, const char *name, vfs_op_tuple *vfs_op_tuples) +NTSTATUS smb_register_vfs(int version, const char *name, const vfs_op_tuple *vfs_op_tuples) { struct vfs_init_function_entry *entry = backends; @@ -110,13 +110,13 @@ static inline void vfs_set_operation(struct vfs_ops * vfs, vfs_op_type which, bool vfs_init_custom(connection_struct *conn, const char *vfs_object) { - vfs_op_tuple *ops; + const vfs_op_tuple *ops; char *module_path = NULL; char *module_name = NULL; char *module_param = NULL, *p; int i; vfs_handle_struct *handle; - struct vfs_init_function_entry *entry; + const struct vfs_init_function_entry *entry; if (!conn||!vfs_object||!vfs_object[0]) { DEBUG(0,("vfs_init_custon() called with NULL pointer or emtpy vfs_object!\n")); -- cgit From 99bd615a80e8f983d386e260e747db102ec38cf3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 29 Dec 2007 21:41:23 +0100 Subject: Fix a panic get_root_nt_token asks for "struct nt_user_token". talloc_get_type is not smart enough to see that this is the same as NT_USER_TOKEN... :-) (This used to be commit 22a98bf7b81fb89dce1f32ef65cfe6caaba985b3) --- source3/auth/token_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c index a1b4edfb7a..9ca5216af0 100644 --- a/source3/auth/token_util.c +++ b/source3/auth/token_util.c @@ -296,7 +296,7 @@ struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx, DEBUG(10, ("Create local NT token for %s\n", sid_string_dbg(user_sid))); - if (!(result = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN))) { + if (!(result = TALLOC_ZERO_P(mem_ctx, struct nt_user_token))) { DEBUG(0, ("talloc failed\n")); return NULL; } -- cgit From a59280792cab616f5b269960ab68bc44ccc1fd38 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 29 Dec 2007 22:16:31 +0100 Subject: Remove tiny code duplication sid_size did the same as ndr_size_dom_sid (This used to be commit 8aec5d09ba023413bd8ecbdfbc7d23904df94389) --- source3/lib/secace.c | 4 ++-- source3/lib/secdesc.c | 8 ++++---- source3/lib/util_sid.c | 18 +++--------------- source3/libsmb/cliquota.c | 4 ++-- source3/rpc_parse/parse_sec.c | 4 ++-- source3/smbd/nttrans.c | 3 ++- source3/smbd/trans2.c | 8 ++++---- source3/winbindd/winbindd_cm.c | 11 +++++++---- 8 files changed, 26 insertions(+), 34 deletions(-) diff --git a/source3/lib/secace.c b/source3/lib/secace.c index 90ecc342cd..8760a6109a 100644 --- a/source3/lib/secace.c +++ b/source3/lib/secace.c @@ -59,7 +59,7 @@ void init_sec_ace(SEC_ACE *t, const DOM_SID *sid, enum security_ace_type type, { t->type = type; t->flags = flag; - t->size = sid_size(sid) + 8; + t->size = ndr_size_dom_sid(sid, 0) + 8; t->access_mask = mask; ZERO_STRUCTP(&t->trustee); @@ -86,7 +86,7 @@ NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **pp_new, SEC_ACE *old, unsign (*pp_new)[i].type = SEC_ACE_TYPE_ACCESS_ALLOWED; (*pp_new)[i].flags = 0; - (*pp_new)[i].size = SEC_ACE_HEADER_SIZE + sid_size(sid); + (*pp_new)[i].size = SEC_ACE_HEADER_SIZE + ndr_size_dom_sid(sid, 0); (*pp_new)[i].access_mask = mask; sid_copy(&(*pp_new)[i].trustee, sid); return NT_STATUS_OK; diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c index 123c3bcc9b..883fac57e4 100644 --- a/source3/lib/secdesc.c +++ b/source3/lib/secdesc.c @@ -46,10 +46,10 @@ size_t sec_desc_size(SEC_DESC *psd) /* don't align */ if (psd->owner_sid != NULL) - offset += sid_size(psd->owner_sid); + offset += ndr_size_dom_sid(psd->owner_sid, 0); if (psd->group_sid != NULL) - offset += sid_size(psd->group_sid); + offset += ndr_size_dom_sid(psd->group_sid, 0); if (psd->sacl != NULL) offset += psd->sacl->size; @@ -235,11 +235,11 @@ SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, } if (dst->owner_sid != NULL) { - offset += sid_size(dst->owner_sid); + offset += ndr_size_dom_sid(dst->owner_sid, 0); } if (dst->group_sid != NULL) { - offset += sid_size(dst->group_sid); + offset += ndr_size_dom_sid(dst->group_sid, 0); } *sd_size = (size_t)offset; diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index 52f65aa77d..222b32ed3a 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -382,7 +382,7 @@ bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid) { size_t i; - if (len < sid_size(sid)) + if (len < ndr_size_dom_sid(sid, 0)) return False; SCVAL(outbuf,0,sid->sid_rev_num); @@ -494,18 +494,6 @@ bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2) return sid_compare(sid1, sid2) == 0; } -/***************************************************************** - Calculates size of a sid. -*****************************************************************/ - -size_t sid_size(const DOM_SID *sid) -{ - if (sid == NULL) - return 0; - - return sid->num_auths * sizeof(uint32) + 8; -} - /***************************************************************** Returns true if SID is internal (and non-mappable). *****************************************************************/ @@ -535,7 +523,7 @@ bool non_mappable_sid(DOM_SID *sid) char *sid_binstring(const DOM_SID *sid) { char *buf, *s; - int len = sid_size(sid); + int len = ndr_size_dom_sid(sid, 0); buf = (char *)SMB_MALLOC(len); if (!buf) return NULL; @@ -553,7 +541,7 @@ char *sid_binstring(const DOM_SID *sid) char *sid_binstring_hex(const DOM_SID *sid) { char *buf, *s; - int len = sid_size(sid); + int len = ndr_size_dom_sid(sid, 0); buf = (char *)SMB_MALLOC(len); if (!buf) return NULL; diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c index 206576f040..f369d28dff 100644 --- a/source3/libsmb/cliquota.c +++ b/source3/libsmb/cliquota.c @@ -150,7 +150,7 @@ bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC SIVAL(params, 8,0x00000000); SIVAL(params,12,0x00000024); - sid_len = sid_size(&pqt->sid); + sid_len = ndr_size_dom_sid(&pqt->sid, 0); data_len = sid_len+8; SIVAL(data, 0, 0x00000000); SIVAL(data, 4, sid_len); @@ -213,7 +213,7 @@ bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC SSVAL(params,0,quota_fnum); - sid_len = sid_size(&pqt->sid); + sid_len = ndr_size_dom_sid(&pqt->sid, 0); SIVAL(data,0,0); SIVAL(data,4,sid_len); SBIG_UINT(data, 8,(SMB_BIG_UINT)0); diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 6198a78de0..36bd5825bd 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -291,14 +291,14 @@ bool sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth) if (psd->owner_sid != NULL) { off_owner_sid = offset; - offset += sid_size(psd->owner_sid); + offset += ndr_size_dom_sid(psd->owner_sid, 0); } else { off_owner_sid = 0; } if (psd->group_sid != NULL) { off_grp_sid = offset; - offset += sid_size(psd->group_sid); + offset += ndr_size_dom_sid(psd->group_sid, 0); } else { off_grp_sid = 0; } diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index cb98a8139c..eb29e65935 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -2174,7 +2174,8 @@ static void call_nt_transact_get_user_quota(connection_struct *conn, for (;((tmp_list!=NULL)&&((qt_len +40+SID_MAX_SIZE)next,entry+=entry_len,qt_len+=entry_len) { - sid_len = sid_size(&tmp_list->quotas->sid); + sid_len = ndr_size_dom_sid( + &tmp_list->quotas->sid, 0); entry_len = 40 + sid_len; /* nextoffset entry 4 bytes */ diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index b1f57a9b3e..21bde12056 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2897,8 +2897,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned */ for (i = 0, sid_bytes = 0; i < current_user.nt_user_token->num_sids; ++i) { - sid_bytes += - sid_size(¤t_user.nt_user_token->user_sids[i]); + sid_bytes += ndr_size_dom_sid( + ¤t_user.nt_user_token->user_sids[i], 0); } /* SID list byte count */ @@ -2918,8 +2918,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned /* SID list */ for (i = 0; i < current_user.nt_user_token->num_sids; ++i) { - int sid_len = - sid_size(¤t_user.nt_user_token->user_sids[i]); + int sid_len = ndr_size_dom_sid( + ¤t_user.nt_user_token->user_sids[i], 0); sid_linearize(pdata + data_len, sid_len, ¤t_user.nt_user_token->user_sids[i]); diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 7fb42a6dca..6a4f531c5f 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -978,6 +978,7 @@ static bool send_getdc_request(struct sockaddr_storage *dc_ss, char *p; fstring my_acct_name; fstring my_mailslot; + size_t sid_size; if (dc_ss->ss_family != AF_INET) { return false; @@ -1019,7 +1020,9 @@ static bool send_getdc_request(struct sockaddr_storage *dc_ss, SIVAL(p, 0, 0x80); p+=4; - SIVAL(p, 0, sid_size(sid)); + sid_size = ndr_size_dom_sid(sid, 0); + + SIVAL(p, 0, sid_size); p+=4; p = ALIGN4(p, outbuf); @@ -1027,12 +1030,12 @@ static bool send_getdc_request(struct sockaddr_storage *dc_ss, return false; } - sid_linearize(p, sid_size(sid), sid); - if (sid_size(sid) + 8 > sizeof(outbuf) - PTR_DIFF(p, outbuf)) { + sid_linearize(p, sid_size, sid); + if (sid_size + 8 > sizeof(outbuf) - PTR_DIFF(p, outbuf)) { return false; } - p += sid_size(sid); + p += sid_size; SIVAL(p, 0, 1); SSVAL(p, 4, 0xffff); -- cgit From 240391be5345aef88a25c1221942202ba33588b8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 29 Dec 2007 22:47:03 +0100 Subject: Make use of [un]marshall_sec_desc (This used to be commit 54576733d6c0511dc7379f964b1cb035913b7c8d) --- source3/libads/ldap.c | 20 +++++++++++--------- source3/libsmb/clisecdesc.c | 45 +++++++++++++++++---------------------------- 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 348ccacaee..953693ce48 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -2384,20 +2384,22 @@ int ads_count_replies(ADS_STRUCT *ads, void *res) LDAPMessage *msg, const char *field, SEC_DESC **sd) { struct berval **values; - bool ret = False; + bool ret = true; values = ldap_get_values_len(ads->ldap.ld, msg, field); - if (!values) return False; + if (!values) return false; if (values[0]) { - prs_struct ps; - prs_init(&ps, values[0]->bv_len, mem_ctx, UNMARSHALL); - prs_copy_data_in(&ps, values[0]->bv_val, values[0]->bv_len); - prs_set_offset(&ps,0); - - ret = sec_io_desc("sd", sd, &ps, 1); - prs_mem_free(&ps); + NTSTATUS status; + status = unmarshall_sec_desc(mem_ctx, + (uint8 *)values[0]->bv_val, + values[0]->bv_len, sd); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("unmarshall_sec_desc failed: %s\n", + nt_errstr(status))); + ret = false; + } } ldap_value_free_len(values); diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c index 46a6609415..adc6fba9af 100644 --- a/source3/libsmb/clisecdesc.c +++ b/source3/libsmb/clisecdesc.c @@ -28,9 +28,8 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum, char param[8]; char *rparam=NULL, *rdata=NULL; unsigned int rparam_count=0, rdata_count=0; - prs_struct pd; - bool pd_initialized = False; SEC_DESC *psd = NULL; + NTSTATUS status; SIVAL(param, 0, fnum); SIVAL(param, 4, 0x7); @@ -56,15 +55,12 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum, if (cli_is_error(cli)) goto cleanup; - if (!prs_init(&pd, rdata_count, mem_ctx, UNMARSHALL)) { - goto cleanup; - } - pd_initialized = True; - prs_copy_data_in(&pd, rdata, rdata_count); - prs_set_offset(&pd,0); + status = unmarshall_sec_desc(mem_ctx, (uint8 *)rdata, rdata_count, + &psd); - if (!sec_io_desc("sd data", &psd, &pd, 1)) { - DEBUG(1,("Failed to parse secdesc\n")); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("unmarshall_sec_desc failed: %s\n", + nt_errstr(status))); goto cleanup; } @@ -73,8 +69,6 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum, SAFE_FREE(rparam); SAFE_FREE(rdata); - if (pd_initialized) - prs_mem_free(&pd); return psd; } @@ -87,20 +81,16 @@ bool cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd) char *rparam=NULL, *rdata=NULL; unsigned int rparam_count=0, rdata_count=0; uint32 sec_info = 0; - TALLOC_CTX *mem_ctx; - prs_struct pd; + TALLOC_CTX *frame = talloc_stackframe(); bool ret = False; - - if ((mem_ctx = talloc_init("cli_set_secdesc")) == NULL) { - DEBUG(0,("talloc_init failed.\n")); - goto cleanup; - } - - prs_init(&pd, 0, mem_ctx, MARSHALL); - prs_give_memory(&pd, NULL, 0, True); - - if (!sec_io_desc("sd data", &sd, &pd, 1)) { - DEBUG(1,("Failed to marshall secdesc\n")); + uint8 *data; + size_t len; + NTSTATUS status; + + status = marshall_sec_desc(talloc_tos(), sd, &data, &len); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("marshall_sec_desc failed: %s\n", + nt_errstr(status))); goto cleanup; } @@ -119,7 +109,7 @@ bool cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd) 0, NULL, 0, 0, param, 8, 0, - prs_data_p(&pd), prs_offset(&pd), 0)) { + (char *)data, len, 0)) { DEBUG(1,("Failed to send NT_TRANSACT_SET_SECURITY_DESC\n")); goto cleanup; } @@ -139,8 +129,7 @@ bool cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd) SAFE_FREE(rparam); SAFE_FREE(rdata); - talloc_destroy(mem_ctx); + TALLOC_FREE(frame); - prs_mem_free(&pd); return ret; } -- cgit From 7be5525792a2f4aa19c308afb516ef1fe02b7be2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 29 Dec 2007 22:54:51 +0100 Subject: Make [un]marshall_sec_desc use librpc/ndr (This used to be commit 387936ec3952f88d46df2d4943bbc4e408ad2bb5) --- source3/lib/secdesc.c | 54 +++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c index 883fac57e4..5e5042e521 100644 --- a/source3/lib/secdesc.c +++ b/source3/lib/secdesc.c @@ -274,25 +274,21 @@ NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx, struct security_descriptor *secdesc, uint8 **data, size_t *len) { - prs_struct ps; - - if (!prs_init(&ps, sec_desc_size(secdesc), mem_ctx, MARSHALL)) { - return NT_STATUS_NO_MEMORY; - } + DATA_BLOB blob; + enum ndr_err_code ndr_err; - if (!sec_io_desc("security_descriptor", &secdesc, &ps, 1)) { - prs_mem_free(&ps); - return NT_STATUS_INVALID_PARAMETER; - } + ndr_err = ndr_push_struct_blob( + &blob, mem_ctx, secdesc, + (ndr_push_flags_fn_t)ndr_push_security_descriptor); - if (!(*data = (uint8 *)talloc_memdup(mem_ctx, ps.data_p, - prs_offset(&ps)))) { - prs_mem_free(&ps); - return NT_STATUS_NO_MEMORY; + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + DEBUG(0, ("ndr_push_security_descriptor failed: %s\n", + ndr_errstr(ndr_err))); + return ndr_map_error2ntstatus(ndr_err);; } - *len = prs_offset(&ps); - prs_mem_free(&ps); + *data = blob.data; + *len = blob.length; return NT_STATUS_OK; } @@ -302,25 +298,33 @@ NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx, NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len, struct security_descriptor **psecdesc) { - prs_struct ps; - struct security_descriptor *secdesc = NULL; + DATA_BLOB blob; + enum ndr_err_code ndr_err; + struct security_descriptor *result; - if (!(secdesc = TALLOC_ZERO_P(mem_ctx, struct security_descriptor))) { - return NT_STATUS_NO_MEMORY; + if ((data == NULL) || (len == 0)) { + return NT_STATUS_INVALID_PARAMETER; } - if (!prs_init(&ps, 0, secdesc, UNMARSHALL)) { + result = TALLOC_ZERO_P(mem_ctx, struct security_descriptor); + if (result == NULL) { return NT_STATUS_NO_MEMORY; } - prs_give_memory(&ps, (char *)data, len, False); + blob = data_blob_const(data, len); - if (!sec_io_desc("security_descriptor", &secdesc, &ps, 1)) { - return NT_STATUS_INVALID_PARAMETER; + ndr_err = ndr_pull_struct_blob( + &blob, result, result, + (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); + + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + DEBUG(0, ("ndr_pull_security_descriptor failed: %s\n", + ndr_errstr(ndr_err))); + TALLOC_FREE(result); + return ndr_map_error2ntstatus(ndr_err);; } - prs_mem_free(&ps); - *psecdesc = secdesc; + *psecdesc = result; return NT_STATUS_OK; } -- cgit From 7cbdb48475b0340154fad60cb4b7cc53dc2bbcfd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 29 Dec 2007 23:00:49 +0100 Subject: Remove tiny code duplication ndr_size_security_descriptor does the same as sec_desc_size (This used to be commit bc3bd7a8e7c6e9e27acb195c86abb92c0f53112f) --- source3/lib/secdesc.c | 29 ----------------------------- source3/lib/sharesec.c | 2 +- source3/modules/nfs4_acls.c | 2 +- source3/printing/nt_printing.c | 10 ++++++---- source3/registry/reg_api.c | 2 +- source3/registry/regfio.c | 5 +++-- source3/rpc_parse/parse_buffer.c | 2 +- source3/rpc_parse/parse_sec.c | 2 +- source3/rpc_parse/parse_spoolss.c | 4 ++-- source3/rpc_parse/parse_srv.c | 5 +++-- source3/rpc_server/srv_srvsvc_nt.c | 2 +- source3/rpc_server/srv_svcctl_nt.c | 2 +- source3/smbd/nttrans.c | 2 +- 13 files changed, 22 insertions(+), 47 deletions(-) diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c index 5e5042e521..44ae23271e 100644 --- a/source3/lib/secdesc.c +++ b/source3/lib/secdesc.c @@ -31,35 +31,6 @@ const struct generic_mapping file_generic_mapping = { FILE_GENERIC_ALL }; -/******************************************************************* - Works out the linearization size of a SEC_DESC. -********************************************************************/ - -size_t sec_desc_size(SEC_DESC *psd) -{ - size_t offset; - - if (!psd) return 0; - - offset = SEC_DESC_HEADER_SIZE; - - /* don't align */ - - if (psd->owner_sid != NULL) - offset += ndr_size_dom_sid(psd->owner_sid, 0); - - if (psd->group_sid != NULL) - offset += ndr_size_dom_sid(psd->group_sid, 0); - - if (psd->sacl != NULL) - offset += psd->sacl->size; - - if (psd->dacl != NULL) - offset += psd->dacl->size; - - return offset; -} - /******************************************************************* Compares two SEC_DESC structures ********************************************************************/ diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index 0027a8813a..ba025dacc1 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -144,7 +144,7 @@ SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename, } if (psd) - *psize = sec_desc_size(psd); + *psize = ndr_size_security_descriptor(psd, 0); return psd; } diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index 70bb6a02e8..6d2972d8ed 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -309,7 +309,7 @@ static NTSTATUS smb_get_nt_acl_nfs4_common(const SMB_STRUCT_STAT *sbuf, } DEBUG(10, ("smb_get_nt_acl_nfs4_common successfully exited with sd_size %d\n", - sec_desc_size(*ppdesc))); + ndr_size_security_descriptor(*ppdesc, 0))); return NT_STATUS_OK; } diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index f83f898cc0..f115fba91f 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -429,7 +429,8 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key, /* store it back */ - sd_size = sec_desc_size(sd_store->sd) + sizeof(SEC_DESC_BUF); + sd_size = ndr_size_security_descriptor(sd_store->sd, 0) + + sizeof(SEC_DESC_BUF); prs_init(&ps, sd_size, ctx, MARSHALL); if ( !sec_io_desc_buf( "sec_desc_upg_fn", &sd_store, &ps, 1 ) ) { @@ -5389,8 +5390,9 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) /* Store the security descriptor in a tdb */ - prs_init(&ps, (uint32)sec_desc_size(new_secdesc_ctr->sd) + - sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL); + prs_init(&ps, + (uint32)ndr_size_security_descriptor(new_secdesc_ctr->sd, 0) + + sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL); if (!sec_io_desc_buf("nt_printing_setsec", &new_secdesc_ctr, &ps, 1)) { @@ -5534,7 +5536,7 @@ bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **s /* Save default security descriptor for later */ - prs_init(&ps, (uint32)sec_desc_size((*secdesc_ctr)->sd) + + prs_init(&ps, (uint32)ndr_size_security_descriptor((*secdesc_ctr)->sd, 0) + sizeof(SEC_DESC_BUF), ctx, MARSHALL); if (sec_io_desc_buf("nt_printing_getsec", secdesc_ctr, &ps, 1)) { diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index b3d024d7b4..bc4508ff94 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -378,7 +378,7 @@ WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys, return err; } - *secdescsize = sec_desc_size(secdesc); + *secdescsize = ndr_size_security_descriptor(secdesc, 0); TALLOC_FREE(mem_ctx); *last_changed_time = 0; diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c index 22700e6481..92077aa847 100644 --- a/source3/registry/regfio.c +++ b/source3/registry/regfio.c @@ -1554,7 +1554,7 @@ static uint32 sk_record_data_size( SEC_DESC * sd ) /* the record size is sizeof(hdr) + name + static members + data_size_field */ - size = sizeof(uint32)*5 + sec_desc_size( sd ) + sizeof(uint32); + size = sizeof(uint32)*5 + ndr_size_security_descriptor(sd, 0) + sizeof(uint32); /* multiple of 8 */ size_mod8 = size & 0xfffffff8; @@ -1784,7 +1784,8 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) nk->sec_desc->ref_count = 0; /* size value must be self-inclusive */ - nk->sec_desc->size = sec_desc_size(sec_desc) + sizeof(uint32); + nk->sec_desc->size = ndr_size_security_descriptor(sec_desc, 0) + + sizeof(uint32); DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, REGF_SK_REC *); diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index c30ad487dd..e98822d46e 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -435,7 +435,7 @@ bool smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC } if (*secdesc != NULL) { - buffer->string_at_end -= sec_desc_size(*secdesc); + buffer->string_at_end -= ndr_size_security_descriptor(*secdesc, 0); if(!prs_set_offset(ps, buffer->string_at_end)) return False; diff --git a/source3/rpc_parse/parse_sec.c b/source3/rpc_parse/parse_sec.c index 36bd5825bd..6ea128d3a4 100644 --- a/source3/rpc_parse/parse_sec.c +++ b/source3/rpc_parse/parse_sec.c @@ -426,7 +426,7 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int if(!prs_uint32 ("ptr ", ps, depth, &ptr)) return False; - len = sec_desc_size(psdb->sd); + len = ndr_size_security_descriptor(psdb->sd, 0); if(!prs_uint32_pre("len ", ps, depth, &len, &off_len)) return False; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index ea76c57045..3bf8ef27c1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -3098,7 +3098,7 @@ uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info) size += 4; - size += sec_desc_size( info->secdesc ); + size += ndr_size_security_descriptor( info->secdesc, 0 ); size+=size_of_device_mode( info->devmode ); @@ -3185,7 +3185,7 @@ return the size required by a struct in the stream uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info) { /* The 8 is for the self relative pointer - 8 byte aligned.. */ - return 8 + (uint32)sec_desc_size( info->secdesc ); + return 8 + (uint32)ndr_size_security_descriptor( info->secdesc, 0 ); } /******************************************************************* diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 6337c53fc1..954aa80600 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -507,7 +507,8 @@ static bool srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, p if(UNMARSHALLING(ps)) { - sh502->ptrs->sd_size = sh502->sd_size = sec_desc_size(sh502->sd); + sh502->ptrs->sd_size = sh502->sd_size = + ndr_size_security_descriptor(sh502->sd, 0); prs_set_offset(ps, old_offset + sh502->reserved); } @@ -1460,7 +1461,7 @@ void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, { switch(level) { case 502: { - size_t sd_size = sec_desc_size(sd); + size_t sd_size = ndr_size_security_descriptor(sd, 0); q->ptr_srv_name = 1; init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); q->info.switch_value = q->info_level = level; diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 842a28c776..01e5cf2cda 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -2159,7 +2159,7 @@ WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC goto error_exit; } - sd_size = sec_desc_size(psd); + sd_size = ndr_size_security_descriptor(psd, 0); r_u->ptr_response = 1; r_u->size_response = sd_size; diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c index 3f5cf03abb..ac45d8bf75 100644 --- a/source3/rpc_server/srv_svcctl_nt.c +++ b/source3/rpc_server/srv_svcctl_nt.c @@ -813,7 +813,7 @@ WERROR _svcctl_query_service_sec( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_SEC *q if ( !(sec_desc = svcctl_get_secdesc( p->mem_ctx, info->name, get_root_nt_token() )) ) return WERR_NOMEM; - r_u->needed = sec_desc_size( sec_desc ); + r_u->needed = ndr_size_security_descriptor( sec_desc, 0 ); if ( r_u->needed > q_u->buffer_size ) { ZERO_STRUCTP( &r_u->buffer ); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index eb29e65935..69772b6bec 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -1650,7 +1650,7 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, return; } - sd_size = sec_desc_size(psd); + sd_size = ndr_size_security_descriptor(psd, 0); DEBUG(3,("call_nt_transact_query_security_desc: sd_size = %lu.\n",(unsigned long)sd_size)); -- cgit From f10074e84b41d141958912c3fb9f2c6fdbba68b3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 29 Dec 2007 14:43:32 -0800 Subject: Use correct size value for linearize call. Jeremy. (This used to be commit a5df44f5b7887d10c1e1a0b7a3dd05bcf31015e1) --- source3/winbindd/winbindd_cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 6a4f531c5f..33674d2cf7 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -1030,10 +1030,10 @@ static bool send_getdc_request(struct sockaddr_storage *dc_ss, return false; } - sid_linearize(p, sid_size, sid); if (sid_size + 8 > sizeof(outbuf) - PTR_DIFF(p, outbuf)) { return false; } + sid_linearize(p, sizeof(outbuf) - PTR_DIFF(p, outbuf), sid); p += sid_size; -- cgit From df93c1aa57c33f188548fc3de6719170c472b5eb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 21:59:28 +0100 Subject: Include libnet/libnet.h in libnet_conf.c to have prototypes available. Michael (This used to be commit 4842438c396b93007fc4f4dded437567e562a2dc) --- source3/libnet/libnet_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 3f5265a452..6d0e65e932 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "libnet/libnet.h" /********************************************************************** * -- cgit From fe47e2e85585c1f7f9455747f1ef5d4c20501960 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 22:08:11 +0100 Subject: Add a function libnet_smbconf_get_config() to libnet_conf.c This gets the whole config as a set of lists (of share names and corresponding lists of parameter names and values). The function is an aggregate of libnet_smbconf_get_share_names() and libnet_smbconf_getshare(). Michael (This used to be commit 94e97a72548a7f76a5273346d472e3ba5b24795a) --- source3/libnet/libnet_conf.c | 84 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 6d0e65e932..642b6880ec 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -421,6 +421,90 @@ done: return werr; } +/** + * Get the whole configuration as lists of strings with counts: + * + * num_shares : number of shares + * share_names : list of length num_shares of share names + * num_params : list of length num_shares of parameter counts for each share + * param_names : list of lists of parameter names for each share + * param_values : list of lists of parameter values for each share + */ +WERROR libnet_smbconf_get_config(TALLOC_CTX *mem_ctx, uint32_t *num_shares, + char ***share_names, uint32_t **num_params, + char ****param_names, char ****param_values) +{ + WERROR werr = WERR_OK; + TALLOC_CTX *tmp_ctx = NULL; + uint32_t tmp_num_shares; + char **tmp_share_names; + uint32_t *tmp_num_params; + char ***tmp_param_names; + char ***tmp_param_values; + uint32_t count; + + if ((num_shares == NULL) || (share_names == NULL) || + (num_params == NULL) || (param_names == NULL) || + (param_values == NULL)) + { + werr = WERR_INVALID_PARAM; + goto done; + } + + tmp_ctx = talloc_new(mem_ctx); + if (tmp_ctx == NULL) { + werr = WERR_NOMEM; + goto done; + } + + werr = libnet_smbconf_get_share_names(tmp_ctx, &tmp_num_shares, + &tmp_share_names); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + tmp_num_params = TALLOC_ARRAY(tmp_ctx, uint32_t, tmp_num_shares); + tmp_param_names = TALLOC_ARRAY(tmp_ctx, char **, tmp_num_shares); + tmp_param_values = TALLOC_ARRAY(tmp_ctx, char **, tmp_num_shares); + + if ((tmp_num_params == NULL) || (tmp_param_names == NULL) || + (tmp_param_values == NULL)) + { + werr = WERR_NOMEM; + goto done; + } + + for (count = 0; count < tmp_num_shares; count++) { + werr = libnet_smbconf_getshare(mem_ctx, tmp_share_names[count], + &tmp_num_params[count], + &tmp_param_names[count], + &tmp_param_values[count]); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + } + + werr = WERR_OK; + + *num_shares = tmp_num_shares; + if (tmp_num_shares > 0) { + *share_names = talloc_move(mem_ctx, &tmp_share_names); + *num_params = talloc_move(mem_ctx, &tmp_num_params); + *param_names = talloc_move(mem_ctx, &tmp_param_names); + *param_values = talloc_move(mem_ctx, &tmp_param_values); + } else { + *share_names = NULL; + *num_params = NULL; + *param_names = NULL; + *param_values = NULL; + } + +done: + TALLOC_FREE(tmp_ctx); + return werr; +} + + /** * get the list of share names defined in the configuration. */ -- cgit From 9c1449594458ad6f019f48072bba2b1c831b628b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 22:09:51 +0100 Subject: Use libnet_smbconf_get_config() in net_conf_list(). This leaves only output logic in net_conf_list(). Michael (This used to be commit 95d9981d59fe69ee1ed98f21475bd1ba72930c1b) --- source3/utils/net_conf.c | 64 ++++++++++++++---------------------------------- 1 file changed, 19 insertions(+), 45 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 8957408bd6..ed9ed389e4 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -301,10 +301,12 @@ static int net_conf_list(int argc, const char **argv) WERROR werr = WERR_OK; int ret = -1; TALLOC_CTX *ctx; - struct registry_key *base_key = NULL; - struct registry_key *sub_key = NULL; - uint32 idx_key = 0; - char *subkey_name = NULL; + uint32_t num_shares; + char **share_names; + uint32_t *num_params; + char ***param_names; + char ***param_values; + uint32_t share_count, param_count; ctx = talloc_init("list"); @@ -313,54 +315,26 @@ static int net_conf_list(int argc, const char **argv) goto done; } - werr = libnet_smbconf_reg_open_basepath(ctx, REG_KEY_READ, &base_key); + werr = libnet_smbconf_get_config(ctx, &num_shares, &share_names, + &num_params, ¶m_names, + ¶m_values); if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error getting config: %s\n", + dos_errstr(werr)); goto done; } - if (libnet_smbconf_key_exists(GLOBAL_NAME)) { - werr = reg_openkey(ctx, base_key, GLOBAL_NAME, - REG_KEY_READ, &sub_key); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error opening subkey '%s' : %s\n", - subkey_name, dos_errstr(werr)); - goto done; - } - d_printf("[%s]\n", GLOBAL_NAME); - if (!W_ERROR_IS_OK(list_values(ctx, sub_key))) { - goto done; - } - d_printf("\n"); - } - - for (idx_key = 0; - W_ERROR_IS_OK(werr = reg_enumkey(ctx, base_key, idx_key, - &subkey_name, NULL)); - idx_key++) - { - if (strequal(subkey_name, GLOBAL_NAME)) { - continue; - } - d_printf("[%s]\n", subkey_name); - - werr = reg_openkey(ctx, base_key, subkey_name, - REG_KEY_READ, &sub_key); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, - "Error opening subkey '%s': %s\n", - subkey_name, dos_errstr(werr)); - goto done; - } - if (!W_ERROR_IS_OK(list_values(ctx, sub_key))) { - goto done; + for (share_count = 0; share_count < num_shares; share_count++) { + d_printf("[%s]\n", share_names[share_count]); + for (param_count = 0; param_count < num_params[share_count]; + param_count++) + { + d_printf("\t%s = %s\n", + param_names[share_count][param_count], + param_values[share_count][param_count]); } d_printf("\n"); } - if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { - d_fprintf(stderr, "Error enumerating subkeys: %s\n", - dos_errstr(werr)); - goto done; - } ret = 0; -- cgit From 59128c783761c6f823971e7aa9513834a7be4b7d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 22:11:09 +0100 Subject: Remove list_values() from net_conf.c - it is not needed any more. Also make libnet.c:libnet_smbconf_format_registry_value() static. (There are nor more external callers.) Michael (This used to be commit ac7baa17e89d2363b5b3db85de9c842b596dea25) --- source3/libnet/libnet_conf.c | 4 ++-- source3/utils/net_conf.c | 26 -------------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 642b6880ec..3c04c1333f 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -257,8 +257,8 @@ done: * which are ar stored as REG_SZ values, so the incomplete * handling should be ok. */ -char *libnet_smbconf_format_registry_value(TALLOC_CTX *mem_ctx, - struct registry_value *value) +static char *libnet_smbconf_format_registry_value(TALLOC_CTX *mem_ctx, + struct registry_value *value) { char *result = NULL; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index ed9ed389e4..29bbc83ec3 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -110,32 +110,6 @@ static int net_conf_delparm_usage(int argc, const char **argv) * Helper functions */ -static WERROR list_values(TALLOC_CTX *ctx, struct registry_key *key) -{ - WERROR werr = WERR_OK; - uint32 idx = 0; - struct registry_value *valvalue = NULL; - char *valname = NULL; - - for (idx = 0; - W_ERROR_IS_OK(werr = reg_enumvalue(ctx, key, idx, &valname, - &valvalue)); - idx++) - { - d_printf("\t%s = %s\n", valname, - libnet_smbconf_format_registry_value(ctx, valvalue)); - } - if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { - d_fprintf(stderr, "Error enumerating values: %s\n", - dos_errstr(werr)); - goto done; - } - werr = WERR_OK; - -done: - return werr; -} - static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm, struct share_params *share) { -- cgit From 1f992517ec67be36b03decefcac03ba71eec8705 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 22:29:00 +0100 Subject: Make libnet_smbconf_reg_open_basepath() static. Michael (This used to be commit 8e87dd79ba4e3aeceb26c7b4e131053172f077cd) --- source3/libnet/libnet_conf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 3c04c1333f..099754cbf4 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -94,8 +94,9 @@ done: /* * open the base key KEY_SMBCONF */ -WERROR libnet_smbconf_reg_open_basepath(TALLOC_CTX *ctx, uint32 desired_access, - struct registry_key **key) +static WERROR libnet_smbconf_reg_open_basepath(TALLOC_CTX *ctx, + uint32 desired_access, + struct registry_key **key) { return libnet_smbconf_reg_open_path(ctx, NULL, desired_access, key); } -- cgit From d674b95357b34a89b915af68fa12aa6b4169198d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 22:29:33 +0100 Subject: Make libnet_smbconf_reg_open_path() static. Michael (This used to be commit 6447bae71c99407485307dd508603c73d5bb9823) --- source3/libnet/libnet_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 099754cbf4..1069abcfbd 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -58,10 +58,10 @@ static WERROR libnet_smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, /* * Open a subkey of KEY_SMBCONF (i.e a service) */ -WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *ctx, - const char *subkeyname, - uint32 desired_access, - struct registry_key **key) +static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *ctx, + const char *subkeyname, + uint32 desired_access, + struct registry_key **key) { WERROR werr = WERR_OK; char *path = NULL; -- cgit From df450fc090071b3645ecede5d15685e68e209d99 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 30 Dec 2007 03:12:11 +0100 Subject: Make pdb_tdb honour a private dir overridden in smb.conf. One lp_private_dir() has to be used instead of get_dyn_PRIVATE_DIR() to determine the location of the passdb.tdb. I noticed this when running make test as a "normal user" from a build, where I had done "make install" as root before, and so the passdb.tdb could not be accessed during the startup phase "CREATE TEST ENVIRONMENT IN ./st ..." in selftest.sh. Michael (This used to be commit 1f96389afa7250af7393489fb538b8aed93d815c) --- source3/passdb/pdb_tdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 5e21c46abf..5ee1cdc0c0 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -1613,7 +1613,7 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc /* save the path for later */ if (!location) { - if (asprintf(&tdbfile, "%s/%s", get_dyn_PRIVATE_DIR(), + if (asprintf(&tdbfile, "%s/%s", lp_private_dir(), PASSDB_FILE_NAME) < 0) { return NT_STATUS_NO_MEMORY; } -- cgit From bd3521457ce9d899d42fdea32993a42c906070c7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 29 Dec 2007 22:36:49 -0800 Subject: Allow encryption context setup on IPC$. Jeremy. (This used to be commit 5d424cb3060af89bde50bc7fe2989e3c1b8e91b2) --- source3/smbd/trans2.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 21bde12056..656925502b 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2430,7 +2430,8 @@ static void call_trans2qfsinfo(connection_struct *conn, info_level = SVAL(params,0); - if (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF ) { + if (IS_IPC(conn) || + (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF )) { if (info_level != SMB_QUERY_CIFS_UNIX_INFO) { DEBUG(0,("call_trans2qfsinfo: encryption required " "and info level 0x%x sent.\n", @@ -2981,6 +2982,17 @@ static void call_trans2setfsinfo(connection_struct *conn, info_level = SVAL(params,2); + if (IS_IPC(conn)) { + if (info_level != SMB_REQUEST_TRANSPORT_ENCRYPTION && + info_level != SMB_SET_CIFS_UNIX_INFO) { + DEBUG(0,("call_trans2setfsinfo: not an allowed " + "info level (0x%x) on IPC$.\n", + (unsigned int)info_level)); + reply_nterror(req, NT_STATUS_ACCESS_DENIED); + return; + } + } + if (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF ) { if (info_level != SMB_REQUEST_TRANSPORT_ENCRYPTION) { DEBUG(0,("call_trans2setfsinfo: encryption required " @@ -7276,12 +7288,20 @@ void reply_trans2(connection_struct *conn, struct smb_request *req) return; } - if (IS_IPC(conn) && (tran_call != TRANSACT2_OPEN) - && (tran_call != TRANSACT2_GET_DFS_REFERRAL) - && (tran_call != TRANSACT2_QFILEINFO)) { - reply_doserror(req, ERRSRV, ERRaccess); - END_PROFILE(SMBtrans2); - return; + if (IS_IPC(conn)) { + switch (tran_call) { + /* List the allowed trans2 calls on IPC$ */ + case TRANSACT2_OPEN: + case TRANSACT2_GET_DFS_REFERRAL: + case TRANSACT2_QFILEINFO: + case TRANSACT2_QFSINFO: + case TRANSACT2_SETFSINFO: + break; + default: + reply_doserror(req, ERRSRV, ERRaccess); + END_PROFILE(SMBtrans2); + return; + } } if ((state = TALLOC_P(conn->mem_ctx, struct trans_state)) == NULL) { -- cgit From 6d9b2439d2d0459cbd2e74581c15f4b39d05ce5d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 29 Dec 2007 22:39:52 -0800 Subject: Added -e, --encrypt option to smbclient that immediately forces encrypted smb after initial connect. Will document for 3.2 official release. Jeremy. (This used to be commit f02bf419282419950471deae74c4a6fe1543ed26) --- source3/client/client.c | 45 ++++++++++++++---- source3/libsmb/clidfs.c | 121 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 145 insertions(+), 21 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 53669bc8d0..3d529981e5 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -93,6 +93,9 @@ static unsigned int put_total_time_ms = 0; /* totals globals */ static double dir_total; +/* encrypted state. */ +static bool smb_encrypt; + /* root cli_state connection */ struct cli_state *cli; @@ -2215,6 +2218,7 @@ static int cmd_posix_encrypt(void) d_printf("posix_encrypt failed with error %s\n", nt_errstr(status)); } else { d_printf("encryption on\n"); + smb_encrypt = true; } return 0; @@ -3786,16 +3790,28 @@ int cmd_iosize(void) int iosize; if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) { - d_printf("iosize or iosize 0x. " - "Minimum is 16384 (0x4000), " - "max is 16776960 (0xFFFF00)\n"); + if (!smb_encrypt) { + d_printf("iosize or iosize 0x. " + "Minimum is 16384 (0x4000), " + "max is 16776960 (0xFFFF00)\n"); + } else { + d_printf("iosize or iosize 0x. " + "(Encrypted connection) ," + "Minimum is 16384 (0x4000), " + "max is 64512 (0xFC00)\n"); + } return 1; } iosize = strtol(buf,NULL,0); - if (iosize < 0 || iosize > 0xFFFF00) { + if (smb_encrypt && (iosize < 0x4000 || iosize > 0xFC00)) { + d_printf("iosize out of range for encrypted " + "connection (min = 16384 (0x4000), " + "max = 16776960 (0xFC00)"); + return 1; + } else if (!smb_encrypt && (iosize < 0x4000 || iosize > 0xFFFF00)) { d_printf("iosize out of range (min = 16384 (0x4000), " - "max = 16776960 (0x0xFFFF00)"); + "max = 16776960 (0xFFFF00)"); return 1; } @@ -3971,7 +3987,8 @@ static int process_command_string(const char *cmd_in) /* establish the connection if not already */ if (!cli) { - cli = cli_cm_open(talloc_tos(), NULL, desthost, service, true); + cli = cli_cm_open(talloc_tos(), NULL, desthost, + service, true, smb_encrypt); if (!cli) { return 1; } @@ -4396,7 +4413,8 @@ static int process(const char *base_directory) { int rc = 0; - cli = cli_cm_open(talloc_tos(), NULL, desthost, service, true); + cli = cli_cm_open(talloc_tos(), NULL, + desthost, service, true, smb_encrypt); if (!cli) { return 1; } @@ -4425,7 +4443,8 @@ static int process(const char *base_directory) static int do_host_query(const char *query_host) { - cli = cli_cm_open(talloc_tos(), NULL, query_host, "IPC$", true); + cli = cli_cm_open(talloc_tos(), NULL, + query_host, "IPC$", true, smb_encrypt); if (!cli) return 1; @@ -4438,7 +4457,8 @@ static int do_host_query(const char *query_host) cli_cm_shutdown(); cli_cm_set_port( 139 ); - cli = cli_cm_open(talloc_tos(), NULL, query_host, "IPC$", true); + cli = cli_cm_open(talloc_tos(), NULL, + query_host, "IPC$", true, smb_encrypt); } if (cli == NULL) { @@ -4463,7 +4483,8 @@ static int do_tar_op(const char *base_directory) /* do we already have a connection? */ if (!cli) { - cli = cli_cm_open(talloc_tos(), NULL, desthost, service, true); + cli = cli_cm_open(talloc_tos(), NULL, + desthost, service, true, smb_encrypt); if (!cli) return 1; } @@ -4571,6 +4592,7 @@ static int do_message_op(void) { "port", 'p', POPT_ARG_INT, &port, 'p', "Port to connect to", "PORT" }, { "grepable", 'g', POPT_ARG_NONE, NULL, 'g', "Produce grepable output" }, { "browse", 'B', POPT_ARG_NONE, NULL, 'B', "Browse SMB servers using DNS" }, + { "encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" }, POPT_COMMON_SAMBA POPT_COMMON_CONNECTION POPT_COMMON_CREDENTIALS @@ -4713,6 +4735,9 @@ static int do_message_op(void) case 'g': grepable=true; break; + case 'e': + smb_encrypt=true; + break; case 'B': return(do_smb_browse()); diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index e0c40b52ed..7800d10e8b 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -58,6 +58,70 @@ static struct sockaddr_storage dest_ss; static struct client_connection *connections; +static bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, + struct cli_state *cli, + const char *sharename, + char **pp_newserver, + char **pp_newshare, + bool force_encrypt, + const char *username, + const char *password, + const char *domain); + +/******************************************************************** + Ensure a connection is encrypted. +********************************************************************/ + +static bool force_cli_encryption(struct cli_state *c, + const char *username, + const char *password, + const char *domain, + const char *sharename) +{ + uint16 major, minor; + uint32 caplow, caphigh; + NTSTATUS status; + + if (!SERVER_HAS_UNIX_CIFS(c)) { + d_printf("Encryption required and " + "server that doesn't support " + "UNIX extensions - failing connect\n"); + return false; + } + + if (!cli_unix_extensions_version(c, &major, &minor, &caplow, &caphigh)) { + d_printf("Encryption required and " + "can't get UNIX CIFS extensions " + "version from server.\n"); + return false; + } + + if (!(caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)) { + d_printf("Encryption required and " + "share %s doesn't support " + "encryption.\n", sharename); + return false; + } + + if (c->use_kerberos) { + status = cli_gss_smb_encryption_start(c); + } else { + status = cli_raw_ntlm_smb_encryption_start(c, + username, + password, + domain); + } + + if (!NT_STATUS_IS_OK(status)) { + d_printf("Encryption required and " + "setup failed with error %s.\n", + nt_errstr(status)); + return false; + } + + return true; +} + /******************************************************************** Return a connection to a server. ********************************************************************/ @@ -65,7 +129,8 @@ static struct client_connection *connections; static struct cli_state *do_connect(TALLOC_CTX *ctx, const char *server, const char *share, - bool show_sessetup) + bool show_sessetup, + bool force_encrypt) { struct cli_state *c = NULL; struct nmb_name called, calling; @@ -197,9 +262,14 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx, if ((c->capabilities & CAP_DFS) && cli_check_msdfs_proxy(ctx, c, sharename, - &newserver, &newshare)) { + &newserver, &newshare, + force_encrypt, + username, + password, + lp_workgroup())) { cli_shutdown(c); - return do_connect(ctx, newserver, newshare, false); + return do_connect(ctx, newserver, + newshare, false, force_encrypt); } /* must be a normal share */ @@ -211,6 +281,15 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx, return NULL; } + if (force_encrypt && !force_cli_encryption(c, + username, + password, + lp_workgroup(), + sharename)) { + cli_shutdown(c); + return NULL; + } + DEBUG(4,(" tconx ok\n")); return c; } @@ -269,7 +348,8 @@ static struct cli_state *cli_cm_connect(TALLOC_CTX *ctx, struct cli_state *referring_cli, const char *server, const char *share, - bool show_hdr) + bool show_hdr, + bool force_encrypt) { struct client_connection *node; @@ -279,7 +359,7 @@ static struct cli_state *cli_cm_connect(TALLOC_CTX *ctx, return NULL; } - node->cli = do_connect(ctx, server, share, show_hdr); + node->cli = do_connect(ctx, server, share, show_hdr, force_encrypt); if ( !node->cli ) { TALLOC_FREE( node ); @@ -331,7 +411,8 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx, struct cli_state *referring_cli, const char *server, const char *share, - bool show_hdr) + bool show_hdr, + bool force_encrypt) { struct cli_state *c; @@ -339,7 +420,8 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx, c = cli_cm_find(server, share); if (!c) { - c = cli_cm_connect(ctx, referring_cli, server, share, show_hdr); + c = cli_cm_connect(ctx, referring_cli, + server, share, show_hdr, force_encrypt); } return c; @@ -776,7 +858,9 @@ bool cli_resolve_path(TALLOC_CTX *ctx, /* Check for the referral. */ if (!(cli_ipc = cli_cm_open(ctx, rootcli, - rootcli->desthost, "IPC$", false))) { + rootcli->desthost, + "IPC$", false, + (rootcli->trans_enc_state != NULL)))) { return false; } @@ -818,7 +902,10 @@ bool cli_resolve_path(TALLOC_CTX *ctx, /* Open the connection to the target server & share */ if ((*targetcli = cli_cm_open(ctx, rootcli, - server, share, false)) == NULL) { + server, + share, + false, + (rootcli->trans_enc_state != NULL))) == NULL) { d_printf("Unable to follow dfs referral [\\%s\\%s]\n", server, share ); return false; @@ -905,11 +992,15 @@ bool cli_resolve_path(TALLOC_CTX *ctx, /******************************************************************** ********************************************************************/ -bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, +static bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, struct cli_state *cli, const char *sharename, char **pp_newserver, - char **pp_newshare ) + char **pp_newshare, + bool force_encrypt, + const char *username, + const char *password, + const char *domain) { CLIENT_DFS_REFERRAL *refs = NULL; size_t num_refs = 0; @@ -944,6 +1035,14 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, return false; } + if (force_encrypt && !force_cli_encryption(cli, + username, + password, + lp_workgroup(), + "IPC$")) { + return false; + } + res = cli_dfs_get_referral(ctx, cli, fullpath, &refs, &num_refs, &consumed); if (!cli_tdis(cli)) { -- cgit From f04daa682acc2a9d5d660760b81dd353081ee84a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 29 Dec 2007 22:42:20 -0800 Subject: Fix error message. Jeremy. (This used to be commit a0494b115b644c1c4afa50442c46a54779687571) --- source3/client/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/client/client.c b/source3/client/client.c index 3d529981e5..2a86035cf0 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -3807,7 +3807,7 @@ int cmd_iosize(void) if (smb_encrypt && (iosize < 0x4000 || iosize > 0xFC00)) { d_printf("iosize out of range for encrypted " "connection (min = 16384 (0x4000), " - "max = 16776960 (0xFC00)"); + "max = 64512 (0xFC00)"); return 1; } else if (!smb_encrypt && (iosize < 0x4000 || iosize > 0xFFFF00)) { d_printf("iosize out of range (min = 16384 (0x4000), " -- cgit From c6646f115ebca2fe8b05c898d3529832b3599056 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 30 Dec 2007 13:10:29 -0800 Subject: As the encryption is stream based there's no reason oplock breaks can't be encrypted. If we have multiple contexts I should probably attach them to the connection struct, but for now use the global context number. Jeremy. (This used to be commit 5b4b335ed0d1dc738f1f099e5c638361f3aede07) --- source3/smbd/oplock.c | 12 +++++++----- source3/smbd/seal.c | 9 +++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 2c3313606a..8a5b1f4ecd 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -252,11 +252,13 @@ static char *new_break_smb_message(TALLOC_CTX *mem_ctx, } memset(result,'\0',smb_size); - /* We use cli_set_message here as this is an - * asynchronous message that doesn't belong in - * the stream. - */ - cli_set_message(result,8,0,True); + if (!srv_encryption_on()) { + cli_set_message(result,8,0,true); + } else { + char inbuf[8]; + smb_set_enclen(inbuf,4,srv_enc_ctx()); + srv_set_message(inbuf,result,8,0,true); + } SCVAL(result,smb_com,SMBlockingX); SSVAL(result,smb_tid,fsp->conn->cnum); SSVAL(result,smb_pid,0xFFFF); diff --git a/source3/smbd/seal.c b/source3/smbd/seal.c index 14a427bb9c..24ecb77fd5 100644 --- a/source3/smbd/seal.c +++ b/source3/smbd/seal.c @@ -47,6 +47,15 @@ bool srv_encryption_on(void) return false; } +/****************************************************************************** + Return global enc context - this must change if we ever do multiple contexts. +******************************************************************************/ + +uint16 srv_enc_ctx(void) +{ + return srv_trans_enc_ctx->es->enc_ctx_num; +} + /****************************************************************************** Create an auth_ntlmssp_state and ensure pointer copy is correct. ******************************************************************************/ -- cgit From 80957726b694ea59da306c1be2e08b213936dc93 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 30 Dec 2007 22:27:45 +0100 Subject: Remove all d_fprintf-s from libnet_conf.c Replacing them buy DEBUG statements and filling in d_fprintfs in callers in net_conf.c. Michael (This used to be commit 1f0122d8d4ec0f67eaedd5df7383c1b45f37290f) --- source3/libnet/libnet_conf.c | 31 +++++++++++++++---------------- source3/utils/net_conf.c | 28 ++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 1069abcfbd..a637aedbbc 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -167,12 +167,12 @@ WERROR libnet_smbconf_reg_createkey_internal(TALLOC_CTX *ctx, werr = reg_createkey(ctx, create_parent, subkeyname, REG_KEY_WRITE, newkey, &action); if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) { - d_fprintf(stderr, "Key '%s' already exists.\n", subkeyname); + DEBUG(10, ("Key '%s' already exists.\n", subkeyname)); werr = WERR_ALREADY_EXISTS; } if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error creating key %s: %s\n", - subkeyname, dos_errstr(werr)); + DEBUG(5, ("Error creating key %s: %s\n", + subkeyname, dos_errstr(werr))); } done: @@ -198,11 +198,11 @@ WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key, &canon_valstr)) { if (canon_valname == NULL) { - d_fprintf(stderr, "invalid parameter '%s' given\n", - valname); + DEBUG(5, ("invalid parameter '%s' given\n", + valname)); } else { - d_fprintf(stderr, "invalid value '%s' given for " - "parameter '%s'\n", valstr, valname); + DEBUG(5, ("invalid value '%s' given for " + "parameter '%s'\n", valstr, valname)); } werr = WERR_INVALID_PARAM; goto done; @@ -215,16 +215,16 @@ WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key, val.v.sz.len = strlen(canon_valstr) + 1; if (registry_smbconf_valname_forbidden(canon_valname)) { - d_fprintf(stderr, "Parameter '%s' not allowed in registry.\n", - canon_valname); + DEBUG(5, ("Parameter '%s' not allowed in registry.\n", + canon_valname)); werr = WERR_INVALID_PARAM; goto done; } subkeyname = strrchr_m(key->key->name, '\\'); if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) { - d_fprintf(stderr, "Invalid registry key '%s' given as " - "smbconf section.\n", key->key->name); + DEBUG(5, ("Invalid registry key '%s' given as " + "smbconf section.\n", key->key->name)); werr = WERR_INVALID_PARAM; goto done; } @@ -232,19 +232,18 @@ WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key, if (!strequal(subkeyname, GLOBAL_NAME) && lp_parameter_is_global(valname)) { - d_fprintf(stderr, "Global paramter '%s' not allowed in " + DEBUG(5, ("Global paramter '%s' not allowed in " "service definition ('%s').\n", canon_valname, - subkeyname); + subkeyname)); werr = WERR_INVALID_PARAM; goto done; } werr = reg_setvalue(key, canon_valname, &val); if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, - "Error adding value '%s' to " + DEBUG(5, ("Error adding value '%s' to " "key '%s': %s\n", - canon_valname, key->key->name, dos_errstr(werr)); + canon_valname, key->key->name, dos_errstr(werr))); } done: diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 29bbc83ec3..9503a3c521 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -216,6 +216,8 @@ static int import_process_service(TALLOC_CTX *ctx, } werr = libnet_smbconf_reg_createkey_internal(tmp_ctx, servicename, &key); if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error creating share %s: %s\n", + servicename, dos_errstr(werr)); goto done; } } @@ -235,6 +237,10 @@ static int import_process_service(TALLOC_CTX *ctx, werr = libnet_smbconf_reg_setvalue_internal(key, parm->label, valstr); if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, + "Error setting parameter '%s'" + ": %s\n", parm->label, + dos_errstr(werr)); goto done; } } @@ -622,31 +628,45 @@ static int net_conf_addshare(int argc, const char **argv) werr = libnet_smbconf_reg_createkey_internal(NULL, argv[0], &newkey); if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error creating share %s: %s\n", + argv[0], dos_errstr(werr)); goto done; } /* add config params as values */ werr = libnet_smbconf_reg_setvalue_internal(newkey, "path", path); - if (!W_ERROR_IS_OK(werr)) + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error setting parameter %s: %s\n", + "path", dos_errstr(werr)); goto done; + } if (comment != NULL) { werr = libnet_smbconf_reg_setvalue_internal(newkey, "comment", comment); - if (!W_ERROR_IS_OK(werr)) + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error setting parameter %s: %s\n", + "comment", dos_errstr(werr)); goto done; + } } werr = libnet_smbconf_reg_setvalue_internal(newkey, "guest ok", guest_ok); - if (!W_ERROR_IS_OK(werr)) + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error setting parameter %s: %s\n", + "'guest ok'", dos_errstr(werr)); goto done; + } werr = libnet_smbconf_reg_setvalue_internal(newkey, "writeable", writeable); - if (!W_ERROR_IS_OK(werr)) + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error setting parameter %s: %s\n", + "writeable", dos_errstr(werr)); goto done; + } ret = 0; -- cgit From 0f2e7c73817eba0ebf1e98cabc38700560adb600 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 30 Dec 2007 22:29:54 +0100 Subject: Remove an unused variable. Michael (This used to be commit 7bac935b65565099c0dfb34cab0dec73dd5fb479) --- source3/libnet/libnet_conf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index a637aedbbc..8fe2c76ea3 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -36,7 +36,6 @@ static WERROR libnet_smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, uint32_t count, const char *string) { - WERROR werr = WERR_OK; char **new_array = NULL; if ((array == NULL) || (string == NULL)) { -- cgit From a74de0c7eb575e5b983773a1b8daa724c7074e7e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 30 Dec 2007 22:30:21 +0100 Subject: Remove an unused variable. Michael (This used to be commit 332be113a775adce8108a8003682019ae7f5bc21) --- source3/utils/net_conf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 9503a3c521..98e6b60034 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -468,7 +468,6 @@ static int net_conf_showshare(int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; - struct registry_key *key = NULL; const char *sharename = NULL; TALLOC_CTX *ctx; uint32_t num_params; -- cgit From e8a680cdf391255fcbdacd1dcebc0f5a947408f1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 31 Dec 2007 01:14:44 +0100 Subject: Rename libnet_smbconf_key_exists() to libnet_smbconf_share_exists() and move it to the api section of libnet_conf.c Michael (This used to be commit 9b5d8f4d95ebfd47831906019e11227aecc83aa1) --- source3/libnet/libnet_conf.c | 48 ++++++++++++++++++++++---------------------- source3/utils/net_conf.c | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 8fe2c76ea3..1b13b5bdc9 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -100,26 +100,6 @@ static WERROR libnet_smbconf_reg_open_basepath(TALLOC_CTX *ctx, return libnet_smbconf_reg_open_path(ctx, NULL, desired_access, key); } -/* - * check if a subkey of KEY_SMBCONF of a given name exists - */ -bool libnet_smbconf_key_exists(const char *subkeyname) -{ - bool ret = false; - WERROR werr = WERR_OK; - TALLOC_CTX *mem_ctx = talloc_stackframe(); - struct registry_key *key = NULL; - - werr = libnet_smbconf_reg_open_path(mem_ctx, subkeyname, REG_KEY_READ, - &key); - if (W_ERROR_IS_OK(werr)) { - ret = true; - } - - TALLOC_FREE(mem_ctx); - return ret; -} - static bool libnet_smbconf_value_exists(struct registry_key *key, const char *param) { @@ -530,7 +510,7 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, } /* make sure "global" is always listed first */ - if (libnet_smbconf_key_exists(GLOBAL_NAME)) { + if (libnet_smbconf_share_exists(GLOBAL_NAME)) { werr = libnet_smbconf_add_string_to_array(tmp_ctx, &tmp_share_names, 0, GLOBAL_NAME); @@ -582,6 +562,26 @@ done: return werr; } +/** + * check if a share/service of a given name exists + */ +bool libnet_smbconf_share_exists(const char *subkeyname) +{ + bool ret = false; + WERROR werr = WERR_OK; + TALLOC_CTX *mem_ctx = talloc_stackframe(); + struct registry_key *key = NULL; + + werr = libnet_smbconf_reg_open_path(mem_ctx, subkeyname, REG_KEY_READ, + &key); + if (W_ERROR_IS_OK(werr)) { + ret = true; + } + + TALLOC_FREE(mem_ctx); + return ret; +} + /** * get a definition of a share (service) from configuration. */ @@ -638,7 +638,7 @@ WERROR libnet_smbconf_setparm(const char *service, struct registry_key *key = NULL; TALLOC_CTX *mem_ctx = talloc_stackframe(); - if (!libnet_smbconf_key_exists(service)) { + if (!libnet_smbconf_share_exists(service)) { werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service, &key); } else { @@ -673,7 +673,7 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - if (!libnet_smbconf_key_exists(service)) { + if (!libnet_smbconf_share_exists(service)) { werr = WERR_NO_SUCH_SERVICE; goto done; } @@ -716,7 +716,7 @@ WERROR libnet_smbconf_delparm(const char *service, WERROR werr = WERR_OK; TALLOC_CTX *mem_ctx = talloc_stackframe(); - if (!libnet_smbconf_key_exists(service)) { + if (!libnet_smbconf_share_exists(service)) { return WERR_NO_SUCH_SERVICE; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 98e6b60034..24257fe7cf 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -208,7 +208,7 @@ static int import_process_service(TALLOC_CTX *ctx, if (opt_testmode) { d_printf("[%s]\n", servicename); } else { - if (libnet_smbconf_key_exists(servicename)) { + if (libnet_smbconf_share_exists(servicename)) { werr = libnet_smbconf_delshare(servicename); if (!W_ERROR_IS_OK(werr)) { goto done; -- cgit From 01f8fd55a7f9cb9cc90e3d2b53397412a7bad714 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 31 Dec 2007 01:56:18 +0100 Subject: Rewrite net_conf_addshare() to only use libnet_conf API functions. Also exit on error if the share already exists. net_conf_addshare() is considered a high level utility function. It should not be an libnet_conf API function in itself since it is kind of arbitrary. Michael (This used to be commit af5218f1505321236be52df10ebfe8f42b99573d) --- source3/utils/net_conf.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 24257fe7cf..9e4d4300d5 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -506,11 +506,16 @@ done: return ret; } +/** + * Add a share, with a couple of standard parameters, partly optional. + * + * This is a high level utility function of the net conf utility, + * not a direct frontend to the libnet_conf API. + */ static int net_conf_addshare(int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; - struct registry_key *newkey = NULL; char *sharename = NULL; const char *path = NULL; const char *comment = NULL; @@ -562,7 +567,6 @@ static int net_conf_addshare(int argc, const char **argv) net_conf_addshare_usage(argc, argv); goto done; } - case 2: path = argv[1]; sharename = strdup_lower(argv[0]); @@ -596,6 +600,12 @@ static int net_conf_addshare(int argc, const char **argv) goto done; } + if (libnet_smbconf_share_exists(sharename)) { + d_fprintf(stderr, "ERROR: share %s already exists.\n", + sharename); + goto done; + } + /* validate path */ if (path[0] != '/') { @@ -622,19 +632,10 @@ static int net_conf_addshare(int argc, const char **argv) } /* - * create the share + * create the share by adding the parameters */ - werr = libnet_smbconf_reg_createkey_internal(NULL, argv[0], &newkey); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error creating share %s: %s\n", - argv[0], dos_errstr(werr)); - goto done; - } - - /* add config params as values */ - - werr = libnet_smbconf_reg_setvalue_internal(newkey, "path", path); + werr = libnet_smbconf_setparm(sharename, "path", path); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "path", dos_errstr(werr)); @@ -642,8 +643,7 @@ static int net_conf_addshare(int argc, const char **argv) } if (comment != NULL) { - werr = libnet_smbconf_reg_setvalue_internal(newkey, "comment", - comment); + werr = libnet_smbconf_setparm(sharename, "comment", comment); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "comment", dos_errstr(werr)); @@ -651,16 +651,14 @@ static int net_conf_addshare(int argc, const char **argv) } } - werr = libnet_smbconf_reg_setvalue_internal(newkey, "guest ok", - guest_ok); + werr = libnet_smbconf_setparm(sharename, "guest ok", guest_ok); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "'guest ok'", dos_errstr(werr)); goto done; } - werr = libnet_smbconf_reg_setvalue_internal(newkey, "writeable", - writeable); + werr = libnet_smbconf_setparm(sharename, "writeable", writeable); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "writeable", dos_errstr(werr)); @@ -670,7 +668,6 @@ static int net_conf_addshare(int argc, const char **argv) ret = 0; done: - TALLOC_FREE(newkey); SAFE_FREE(sharename); return ret; } -- cgit From 8d9fb62a4593525a84104665d0a5318e16993d9e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 31 Dec 2007 03:02:39 +0100 Subject: Change net_conf_import() to only use libnet_conf API functions. More precisely, only import_process_service() is changed. This removes all references to registry code from net_conf.c. net_conf_import() is currently -- like net_conf_addshare() -- also considered a high-level add-on, not an API function. Michael (This used to be commit b4dca117c09ddb9c8e7eea25c6cde3fbef8c692b) --- source3/utils/net_conf.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 9e4d4300d5..1882567d8b 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -191,7 +191,6 @@ static int import_process_service(TALLOC_CTX *ctx, struct parm_struct *parm; int pnum = 0; const char *servicename; - struct registry_key *key; WERROR werr; char *valstr = NULL; TALLOC_CTX *tmp_ctx = NULL; @@ -214,12 +213,6 @@ static int import_process_service(TALLOC_CTX *ctx, goto done; } } - werr = libnet_smbconf_reg_createkey_internal(tmp_ctx, servicename, &key); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error creating share %s: %s\n", - servicename, dos_errstr(werr)); - goto done; - } } while ((parm = lp_next_parameter(share->service, &pnum, 0))) @@ -234,8 +227,9 @@ static int import_process_service(TALLOC_CTX *ctx, if (opt_testmode) { d_printf("\t%s = %s\n", parm->label, valstr); } else { - werr = libnet_smbconf_reg_setvalue_internal(key, - parm->label, valstr); + werr = libnet_smbconf_setparm(servicename, + parm->label, + valstr); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter '%s'" -- cgit From 06f80cf8becc84672aad9d8703e1a2fbc80af20c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 30 Dec 2007 18:05:33 -0800 Subject: We may use 127k read/write for encrypted connections. Jeremy. (This used to be commit 656c9d0844e3d9d87ae768fe5a5538759b94d953) --- source3/client/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 2a86035cf0..6c00638eb9 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -3798,7 +3798,7 @@ int cmd_iosize(void) d_printf("iosize or iosize 0x. " "(Encrypted connection) ," "Minimum is 16384 (0x4000), " - "max is 64512 (0xFC00)\n"); + "max is 130048 (0x1FC00)\n"); } return 1; } @@ -3807,7 +3807,7 @@ int cmd_iosize(void) if (smb_encrypt && (iosize < 0x4000 || iosize > 0xFC00)) { d_printf("iosize out of range for encrypted " "connection (min = 16384 (0x4000), " - "max = 64512 (0xFC00)"); + "max = 130048 (0x1FC00)"); return 1; } else if (!smb_encrypt && (iosize < 0x4000 || iosize > 0xFFFF00)) { d_printf("iosize out of range (min = 16384 (0x4000), " -- cgit From feb4d82724657c5567d9ebefef7242a2a48496e2 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 31 Dec 2007 03:25:54 +0100 Subject: Fix a permissions error in reg_deletekey_recursive(). Michael (This used to be commit 4a56d3d7075bd8bbd5e139c9433789ab29f6a70e) --- source3/registry/reg_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index bc4508ff94..bb410e646b 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -729,7 +729,7 @@ WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx, } /* recurse through subkeys first */ - werr = reg_openkey(mem_ctx, parent, path, REG_KEY_WRITE, &key); + werr = reg_openkey(mem_ctx, parent, path, REG_KEY_ALL, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From 4c7ef1c03e81f45270fddc4bd59f837d52bc34d8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 31 Dec 2007 03:55:22 +0100 Subject: Make grouping in if statement more explicit. Michael (This used to be commit a1bb47695a7fb21af239aa9d02537d3de2fea325) --- source3/utils/net_conf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 1882567d8b..07eb3b890f 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -217,9 +217,11 @@ static int import_process_service(TALLOC_CTX *ctx, while ((parm = lp_next_parameter(share->service, &pnum, 0))) { - if ((share->service < 0 && parm->p_class == P_LOCAL) + if ((share->service < 0) && (parm->p_class == P_LOCAL) && !(parm->flags & FLAG_GLOBAL)) + { continue; + } valstr = parm_valstr(tmp_ctx, parm, share); -- cgit From 8598bbbcb111103a592f4dcf25199a20b4de258c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 31 Dec 2007 03:57:45 +0100 Subject: Make the last two helper functions in libnet_conf.c static. Now the registry backend is completely hidden from the API. Michael (This used to be commit 5608c398ad9a0d05d651905a81dd92b7a0e120ff) --- source3/libnet/libnet_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 1b13b5bdc9..21fe8572ea 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -120,9 +120,9 @@ static bool libnet_smbconf_value_exists(struct registry_key *key, /* * create a subkey of KEY_SMBCONF */ -WERROR libnet_smbconf_reg_createkey_internal(TALLOC_CTX *ctx, - const char * subkeyname, - struct registry_key **newkey) +static WERROR libnet_smbconf_reg_createkey_internal(TALLOC_CTX *ctx, + const char * subkeyname, + struct registry_key **newkey) { WERROR werr = WERR_OK; struct registry_key *create_parent = NULL; @@ -162,7 +162,7 @@ done: /* * add a value to a key. */ -WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key, +static WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key, const char *valname, const char *valstr) { -- cgit From 31d3f5726a0f4ae23243c82645506cb257d57b53 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 1 Jan 2008 12:55:29 +0100 Subject: Use NULL instead of 0 "struct security_descriptor" has pointers, not integers inside (This used to be commit 13158014e3b05e44eea897fbcf470957301c5c97) --- source3/smbd/open.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index d3ba9e076c..b6e6adde8a 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2606,16 +2606,16 @@ NTSTATUS create_file_unixpath(connection_struct *conn, uint32_t sec_info_sent = ALL_SECURITY_INFORMATION; uint32_t saved_access_mask = fsp->access_mask; - if (sd->owner_sid==0) { + if (sd->owner_sid == NULL) { sec_info_sent &= ~OWNER_SECURITY_INFORMATION; } - if (sd->group_sid==0) { + if (sd->group_sid == NULL) { sec_info_sent &= ~GROUP_SECURITY_INFORMATION; } - if (sd->sacl==0) { + if (sd->sacl == NULL) { sec_info_sent &= ~SACL_SECURITY_INFORMATION; } - if (sd->dacl==0) { + if (sd->dacl == NULL) { sec_info_sent &= ~DACL_SECURITY_INFORMATION; } -- cgit From 9b5ec6ba03963776486bc6259dcb2d00c2fbdaa5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 2 Jan 2008 12:55:53 +0100 Subject: Happy new year ! Guenther (This used to be commit 9a58cd57953d6aead14789daa47a3badef19496d) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/include/smb.h b/source3/include/smb.h index aca0009688..75fe31e041 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -27,7 +27,7 @@ #define _SMB_H /* logged when starting the various Samba daemons */ -#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2007" +#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2008" #if defined(LARGE_SMB_OFF_T) -- cgit From 448433917459a01b675189eb1084534fd4faf1ab Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 2 Jan 2008 13:22:19 +0100 Subject: Add test_shlibs to Makefile. Guenther (This used to be commit 5f5051911c25772c7fb4ff41fca0aafae371ae4f) --- source3/Makefile.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/Makefile.in b/source3/Makefile.in index 01f2988b88..dfb373438d 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -2129,6 +2129,14 @@ Makefile: $(srcdir)/Makefile.in config.status ###################################################################### # Samba Testing Framework +# Check shared libs for unresolved symbols +test_shlibs: $(SHLIBS) + @echo "Testing $(SHLIBS) " + @for module in $(SHLIBS); do \ + ./script/tests/dlopen.sh bin/$${module}.@SHLIBEXT@ \ + || exit 1; \ + done + # Check for NSS module problems. test_nss_modules: nss_modules @echo "Testing $(NSS_MODULES) " -- cgit From c1328242652e4d61348cf00ba66e52485f4bbcaf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 7 Dec 2007 14:19:07 +0100 Subject: Convert reply_open to create_file (This used to be commit 209c696ab8490564ec9e30f6f07b9c72af3ed2e1) --- source3/smbd/reply.c | 59 +++++++++++++++++----------------------------------- 1 file changed, 19 insertions(+), 40 deletions(-) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 2707aee9c8..452b803f9c 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1597,51 +1597,30 @@ void reply_open(connection_struct *conn, struct smb_request *req) return; } - status = resolve_dfspath(ctx, conn, - req->flags2 & FLAGS2_DFS_PATHNAMES, - fname, - &fname); - if (!NT_STATUS_IS_OK(status)) { - if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { - reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, - ERRSRV, ERRbadpath); - END_PROFILE(SMBopen); - return; - } - reply_nterror(req, status); - END_PROFILE(SMBopen); - return; - } - - status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf); - if (!NT_STATUS_IS_OK(status)) { - reply_nterror(req, status); - END_PROFILE(SMBopen); - return; - } - - status = check_name(conn, fname); - if (!NT_STATUS_IS_OK(status)) { - reply_nterror(req, status); - END_PROFILE(SMBopen); - return; - } - - if (!map_open_params_to_ntcreate(fname, deny_mode, OPENX_FILE_EXISTS_OPEN, - &access_mask, &share_mode, &create_disposition, &create_options)) { + if (!map_open_params_to_ntcreate( + fname, deny_mode, OPENX_FILE_EXISTS_OPEN, &access_mask, + &share_mode, &create_disposition, &create_options)) { reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess)); END_PROFILE(SMBopen); return; } - status = open_file_ntcreate(conn, req, fname, &sbuf, - access_mask, - share_mode, - create_disposition, - create_options, - dos_attr, - oplock_request, - &info, &fsp); + status = create_file(conn, /* conn */ + req, /* req */ + 0, /* root_dir_fid */ + fname, /* fname */ + access_mask, /* access_mask */ + share_mode, /* share_access */ + create_disposition, /* create_disposition*/ + create_options, /* create_options */ + dos_attr, /* file_attributes */ + oplock_request, /* oplock_request */ + 0, /* allocation_size */ + NULL, /* sd */ + NULL, /* ea_list */ + &fsp, /* result */ + &info, /* pinfo */ + &sbuf); /* psbuf */ if (!NT_STATUS_IS_OK(status)) { if (open_was_deferred(req->mid)) { -- cgit From cc322c708c3ba3e73b9788ca27a233873effb88b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 7 Dec 2007 14:23:10 +0100 Subject: Convert reply_open_and_X to create_file (This used to be commit fa09b9ab26657af9bd6dcf3fcc7311d5983a591d) --- source3/smbd/reply.c | 61 ++++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 42 deletions(-) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 452b803f9c..4b873037b5 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1741,53 +1741,30 @@ void reply_open_and_X(connection_struct *conn, struct smb_request *req) return; } - status = resolve_dfspath(ctx, conn, - req->flags2 & FLAGS2_DFS_PATHNAMES, - fname, - &fname); - if (!NT_STATUS_IS_OK(status)) { - END_PROFILE(SMBopenX); - if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { - reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, - ERRSRV, ERRbadpath); - return; - } - reply_nterror(req, status); - return; - } - - status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf); - if (!NT_STATUS_IS_OK(status)) { - reply_nterror(req, status); - END_PROFILE(SMBopenX); - return; - } - - status = check_name(conn, fname); - if (!NT_STATUS_IS_OK(status)) { - reply_nterror(req, status); - END_PROFILE(SMBopenX); - return; - } - - if (!map_open_params_to_ntcreate(fname, deny_mode, smb_ofun, - &access_mask, - &share_mode, - &create_disposition, - &create_options)) { + if (!map_open_params_to_ntcreate( + fname, deny_mode, smb_ofun, &access_mask, + &share_mode, &create_disposition, &create_options)) { reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess)); END_PROFILE(SMBopenX); return; } - status = open_file_ntcreate(conn, req, fname, &sbuf, - access_mask, - share_mode, - create_disposition, - create_options, - smb_attr, - oplock_request, - &smb_action, &fsp); + status = create_file(conn, /* conn */ + req, /* req */ + 0, /* root_dir_fid */ + fname, /* fname */ + access_mask, /* access_mask */ + share_mode, /* share_access */ + create_disposition, /* create_disposition*/ + create_options, /* create_options */ + smb_attr, /* file_attributes */ + oplock_request, /* oplock_request */ + 0, /* allocation_size */ + NULL, /* sd */ + NULL, /* ea_list */ + &fsp, /* result */ + &smb_action, /* pinfo */ + &sbuf); /* psbuf */ if (!NT_STATUS_IS_OK(status)) { END_PROFILE(SMBopenX); -- cgit From 8ad3db1d2be41f8afca66f1db52560d026ea3845 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 8 Dec 2007 12:05:41 +0100 Subject: Convert reply_mknew to create_file (This used to be commit 1b1cea9ef04a85a2fdd3c8574f7c4db559b7d9b6) --- source3/smbd/reply.c | 54 ++++++++++++++++------------------------------------ 1 file changed, 16 insertions(+), 38 deletions(-) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 4b873037b5..c859efd370 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1938,35 +1938,6 @@ void reply_mknew(connection_struct *conn, struct smb_request *req) return; } - status = resolve_dfspath(ctx, conn, - req->flags2 & FLAGS2_DFS_PATHNAMES, - fname, - &fname); - if (!NT_STATUS_IS_OK(status)) { - END_PROFILE(SMBcreate); - if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { - reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, - ERRSRV, ERRbadpath); - return; - } - reply_nterror(req, status); - return; - } - - status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf); - if (!NT_STATUS_IS_OK(status)) { - reply_nterror(req, status); - END_PROFILE(SMBcreate); - return; - } - - status = check_name(conn, fname); - if (!NT_STATUS_IS_OK(status)) { - reply_nterror(req, status); - END_PROFILE(SMBcreate); - return; - } - if (fattr & aVOLID) { DEBUG(0,("Attempt to create file (%s) with volid set - " "please report this\n", fname)); @@ -1980,15 +1951,22 @@ void reply_mknew(connection_struct *conn, struct smb_request *req) create_disposition = FILE_OVERWRITE_IF; } - /* Open file using ntcreate. */ - status = open_file_ntcreate(conn, req, fname, &sbuf, - access_mask, - share_mode, - create_disposition, - create_options, - fattr, - oplock_request, - NULL, &fsp); + status = create_file(conn, /* conn */ + req, /* req */ + 0, /* root_dir_fid */ + fname, /* fname */ + access_mask, /* access_mask */ + share_mode, /* share_access */ + create_disposition, /* create_disposition*/ + create_options, /* create_options */ + fattr, /* file_attributes */ + oplock_request, /* oplock_request */ + 0, /* allocation_size */ + NULL, /* sd */ + NULL, /* ea_list */ + &fsp, /* result */ + NULL, /* pinfo */ + &sbuf); /* psbuf */ if (!NT_STATUS_IS_OK(status)) { END_PROFILE(SMBcreate); -- cgit From 523dbf801b019b16ea5ec9ca1e8e3dfcc2dc50ac Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 8 Dec 2007 12:29:09 +0100 Subject: Convert call_trans2open to create_file() (This used to be commit 22138572bd2b9ae379b01098566e38e132653968) --- source3/smbd/trans2.c | 73 +++++++++++---------------------------------------- 1 file changed, 16 insertions(+), 57 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 656925502b..eba8cb50f0 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -841,20 +841,6 @@ static void call_trans2open(connection_struct *conn, fname, (unsigned int)deny_mode, (unsigned int)open_attr, (unsigned int)open_ofun, open_size)); - /* XXXX we need to handle passed times, sattr and flags */ - - status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf); - if (!NT_STATUS_IS_OK(status)) { - reply_nterror(req, status); - return; - } - - status = check_name(conn, fname); - if (!NT_STATUS_IS_OK(status)) { - reply_nterror(req, status); - return; - } - if (open_ofun == 0) { reply_nterror(req, NT_STATUS_OBJECT_NAME_COLLISION); return; @@ -899,14 +885,22 @@ static void call_trans2open(connection_struct *conn, return; } - status = open_file_ntcreate(conn, req, fname, &sbuf, - access_mask, - share_mode, - create_disposition, - create_options, - open_attr, - oplock_request, - &smb_action, &fsp); + status = create_file(conn, /* conn */ + req, /* req */ + 0, /* root_dir_fid */ + fname, /* fname */ + access_mask, /* access_mask */ + share_mode, /* share_access */ + create_disposition, /* create_disposition*/ + create_options, /* create_options */ + open_attr, /* file_attributes */ + oplock_request, /* oplock_request */ + open_size, /* allocation_size */ + NULL, /* sd */ + ea_list, /* ea_list */ + &fsp, /* result */ + &smb_action, /* pinfo */ + &sbuf); /* psbuf */ if (!NT_STATUS_IS_OK(status)) { if (open_was_deferred(req->mid)) { @@ -927,41 +921,6 @@ static void call_trans2open(connection_struct *conn, return; } - /* Save the requested allocation size. */ - /* Allocate space for the file if a size hint is supplied */ - if ((smb_action == FILE_WAS_CREATED) || (smb_action == FILE_WAS_OVERWRITTEN)) { - SMB_BIG_UINT allocation_size = (SMB_BIG_UINT)open_size; - if (allocation_size && (allocation_size > (SMB_BIG_UINT)size)) { - fsp->initial_allocation_size = smb_roundup(fsp->conn, allocation_size); - if (fsp->is_directory) { - close_file(fsp,ERROR_CLOSE); - /* Can't set allocation size on a directory. */ - reply_nterror(req, NT_STATUS_ACCESS_DENIED); - return; - } - if (vfs_allocate_file_space(fsp, fsp->initial_allocation_size) == -1) { - close_file(fsp,ERROR_CLOSE); - reply_nterror(req, NT_STATUS_DISK_FULL); - return; - } - - /* Adjust size here to return the right size in the reply. - Windows does it this way. */ - size = fsp->initial_allocation_size; - } else { - fsp->initial_allocation_size = smb_roundup(fsp->conn,(SMB_BIG_UINT)size); - } - } - - if (ea_list && smb_action == FILE_WAS_CREATED) { - status = set_ea(conn, fsp, fname, ea_list); - if (!NT_STATUS_IS_OK(status)) { - close_file(fsp,ERROR_CLOSE); - reply_nterror(req, status); - return; - } - } - /* Realloc the size of parameters and data we will return */ *pparams = (char *)SMB_REALLOC(*pparams, 30); if(*pparams == NULL ) { -- cgit From 866b5291b6256504c163c42fbc05cb9c31638dff Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 2 Jan 2008 13:48:54 +0100 Subject: Make libsmbsharemodes.so work again (fix unresolved tdb symbols). Guenther (This used to be commit 3c6ed0321606f0bcfc3b5edc492d69b0e2f602cb) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index dfb373438d..6ef3d1fe1c 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -676,7 +676,7 @@ LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o libsmb/libsmb_compat.o \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \ $(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) -LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o $(TDB_BASE_OBJ) +LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o $(TDBBASE_OBJ) # This shared library is intended for linking with unit test programs # to test Samba internals. It's called libbigballofmud.so to -- cgit From 0195afeed740d09b0eecc20e0efc732a986b3c9e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 2 Jan 2008 13:50:13 +0100 Subject: Fix libsmbclient (resolve dependency on libwbclient). Guenther (This used to be commit ef17dc7bda98a8e4149e98fcfb99fe729edbec1f) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 6ef3d1fe1c..18b9f8fb50 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1424,7 +1424,7 @@ bin/libnetapi.a: $(BINARY_PREREQS) $(LIBNETAPI_OBJ) bin/libsmbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ) @echo Linking shared library $@ - @$(SHLD_DSO) $(LIBSMBCLIENT_OBJ) $(LIBS) \ + @$(SHLD_DSO) $(LIBSMBCLIENT_OBJ) @LIBWBCLIENT_SHARED@ $(LIBS) \ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \ @SONAMEFLAG@`basename $@`.$(SONAME_VER) -- cgit From 4656265a2337db1ef99769a6b30c0cf04fdd6cff Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 2 Jan 2008 13:50:31 +0100 Subject: Fix libnetapi (resolve dependency on libwbclient). Guenther (This used to be commit fa669b307c5191f1f8921e863e88c1e9ff692557) --- source3/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 18b9f8fb50..2267be4680 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1414,7 +1414,7 @@ bin/libaddns.a: $(BINARY_PREREQS) $(LIBADDNS_OBJ) bin/libnetapi.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBNETAPI_OBJ) @echo Linking shared library $@ - @$(SHLD_DSO) $(LIBNETAPI_OBJ) $(LIBS) \ + @$(SHLD_DSO) $(LIBNETAPI_OBJ) @LIBWBCLIENT_SHARED@ $(LIBS) \ $(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS) \ @SONAMEFLAG@`basename $@`.$(SONAME_VER) -- cgit From a5d2449fe1f25d74ac3a3d4eae66c43cd8dcbde9 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 2 Jan 2008 17:08:28 +0100 Subject: Use the proper boolean constants. Michael (This used to be commit f731fee408a809b6dc266d45e41f37e63bf4e48d) --- source3/lib/util_reg_smbconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/lib/util_reg_smbconf.c b/source3/lib/util_reg_smbconf.c index 154c67ab8f..fa58f28d03 100644 --- a/source3/lib/util_reg_smbconf.c +++ b/source3/lib/util_reg_smbconf.c @@ -57,7 +57,7 @@ done: */ bool registry_init_regdb(void) { - bool ret = False; + bool ret = false; int saved_errno = 0; static REGISTRY_HOOK smbconf_reg_hook = {KEY_SMBCONF, &smbconf_reg_ops}; @@ -78,7 +78,7 @@ bool registry_init_regdb(void) goto done; } - ret = True; + ret = true; done: return ret; -- cgit From 0090ec236d16a2da7b5432083b079034c642a2fc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 2 Jan 2008 11:56:07 -0800 Subject: Attempt to fix bug #3617. Mix of patches from Volker and myself. Use standard dlinklist macros. Jeremy. (This used to be commit 1b06ee69f6b737c1d6e7b29f8ae9621e6eb07d27) --- source3/nmbd/nmbd_packets.c | 5 +++++ source3/nmbd/nmbd_responserecordsdb.c | 24 ++---------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 3bb1514203..c1d373aa18 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1613,6 +1613,8 @@ void retransmit_or_expire_response_records(time_t t) for (subrec = FIRST_SUBNET; subrec; subrec = get_next_subnet_maybe_unicast_or_wins_server(subrec)) { struct response_record *rrec, *nextrrec; + restart: + for (rrec = subrec->responselist; rrec; rrec = nextrrec) { nextrrec = rrec->next; @@ -1651,6 +1653,9 @@ on subnet %s\n", rrec->response_id, inet_ntoa(rrec->packet->ip), subrec->subnet_ no timeout function. */ remove_response_record(subrec, rrec); } + /* We have changed subrec->responselist, + * restart from the beginning of this list. */ + goto restart; } /* !rrec->in_expitation_processing */ } /* rrec->repeat_count > 0 */ } /* rrec->repeat_time <= t */ diff --git a/source3/nmbd/nmbd_responserecordsdb.c b/source3/nmbd/nmbd_responserecordsdb.c index 22a038ef2e..6498ce04cf 100644 --- a/source3/nmbd/nmbd_responserecordsdb.c +++ b/source3/nmbd/nmbd_responserecordsdb.c @@ -31,26 +31,12 @@ int num_response_packets = 0; static void add_response_record(struct subnet_record *subrec, struct response_record *rrec) { - struct response_record *rrec2; - num_response_packets++; /* count of total number of packets still around */ DEBUG(4,("add_response_record: adding response record id:%hu to subnet %s. num_records:%d\n", rrec->response_id, subrec->subnet_name, num_response_packets)); - if (!subrec->responselist) { - subrec->responselist = rrec; - rrec->prev = NULL; - rrec->next = NULL; - return; - } - - for (rrec2 = subrec->responselist; rrec2->next; rrec2 = rrec2->next) - ; - - rrec2->next = rrec; - rrec->next = NULL; - rrec->prev = rrec2; + DLIST_ADD_END(subrec->responselist, rrec, struct response_record *); } /*************************************************************************** @@ -60,13 +46,7 @@ static void add_response_record(struct subnet_record *subrec, void remove_response_record(struct subnet_record *subrec, struct response_record *rrec) { - if (rrec->prev) - rrec->prev->next = rrec->next; - if (rrec->next) - rrec->next->prev = rrec->prev; - - if (subrec->responselist == rrec) - subrec->responselist = rrec->next; + DLIST_REMOVE(subrec->responselist, rrec); if(rrec->userdata) { if(rrec->userdata->free_fn) { -- cgit From 701a56a698b580b21bfb0df73401ffe2d05f6f19 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Wed, 2 Jan 2008 14:50:59 -0600 Subject: Make sure that wbcLookupSid() and wbcLookupRids() use talloc()'d memory. Follows existing convention that all returned memory should be freed with wbcFreeMemory() and not directly with free(). Noticed by Volker. Txs. (This used to be commit 39c2059f66ee9eb471a503b9c776807b91c2a8f8) --- source3/lib/winbind_util.c | 15 ++++++------- source3/nsswitch/libwbclient/wbc_sid.c | 37 +++++++++++++++++---------------- source3/nsswitch/libwbclient/wbc_util.c | 4 ---- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index f51a0171a2..2cabf5bcac 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -74,8 +74,8 @@ bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, DEBUG(10, ("winbind_lookup_sid: SUCCESS: SID %s -> %s %s\n", sid_string_dbg(sid), domain_name, account_name)); - SAFE_FREE(domain_name); - SAFE_FREE(account_name); + wbcFreeMemory(domain_name); + wbcFreeMemory(account_name); if ((domain && !*domain) || (name && !*name)) { DEBUG(0,("winbind_lookup_sid: talloc() failed!\n")); @@ -192,8 +192,9 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, ret = wbcLookupRids(&dom_sid, num_rids, rids, &dom_name, &namelist, &name_types); - if (ret != WBC_ERR_SUCCESS) + if (ret != WBC_ERR_SUCCESS) { return False; + } *domain_name = talloc_strdup(mem_ctx, dom_name); *names = TALLOC_ARRAY(mem_ctx, const char*, num_rids); @@ -202,11 +203,11 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, for(i=0; i0; i++) { char ridstr[12]; @@ -356,15 +354,15 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, wbc_status = wbcRequestResponse(WINBINDD_LOOKUPRIDS, &request, &response); - free(ridlist); + talloc_free(ridlist); - domain_name = strdup(response.data.domain_name); + domain_name = talloc_strdup(NULL, response.data.domain_name); BAIL_ON_PTR_ERROR(domain_name, wbc_status); - *names = (const char**)malloc(sizeof(char*) * num_rids); + *names = talloc_array(NULL, const char*, num_rids); BAIL_ON_PTR_ERROR((*names), wbc_status); - *types = (enum wbcSidType*)malloc(sizeof(enum wbcSidType) * num_rids); + *types = talloc_array(NULL, enum wbcSidType, num_rids); BAIL_ON_PTR_ERROR((*types), wbc_status); p = (char *)response.extra_data.data; @@ -393,7 +391,8 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, *q = '\0'; - (*names)[i] = strdup(p); + (*names)[i] = talloc_strdup((*names), p); + BAIL_ON_PTR_ERROR(((*names)[i]), wbc_status); p = q+1; } @@ -403,21 +402,23 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, BAIL_ON_WBC_ERROR(wbc_status); } - free(response.extra_data.data); - wbc_status = WBC_ERR_SUCCESS; done: + if (response.extra_data.data) { + free(response.extra_data.data); + } + if (!WBC_ERROR_IS_OK(wbc_status)) { if (domain_name) - free(domain_name); + talloc_free(domain_name); if (*names) - free(*names); + talloc_free(*names); if (*types) - free(*types); + talloc_free(*types); } else { *pp_domain_name = domain_name; } return wbc_status; -} +} diff --git a/source3/nsswitch/libwbclient/wbc_util.c b/source3/nsswitch/libwbclient/wbc_util.c index c6acb27e55..7eb19731a7 100644 --- a/source3/nsswitch/libwbclient/wbc_util.c +++ b/source3/nsswitch/libwbclient/wbc_util.c @@ -51,10 +51,6 @@ wbcErr wbcPing(void) * * @return #wbcErr * - * The char* members of the struct wbcDomainInfo* are malloc()'d - * and it the the responsibility of the caller to free the members - * before discarding the struct. - * **/ -- cgit From 23b3b7c2b3c62f8fdbacb27943f3370407b47857 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Wed, 2 Jan 2008 14:54:25 -0600 Subject: use C99 bool return types (true & false). (This used to be commit f22c9d6296c754d472e8eab51caa058f55ef370e) --- source3/lib/winbind_util.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 2cabf5bcac..3cf068a6e0 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -35,12 +35,12 @@ bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, result = wbcLookupName(dom_name, name, &dom_sid, &type); if (result != WBC_ERR_SUCCESS) - return False; + return false; memcpy(sid, &dom_sid, sizeof(DOM_SID)); *name_type = (enum lsa_SidType)type; - return True; + return true; } /* Call winbindd to convert sid to name */ @@ -59,7 +59,7 @@ bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, result = wbcLookupSid(&dom_sid, &domain_name, &account_name, &type); if (result != WBC_ERR_SUCCESS) - return False; + return false; /* Copy out result */ @@ -79,11 +79,11 @@ bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, if ((domain && !*domain) || (name && !*name)) { DEBUG(0,("winbind_lookup_sid: talloc() failed!\n")); - return False; + return false; } - return True; + return true; } /* Ping winbindd to see it is alive */ @@ -193,7 +193,7 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, ret = wbcLookupRids(&dom_sid, num_rids, rids, &dom_name, &namelist, &name_types); if (ret != WBC_ERR_SUCCESS) { - return False; + return false; } *domain_name = talloc_strdup(mem_ctx, dom_name); @@ -209,7 +209,7 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, wbcFreeMemory(namelist); wbcFreeMemory(name_types); - return True; + return true; } /* Ask Winbind to allocate a new uid for us */ @@ -239,7 +239,7 @@ bool winbind_allocate_gid(gid_t *gid) bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, enum lsa_SidType *name_type) { - return False; + return false; } /* Call winbindd to convert sid to name */ @@ -248,42 +248,42 @@ bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, const char **domain, const char **name, enum lsa_SidType *name_type) { - return False; + return false; } /* Ping winbindd to see it is alive */ bool winbind_ping(void) { - return False; + return false; } /* Call winbindd to convert SID to uid */ bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid) { - return False; + return false; } /* Call winbindd to convert uid to sid */ bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid) { - return False; + return false; } /* Call winbindd to convert SID to gid */ bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid) { - return False; + return false; } /* Call winbindd to convert gid to sid */ bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid) { - return False; + return false; } /* Check for a trusted domain */ @@ -301,21 +301,21 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, const char **domain_name, const char ***names, enum lsa_SidType **types) { - return False; + return false; } /* Ask Winbind to allocate a new uid for us */ bool winbind_allocate_uid(uid_t *uid) { - return False; + return false; } /* Ask Winbind to allocate a new gid for us */ bool winbind_allocate_gid(gid_t *gid) { - return False; + return false; } #endif /* WITH_WINBIND */ -- cgit From 0df7bcaec38432863cde12cf8c15497d2ae30335 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Wed, 2 Jan 2008 17:34:41 -0600 Subject: Fix some C++ warnings (patch was Volker's) - implicit case from void* to char* (This used to be commit 518168410c49ac25085714c73e76dcf358fc4b68) --- source3/nsswitch/libwbclient/wbc_pwd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/nsswitch/libwbclient/wbc_pwd.c b/source3/nsswitch/libwbclient/wbc_pwd.c index 4e3b0d3967..5f7437b188 100644 --- a/source3/nsswitch/libwbclient/wbc_pwd.c +++ b/source3/nsswitch/libwbclient/wbc_pwd.c @@ -228,7 +228,8 @@ wbcErr wbcGetgrnam(const char *name, struct group **grp) &response); BAIL_ON_WBC_ERROR(wbc_status); - *grp = copy_group_entry(&response.data.gr, response.extra_data.data); + *grp = copy_group_entry(&response.data.gr, + (char*)response.extra_data.data); BAIL_ON_PTR_ERROR(*grp, wbc_status); done: @@ -270,7 +271,8 @@ wbcErr wbcGetgrgid(gid_t gid, struct group **grp) &response); BAIL_ON_WBC_ERROR(wbc_status); - *grp = copy_group_entry(&response.data.gr, response.extra_data.data); + *grp = copy_group_entry(&response.data.gr, + (char*)response.extra_data.data); BAIL_ON_PTR_ERROR(*grp, wbc_status); done: -- cgit From 83d74c10a27f2b90682f52fec677bfee67591400 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 00:35:09 +0100 Subject: Rename libnet_smbconf_reg_open_basepath() to libnet_smbconf_reg_open_basekey(). Michael (This used to be commit 9e953a94e9b3a060769938ef6af25623e446c180) --- source3/libnet/libnet_conf.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 21fe8572ea..2de4341e5d 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -93,9 +93,9 @@ done: /* * open the base key KEY_SMBCONF */ -static WERROR libnet_smbconf_reg_open_basepath(TALLOC_CTX *ctx, - uint32 desired_access, - struct registry_key **key) +static WERROR libnet_smbconf_reg_open_basekey(TALLOC_CTX *ctx, + uint32 desired_access, + struct registry_key **key) { return libnet_smbconf_reg_open_path(ctx, NULL, desired_access, key); } @@ -137,8 +137,8 @@ static WERROR libnet_smbconf_reg_createkey_internal(TALLOC_CTX *ctx, goto done; } - werr = libnet_smbconf_reg_open_basepath(create_ctx, REG_KEY_WRITE, - &create_parent); + werr = libnet_smbconf_reg_open_basekey(create_ctx, REG_KEY_WRITE, + &create_parent); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -520,9 +520,9 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, added_count++; } - werr = libnet_smbconf_reg_open_basepath(tmp_ctx, - SEC_RIGHTS_ENUM_SUBKEYS, - &key); + werr = libnet_smbconf_reg_open_basekey(tmp_ctx, + SEC_RIGHTS_ENUM_SUBKEYS, + &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -615,7 +615,7 @@ WERROR libnet_smbconf_delshare(const char *servicename) struct registry_key *key = NULL; TALLOC_CTX *ctx = talloc_stackframe(); - werr = libnet_smbconf_reg_open_basepath(ctx, REG_KEY_WRITE, &key); + werr = libnet_smbconf_reg_open_basekey(ctx, REG_KEY_WRITE, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From 102fda5c2954b620bb68f0c6e4acf1e6510fd62a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 00:43:29 +0100 Subject: Choose a more apropriate parameter name. Michael (This used to be commit 39a73b6291fd028d44fc2712afa76abf1fcff9cb) --- source3/libnet/libnet_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 2de4341e5d..469c72e650 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -565,14 +565,14 @@ done: /** * check if a share/service of a given name exists */ -bool libnet_smbconf_share_exists(const char *subkeyname) +bool libnet_smbconf_share_exists(const char *servicename) { bool ret = false; WERROR werr = WERR_OK; TALLOC_CTX *mem_ctx = talloc_stackframe(); struct registry_key *key = NULL; - werr = libnet_smbconf_reg_open_path(mem_ctx, subkeyname, REG_KEY_READ, + werr = libnet_smbconf_reg_open_path(mem_ctx, servicename, REG_KEY_READ, &key); if (W_ERROR_IS_OK(werr)) { ret = true; -- cgit From d191bb126b778207e1eec7cb03e59554cdc88ada Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 00:44:47 +0100 Subject: Hey, it is 2008 now. :-) Michael (This used to be commit a1d3f60ea753a158447bb0208441453b76a0f3b9) --- source3/libnet/libnet_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 469c72e650..ea8361a873 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -1,7 +1,7 @@ /* * Unix SMB/CIFS implementation. * libnet smbconf registry Support - * Copyright (C) Michael Adam 2007 + * Copyright (C) Michael Adam 2007-2008 * Copyright (C) Guenther Deschner 2007 * * This program is free software; you can redistribute it and/or modify -- cgit From c995a633715fa225637211b88650d9436702778b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 00:49:53 +0100 Subject: Rename libnet_smbconf_reg_open_path() to libnet_smbconf_reg_open_service_key(). Michael (This used to be commit d95b4935d3a97ca9c4b7990bbcf4e85c81c79516) --- source3/libnet/libnet_conf.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ea8361a873..73949de8a1 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -54,13 +54,13 @@ static WERROR libnet_smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, return WERR_OK; } -/* +/** * Open a subkey of KEY_SMBCONF (i.e a service) */ -static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *ctx, - const char *subkeyname, - uint32 desired_access, - struct registry_key **key) +static WERROR libnet_smbconf_reg_open_service_key(TALLOC_CTX *ctx, + const char *subkeyname, + uint32 desired_access, + struct registry_key **key) { WERROR werr = WERR_OK; char *path = NULL; @@ -97,7 +97,8 @@ static WERROR libnet_smbconf_reg_open_basekey(TALLOC_CTX *ctx, uint32 desired_access, struct registry_key **key) { - return libnet_smbconf_reg_open_path(ctx, NULL, desired_access, key); + return libnet_smbconf_reg_open_service_key(ctx, NULL, desired_access, + key); } static bool libnet_smbconf_value_exists(struct registry_key *key, @@ -572,8 +573,8 @@ bool libnet_smbconf_share_exists(const char *servicename) TALLOC_CTX *mem_ctx = talloc_stackframe(); struct registry_key *key = NULL; - werr = libnet_smbconf_reg_open_path(mem_ctx, servicename, REG_KEY_READ, - &key); + werr = libnet_smbconf_reg_open_service_key(mem_ctx, servicename, + REG_KEY_READ, &key); if (W_ERROR_IS_OK(werr)) { ret = true; } @@ -592,8 +593,8 @@ WERROR libnet_smbconf_getshare(TALLOC_CTX *mem_ctx, const char *servicename, WERROR werr = WERR_OK; struct registry_key *key = NULL; - werr = libnet_smbconf_reg_open_path(mem_ctx, servicename, REG_KEY_READ, - &key); + werr = libnet_smbconf_reg_open_service_key(mem_ctx, servicename, + REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -642,8 +643,8 @@ WERROR libnet_smbconf_setparm(const char *service, werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service, &key); } else { - werr = libnet_smbconf_reg_open_path(mem_ctx, service, - REG_KEY_WRITE, &key); + werr = libnet_smbconf_reg_open_service_key(mem_ctx, service, + REG_KEY_WRITE, &key); } if (!W_ERROR_IS_OK(werr)) { goto done; @@ -678,8 +679,8 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - werr = libnet_smbconf_reg_open_path(mem_ctx, service, REG_KEY_READ, - &key); + werr = libnet_smbconf_reg_open_service_key(mem_ctx, service, + REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -720,7 +721,8 @@ WERROR libnet_smbconf_delparm(const char *service, return WERR_NO_SUCH_SERVICE; } - werr = libnet_smbconf_reg_open_path(mem_ctx, service, REG_KEY_ALL, &key); + werr = libnet_smbconf_reg_open_service_key(mem_ctx, service, + REG_KEY_ALL, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From a6fb71e55b583119c28e74e8aa54dd1b5a0fc3af Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 00:51:36 +0100 Subject: Use a better parameter name. Michael (This used to be commit 3972deb90c4b645fb4d207a7e132cd7e180e78bb) --- source3/libnet/libnet_conf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 73949de8a1..144026dbb5 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -58,7 +58,7 @@ static WERROR libnet_smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, * Open a subkey of KEY_SMBCONF (i.e a service) */ static WERROR libnet_smbconf_reg_open_service_key(TALLOC_CTX *ctx, - const char *subkeyname, + const char *servicename, uint32 desired_access, struct registry_key **key) { @@ -71,10 +71,10 @@ static WERROR libnet_smbconf_reg_open_service_key(TALLOC_CTX *ctx, goto done; } - if (subkeyname == NULL) { + if (servicename == NULL) { path = talloc_strdup(ctx, KEY_SMBCONF); } else { - path = talloc_asprintf(ctx, "%s\\%s", KEY_SMBCONF, subkeyname); + path = talloc_asprintf(ctx, "%s\\%s", KEY_SMBCONF, servicename); } werr = reg_open_path(ctx, path, desired_access, -- cgit From b344dafa62a6d9e4af1063f612150cc9f9fe3b81 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 00:52:55 +0100 Subject: Fix setting of error code in error path. Michael (This used to be commit 8a7954a9ae13df527ccedb1004ee4f87d506ce5b) --- source3/libnet/libnet_conf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 144026dbb5..514fd245ad 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -68,6 +68,8 @@ static WERROR libnet_smbconf_reg_open_service_key(TALLOC_CTX *ctx, if (!(token = registry_create_admin_token(ctx))) { DEBUG(1, ("Error creating admin token\n")); + /* what is the appropriate error code here? */ + werr = WERR_CAN_NOT_COMPLETE; goto done; } -- cgit From f9bb8a345ed311f74adc30b164383170048b8dc5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 00:53:34 +0100 Subject: Add debug output in error path. Michael (This used to be commit a58ccbc6d70613f7572bc80621935d81f9e290e3) --- source3/libnet/libnet_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 514fd245ad..7980dbbe4c 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -371,6 +371,7 @@ WERROR libnet_smbconf_drop(void) enum winreg_CreateAction action; if (!(token = registry_create_admin_token(mem_ctx))) { + DEBUG(1, ("Error creating admin token\n")); /* what is the appropriate error code here? */ werr = WERR_CAN_NOT_COMPLETE; goto done; -- cgit From 3bf57a4d824b75dcbfea074e4e10d57f1d907682 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 01:07:30 +0100 Subject: Abstract opening of registry path out of libnet_smbconf_reg_open_service_key(). Creates new function libnet_smbconf_reg_open_path(). Use libnet_smbconf_reg_open_path() directly in libnet_smbconf_reg_open_basekey(). Return error in libnet_smbconf_reg_open_service_key() when NULL servicename is given. Michael (This used to be commit 1e46b479638c54e8bd7ba939bc7aba18a27b5155) --- source3/libnet/libnet_conf.c | 57 +++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 7980dbbe4c..0bc7c63471 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -57,36 +57,61 @@ static WERROR libnet_smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, /** * Open a subkey of KEY_SMBCONF (i.e a service) */ -static WERROR libnet_smbconf_reg_open_service_key(TALLOC_CTX *ctx, - const char *servicename, - uint32 desired_access, - struct registry_key **key) +static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx, + const char *path, + uint32 desired_access, + struct registry_key **key) { WERROR werr = WERR_OK; - char *path = NULL; NT_USER_TOKEN *token; - if (!(token = registry_create_admin_token(ctx))) { + if (path == NULL) { + DEBUG(1, ("Error: NULL path string given\n")); + werr = WERR_INVALID_PARAM; + goto done; + } + + token = registry_create_admin_token(mem_ctx); + if (token == NULL) { DEBUG(1, ("Error creating admin token\n")); /* what is the appropriate error code here? */ werr = WERR_CAN_NOT_COMPLETE; goto done; } - if (servicename == NULL) { - path = talloc_strdup(ctx, KEY_SMBCONF); - } else { - path = talloc_asprintf(ctx, "%s\\%s", KEY_SMBCONF, servicename); - } - - werr = reg_open_path(ctx, path, desired_access, - token, key); + werr = reg_open_path(mem_ctx, path, desired_access, token, key); if (!W_ERROR_IS_OK(werr)) { DEBUG(1, ("Error opening registry path '%s': %s\n", path, dos_errstr(werr))); } +done: + return werr; +} + +/** + * Open a subkey of KEY_SMBCONF (i.e a service) + */ +static WERROR libnet_smbconf_reg_open_service_key(TALLOC_CTX *ctx, + const char *servicename, + uint32 desired_access, + struct registry_key **key) +{ + WERROR werr = WERR_OK; + char *path = NULL; + NT_USER_TOKEN *token; + + if (servicename == NULL) { + DEBUG(3, ("Error: NULL servicename given.\n")); + werr = WERR_INVALID_PARAM; + goto done; + } + + path = talloc_asprintf(ctx, "%s\\%s", KEY_SMBCONF, servicename); + + werr = libnet_smbconf_reg_open_path(ctx, path, desired_access, key); + done: TALLOC_FREE(path); return werr; @@ -99,8 +124,8 @@ static WERROR libnet_smbconf_reg_open_basekey(TALLOC_CTX *ctx, uint32 desired_access, struct registry_key **key) { - return libnet_smbconf_reg_open_service_key(ctx, NULL, desired_access, - key); + return libnet_smbconf_reg_open_path(ctx, KEY_SMBCONF, desired_access, + key); } static bool libnet_smbconf_value_exists(struct registry_key *key, -- cgit From 3c9f7c7a64e886ae54beb4242b227a9a223520e1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 01:12:23 +0100 Subject: Use libnet_smbconf_reg_open_path() in libnet_smbconf_drop(). Replaces creation of token and direct use of reg_open_path. Michael (This used to be commit 7e407e18be0761e7004acfbd2376c3a435922c25) --- source3/libnet/libnet_conf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 0bc7c63471..ca5b0c408f 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -395,13 +395,6 @@ WERROR libnet_smbconf_drop(void) TALLOC_CTX* mem_ctx = talloc_stackframe(); enum winreg_CreateAction action; - if (!(token = registry_create_admin_token(mem_ctx))) { - DEBUG(1, ("Error creating admin token\n")); - /* what is the appropriate error code here? */ - werr = WERR_CAN_NOT_COMPLETE; - goto done; - } - path = talloc_strdup(mem_ctx, KEY_SMBCONF); if (path == NULL) { werr = WERR_NOMEM; @@ -409,7 +402,8 @@ WERROR libnet_smbconf_drop(void) } p = strrchr(path, '\\'); *p = '\0'; - werr = reg_open_path(mem_ctx, path, REG_KEY_WRITE, token, &parent_key); + werr = libnet_smbconf_reg_open_path(mem_ctx, path, REG_KEY_WRITE, + &parent_key); if (!W_ERROR_IS_OK(werr)) { goto done; -- cgit From ad1cc905b2eef9ebfe727a6061aec62a22574c8b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 01:26:31 +0100 Subject: Don't leak: Use a temporary context for the admin token and free it. Michael (This used to be commit 9d7502115e0f6cdfd27943d52f0de04447582b92) --- source3/libnet/libnet_conf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ca5b0c408f..995fc1b303 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -64,6 +64,7 @@ static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx, { WERROR werr = WERR_OK; NT_USER_TOKEN *token; + TALLOC_CTX *tmp_ctx = NULL; if (path == NULL) { DEBUG(1, ("Error: NULL path string given\n")); @@ -71,7 +72,13 @@ static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx, goto done; } - token = registry_create_admin_token(mem_ctx); + tmp_ctx = talloc_new(mem_ctx); + if (tmp_ctx == NULL) { + werr = WERR_NOMEM; + goto done; + } + + token = registry_create_admin_token(tmp_ctx); if (token == NULL) { DEBUG(1, ("Error creating admin token\n")); /* what is the appropriate error code here? */ @@ -87,6 +94,7 @@ static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx, } done: + TALLOC_FREE(tmp_ctx); return werr; } -- cgit From cc957c7f6d1956740feb7169b45f388d387e175a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 2 Jan 2008 17:37:39 -0800 Subject: Convert the little caches in util_sock.c to use the singleton memcache. Vl please check (passes make valgrindtest). Jeremy. (This used to be commit a4d613cde86caf5782c4bfc47122d6ba807990ac) --- source3/lib/util_sock.c | 165 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 118 insertions(+), 47 deletions(-) diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index d16a8f079a..013a5fe29f 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1824,18 +1824,67 @@ static bool matchname(const char *remotehost, return false; } -static struct { - struct sockaddr_storage ss; - char *name; -} nc; +/******************************************************************* + Deal with the singleton cache. +******************************************************************/ + +struct name_addr_pair { + struct sockaddr_storage ss; + const char *name; +}; + +/******************************************************************* + Lookup a name/addr pair. Returns memory allocated from memcache. +******************************************************************/ + +static bool lookup_nc(struct name_addr_pair *nc) +{ + DATA_BLOB tmp; + + ZERO_STRUCTP(nc); + + if (!memcache_lookup( + NULL, SINGLETON_CACHE, + data_blob_string_const("get_peer_name"), + &tmp)) { + return false; + } + + memcpy(&nc->ss, tmp.data, sizeof(nc->ss)); + nc->name = (const char *)tmp.data + sizeof(nc->ss); + return true; +} + +/******************************************************************* + Save a name/addr pair. +******************************************************************/ + +static void store_nc(const struct name_addr_pair *nc) +{ + DATA_BLOB tmp; + size_t namelen = strlen(nc->name); + + tmp.length = sizeof(nc->ss) + namelen + 1; + tmp.data = (uint8_t *)SMB_MALLOC(tmp.length); + if (!tmp.data) { + return; + } + memcpy(tmp.data, &nc->ss, sizeof(nc->ss)); + memcpy(tmp.data+sizeof(nc->ss), nc->name, namelen+1); + + memcache_add(NULL, SINGLETON_CACHE, + data_blob_string_const("get_peer_name"), + tmp); + SAFE_FREE(tmp.data); +} /******************************************************************* Return the DNS name of the remote end of a socket. ******************************************************************/ -const char *get_peer_name(int fd, - bool force_lookup) +const char *get_peer_name(int fd, bool force_lookup) { + struct name_addr_pair nc; char addr_buf[INET6_ADDRSTRLEN]; struct sockaddr_storage ss; socklen_t length = sizeof(ss); @@ -1850,13 +1899,15 @@ const char *get_peer_name(int fd, possible */ if (!lp_hostname_lookups() && (force_lookup == false)) { length = sizeof(nc.ss); - p = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf), + nc.name = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf), &nc.ss, &length); - SAFE_FREE(nc.name); - nc.name = SMB_STRDUP(p); + store_nc(&nc); + lookup_nc(&nc); return nc.name ? nc.name : "UNKNOWN"; } + lookup_nc(&nc); + memset(&ss, '\0', sizeof(ss)); p = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf), &ss, &length); @@ -1865,9 +1916,7 @@ const char *get_peer_name(int fd, return nc.name ? nc.name : "UNKNOWN"; } - /* Not the same. Reset the cache. */ - zero_addr(&nc.ss); - SAFE_FREE(nc.name); + /* Not the same. We need to lookup. */ if (fd == -1) { return "UNKNOWN"; } @@ -1904,7 +1953,11 @@ const char *get_peer_name(int fd, strlcpy(name_buf, "UNKNOWN", sizeof(name_buf)); } - nc.name = SMB_STRDUP(name_buf); + nc.name = name_buf; + nc.ss = ss; + + store_nc(&nc); + lookup_nc(&nc); return nc.name ? nc.name : "UNKNOWN"; } @@ -2026,50 +2079,68 @@ out_umask: const char *get_mydnsfullname(void) { - static char *dnshostname_cache; - - if (dnshostname_cache == NULL || !*dnshostname_cache) { - struct addrinfo *res = NULL; - char my_hostname[HOST_NAME_MAX]; - bool ret; + struct addrinfo *res = NULL; + char my_hostname[HOST_NAME_MAX]; + bool ret; + DATA_BLOB tmp; - /* get my host name */ - if (gethostname(my_hostname, sizeof(my_hostname)) == -1) { - DEBUG(0,("get_mydnsfullname: gethostname failed\n")); - return NULL; - } + if (memcache_lookup(NULL, SINGLETON_CACHE, + data_blob_string_const("get_mydnsfullname"), + &tmp)) { + SMB_ASSERT(tmp.length > 0); + return (const char *)tmp.data; + } - /* Ensure null termination. */ - my_hostname[sizeof(my_hostname)-1] = '\0'; + /* get my host name */ + if (gethostname(my_hostname, sizeof(my_hostname)) == -1) { + DEBUG(0,("get_mydnsfullname: gethostname failed\n")); + return NULL; + } - ret = interpret_string_addr_internal(&res, - my_hostname, - AI_ADDRCONFIG|AI_CANONNAME); + /* Ensure null termination. */ + my_hostname[sizeof(my_hostname)-1] = '\0'; - if (!ret || res == NULL) { - DEBUG(3,("get_mydnsfullname: getaddrinfo failed for " - "name %s [%s]\n", + ret = interpret_string_addr_internal(&res, my_hostname, - gai_strerror(ret) )); - return NULL; - } + AI_ADDRCONFIG|AI_CANONNAME); - /* - * Make sure that getaddrinfo() returns the "correct" host name. - */ + if (!ret || res == NULL) { + DEBUG(3,("get_mydnsfullname: getaddrinfo failed for " + "name %s [%s]\n", + my_hostname, + gai_strerror(ret) )); + return NULL; + } - if (res->ai_canonname == NULL) { - DEBUG(3,("get_mydnsfullname: failed to get " - "canonical name for %s\n", - my_hostname)); - freeaddrinfo(res); - return NULL; - } + /* + * Make sure that getaddrinfo() returns the "correct" host name. + */ - dnshostname_cache = SMB_STRDUP(res->ai_canonname); + if (res->ai_canonname == NULL) { + DEBUG(3,("get_mydnsfullname: failed to get " + "canonical name for %s\n", + my_hostname)); freeaddrinfo(res); + return NULL; + } + + /* This copies the data, so we must do a lookup + * afterwards to find the value to return. + */ + + memcache_add(NULL, SINGLETON_CACHE, + data_blob_string_const("get_mydnsfullname"), + data_blob_string_const(res->ai_canonname)); + + freeaddrinfo(res); + + if (!memcache_lookup(NULL, SINGLETON_CACHE, + data_blob_string_const("get_mydnsfullname"), + &tmp)) { + return NULL; } - return dnshostname_cache; + + return (const char *)tmp.data; } /************************************************************ -- cgit From cfcdeb52bf0184874980aebaea602bd2ee5ee411 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 2 Jan 2008 18:20:23 -0800 Subject: Fix for bug #5163 from Laurent Pinchart Failure to change password in ldap is mapped to NT_STATUS_UNSUCCESSFUL unconditionally. Jeremy. (This used to be commit 9369d6e907a49da1fbf2a5690118412b8d1a0383) --- source3/passdb/pdb_ldap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index b638219466..205b178a93 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -1768,6 +1768,10 @@ static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods, pdb_get_username(newpwd), ldap_err2string(rc), ld_error?ld_error:"unknown")); SAFE_FREE(ld_error); ber_bvfree(bv); +#if defined(LDAP_CONSTRAINT_VIOLATION) + if (rc == LDAP_CONSTRAINT_VIOLATION) + return NT_STATUS_PASSWORD_RESTRICTION; +#endif return NT_STATUS_UNSUCCESSFUL; } else { DEBUG(3,("ldapsam_modify_entry: LDAP Password changed for user %s\n",pdb_get_username(newpwd))); -- cgit From 2242f2673c66bcce530e5134920ed041e6b31af7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 3 Jan 2008 10:24:11 +0100 Subject: Add comments Jeremy was able to use this correctly without comments, so the code can't be *that* bad :-) (This used to be commit 6f22f7c13fd08ee772ac3aa593d2f4b37eb2cbee) --- source3/include/memcache.h | 55 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/source3/include/memcache.h b/source3/include/memcache.h index 5a0ce63cb7..0a596b91a5 100644 --- a/source3/include/memcache.h +++ b/source3/include/memcache.h @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. In-memory cache - Copyright (C) Volker Lendecke 2005-2007 + Copyright (C) Volker Lendecke 2007-2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,6 +24,15 @@ struct memcache; +/* + * A memcache can store different subkeys with overlapping keys, the + * memcache_number becomes part of the key. Feel free to add caches of your + * own here. + * + * If you add talloc type caches, also note this in the switch statement in + * memcache_is_talloc(). + */ + enum memcache_number { STAT_CACHE, UID_SID_CACHE, @@ -38,25 +47,69 @@ enum memcache_number { SINGLETON_CACHE }; +/* + * Create a memcache structure. max_size is in bytes, if you set it 0 it will + * not forget anything. + */ + struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size); +/* + * If you set this global memcache, use it as the default cache when NULL is + * passed to the memcache functions below. This is a workaround for many + * situations where passing the cache everywhere would be a big hassle. + */ + void memcache_set_global(struct memcache *cache); +/* + * Add a data blob to the cache + */ + void memcache_add(struct memcache *cache, enum memcache_number n, DATA_BLOB key, DATA_BLOB value); +/* + * Add a talloc object to the cache. The difference to memcache_add() is that + * when the objects is to be discared, talloc_free is called for it. Also + * talloc_move() ownership of the object to the cache. + * + * Please note that the current implementation has a fixed relationship + * between what cache subtypes store talloc objects and which ones store plain + * blobs. We can fix this, but for now we don't have a mixed use of blobs vs + * talloc objects in the cache types. + */ + void memcache_add_talloc(struct memcache *cache, enum memcache_number n, DATA_BLOB key, void *ptr); +/* + * Delete an object from the cache + */ + void memcache_delete(struct memcache *cache, enum memcache_number n, DATA_BLOB key); +/* + * Look up an object from the cache. Memory still belongs to the cache, so + * make a copy of it if needed. + */ + bool memcache_lookup(struct memcache *cache, enum memcache_number n, DATA_BLOB key, DATA_BLOB *value); +/* + * Look up an object from the cache. Memory still belongs to the cache, so + * make a copy of it if needed. + */ + void *memcache_lookup_talloc(struct memcache *cache, enum memcache_number n, DATA_BLOB key); +/* + * Flush a complete cache subset. + */ + void memcache_flush(struct memcache *cache, enum memcache_number n); #endif -- cgit From 149e86b8427359042830faddad10a103f51184da Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 3 Jan 2008 10:24:45 +0100 Subject: Trivial simplification ... things you come across when you review code (This used to be commit 1e006bcfb15d44ecb81b6994c588d30d87b48033) --- source3/lib/util_sock.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 013a5fe29f..b92cd3d624 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1864,8 +1864,7 @@ static void store_nc(const struct name_addr_pair *nc) DATA_BLOB tmp; size_t namelen = strlen(nc->name); - tmp.length = sizeof(nc->ss) + namelen + 1; - tmp.data = (uint8_t *)SMB_MALLOC(tmp.length); + tmp = data_blob(NULL, sizeof(nc->ss) + namelen + 1); if (!tmp.data) { return; } @@ -1875,7 +1874,7 @@ static void store_nc(const struct name_addr_pair *nc) memcache_add(NULL, SINGLETON_CACHE, data_blob_string_const("get_peer_name"), tmp); - SAFE_FREE(tmp.data); + data_blob_free(&tmp); } /******************************************************************* -- cgit From 40079c4eb47b590a88ac8d568a5d5f039bc02af6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 10:39:19 +0100 Subject: Remove unused vars. Guenther (This used to be commit ff3f0006d167a9bca85919bf6115d73413554909) --- source3/libnet/libnet_conf.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 995fc1b303..ebdfd75744 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -108,7 +108,6 @@ static WERROR libnet_smbconf_reg_open_service_key(TALLOC_CTX *ctx, { WERROR werr = WERR_OK; char *path = NULL; - NT_USER_TOKEN *token; if (servicename == NULL) { DEBUG(3, ("Error: NULL servicename given.\n")); @@ -397,7 +396,6 @@ WERROR libnet_smbconf_drop(void) { char *path, *p; WERROR werr = WERR_OK; - NT_USER_TOKEN *token; struct registry_key *parent_key = NULL; struct registry_key *new_key = NULL; TALLOC_CTX* mem_ctx = talloc_stackframe(); -- cgit From fd597c7e6d1b5d89c75dd24f2b62916ec81a67ae Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 11:30:14 +0100 Subject: Add libnet_conf API function libnet_smbconf_create_share(). And make libnet_smbconf_setparm() return error if the share does not already exist. Adapt net_conf_addshare to this new situation. Michael (This used to be commit de349bd26db3341815f6d8f6c18a5ca1fd664dca) --- source3/libnet/libnet_conf.c | 31 ++++++++++++++++++++++++++----- source3/utils/net_conf.c | 13 ++++++++++++- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ebdfd75744..2c67d4735e 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -611,6 +611,27 @@ bool libnet_smbconf_share_exists(const char *servicename) return ret; } +/** + * Add a service if it does not already exist. + */ +WERROR libnet_smbconf_create_share(const char *servicename) +{ + WERROR werr; + TALLOC_CTX *mem_ctx = talloc_stackframe(); + struct registry_key *key = NULL; + + if (libnet_smbconf_share_exists(servicename)) { + werr = WERR_ALREADY_EXISTS; + goto done; + } + + werr = libnet_smbconf_reg_createkey_internal(mem_ctx, servicename, &key); + +done: + TALLOC_FREE(mem_ctx); + return werr; +} + /** * get a definition of a share (service) from configuration. */ @@ -668,12 +689,12 @@ WERROR libnet_smbconf_setparm(const char *service, TALLOC_CTX *mem_ctx = talloc_stackframe(); if (!libnet_smbconf_share_exists(service)) { - werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service, - &key); - } else { - werr = libnet_smbconf_reg_open_service_key(mem_ctx, service, - REG_KEY_WRITE, &key); + werr = WERR_NO_SUCH_SERVICE; + goto done; } + + werr = libnet_smbconf_reg_open_service_key(mem_ctx, service, + REG_KEY_WRITE, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 07eb3b890f..feee16f564 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -628,7 +628,18 @@ static int net_conf_addshare(int argc, const char **argv) } /* - * create the share by adding the parameters + * create the share + */ + + werr = libnet_smbconf_create_share(sharename); + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error creating share %s: %s\n", + sharename, dos_errstr(werr)); + goto done; + } + + /* + * fill the share with parameters */ werr = libnet_smbconf_setparm(sharename, "path", path); -- cgit From a750e223b3c6e78aa911a52eaa62c85af62f842b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 11:32:00 +0100 Subject: Rename libnet_smbconf_reg_createkey_internal to libnet_smbconf_reg_create_service_key. Michael (This used to be commit 08056a2c8160a44d27744467da467faea9ba0686) --- source3/libnet/libnet_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 2c67d4735e..f435882b3b 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -155,7 +155,7 @@ static bool libnet_smbconf_value_exists(struct registry_key *key, /* * create a subkey of KEY_SMBCONF */ -static WERROR libnet_smbconf_reg_createkey_internal(TALLOC_CTX *ctx, +static WERROR libnet_smbconf_reg_create_service_key(TALLOC_CTX *ctx, const char * subkeyname, struct registry_key **newkey) { @@ -625,7 +625,7 @@ WERROR libnet_smbconf_create_share(const char *servicename) goto done; } - werr = libnet_smbconf_reg_createkey_internal(mem_ctx, servicename, &key); + werr = libnet_smbconf_reg_create_service_key(mem_ctx, servicename, &key); done: TALLOC_FREE(mem_ctx); -- cgit From e0ea759807882091fac07e7b200ad82bc78fcc4f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 11:33:17 +0100 Subject: Fix a comment. Michael (This used to be commit 2d0c7fe44f075205db1713ef2d69006f7192c490) --- source3/libnet/libnet_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index f435882b3b..304c53c0d0 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -55,7 +55,7 @@ static WERROR libnet_smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, } /** - * Open a subkey of KEY_SMBCONF (i.e a service) + * Open a registry key specified by "path" */ static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx, const char *path, -- cgit From 984aa7a1560a4d052a0c8260d230be4b89303bd7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 11:35:21 +0100 Subject: Rename libnet_smbconf_reg_setvalue_internal() to libnet_smbconf_reg_set_value(). Michael (This used to be commit 3fc3fee88afd9e8b6232afc140a07090b4215c23) --- source3/libnet/libnet_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 304c53c0d0..01c4237f20 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -197,9 +197,9 @@ done: /* * add a value to a key. */ -static WERROR libnet_smbconf_reg_setvalue_internal(struct registry_key *key, - const char *valname, - const char *valstr) +static WERROR libnet_smbconf_reg_set_value(struct registry_key *key, + const char *valname, + const char *valstr) { struct registry_value val; WERROR werr = WERR_OK; @@ -699,7 +699,7 @@ WERROR libnet_smbconf_setparm(const char *service, goto done; } - werr = libnet_smbconf_reg_setvalue_internal(key, param, valstr); + werr = libnet_smbconf_reg_set_value(key, param, valstr); done: TALLOC_FREE(mem_ctx); -- cgit From 0240d175bf896230891a3ffadba747a0143d9232 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 12:07:02 +0100 Subject: Return existsing cache_tree if it has already been initialized. So reghook_cache_init() does not leak memory when called more than once. Also, fix the return value while we are at it. Michael (This used to be commit 25f571f40a630bff5a47bba6b01e42d4e0ffed66) --- source3/registry/reg_cachehook.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source3/registry/reg_cachehook.c b/source3/registry/reg_cachehook.c index 289d4e50ce..74670aac30 100644 --- a/source3/registry/reg_cachehook.c +++ b/source3/registry/reg_cachehook.c @@ -25,19 +25,21 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY -static SORTED_TREE *cache_tree; +static SORTED_TREE *cache_tree = NULL; extern REGISTRY_OPS regdb_ops; /* these are the default */ static REGISTRY_HOOK default_hook = { KEY_TREE_ROOT, ®db_ops }; /********************************************************************** - Initialize the cache tree + Initialize the cache tree if it has not been initialized yet. *********************************************************************/ bool reghook_cache_init( void ) { - cache_tree = pathtree_init( &default_hook, NULL ); + if (cache_tree == NULL) { + cache_tree = pathtree_init(&default_hook, NULL); + } - return ( cache_tree == NULL ); + return (cache_tree != NULL); } /********************************************************************** -- cgit From 2c072ac87910208780a8e03cb3cea687d874b613 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 12:10:27 +0100 Subject: Some coding convention pedantism. Guenther (This used to be commit 338baf96cb957fa52e312d42fbf0fa227d7dafda) --- source3/nsswitch/libwbclient/wbc_pam.c | 4 ++-- source3/nsswitch/libwbclient/wbc_pwd.c | 6 +++--- source3/nsswitch/libwbclient/wbc_sid.c | 10 +++++----- source3/nsswitch/libwbclient/wbc_util.c | 12 ++++++------ source3/nsswitch/libwbclient/wbclient.h | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/source3/nsswitch/libwbclient/wbc_pam.c b/source3/nsswitch/libwbclient/wbc_pam.c index 1548c3344a..7f7c7b8140 100644 --- a/source3/nsswitch/libwbclient/wbc_pam.c +++ b/source3/nsswitch/libwbclient/wbc_pam.c @@ -31,7 +31,7 @@ * @return #wbcErr **/ -wbcErr wbcAuthenticateUser(const char *username, +wbcErr wbcAuthenticateUser(const char *username, const char *password) { wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; @@ -61,5 +61,5 @@ wbcErr wbcAuthenticateUser(const char *username, BAIL_ON_WBC_ERROR(wbc_status); done: - return wbc_status; + return wbc_status; } diff --git a/source3/nsswitch/libwbclient/wbc_pwd.c b/source3/nsswitch/libwbclient/wbc_pwd.c index 5f7437b188..b24e198bc5 100644 --- a/source3/nsswitch/libwbclient/wbc_pwd.c +++ b/source3/nsswitch/libwbclient/wbc_pwd.c @@ -228,14 +228,14 @@ wbcErr wbcGetgrnam(const char *name, struct group **grp) &response); BAIL_ON_WBC_ERROR(wbc_status); - *grp = copy_group_entry(&response.data.gr, + *grp = copy_group_entry(&response.data.gr, (char*)response.extra_data.data); BAIL_ON_PTR_ERROR(*grp, wbc_status); done: if (response.extra_data.data) free(response.extra_data.data); - + return wbc_status; } @@ -271,7 +271,7 @@ wbcErr wbcGetgrgid(gid_t gid, struct group **grp) &response); BAIL_ON_WBC_ERROR(wbc_status); - *grp = copy_group_entry(&response.data.gr, + *grp = copy_group_entry(&response.data.gr, (char*)response.extra_data.data); BAIL_ON_PTR_ERROR(*grp, wbc_status); diff --git a/source3/nsswitch/libwbclient/wbc_sid.c b/source3/nsswitch/libwbclient/wbc_sid.c index 8311a21a86..abe1457cc1 100644 --- a/source3/nsswitch/libwbclient/wbc_sid.c +++ b/source3/nsswitch/libwbclient/wbc_sid.c @@ -392,7 +392,7 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, *q = '\0'; (*names)[i] = talloc_strdup((*names), p); - BAIL_ON_PTR_ERROR(((*names)[i]), wbc_status); + BAIL_ON_PTR_ERROR(((*names)[i]), wbc_status); p = q+1; } @@ -405,10 +405,10 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, wbc_status = WBC_ERR_SUCCESS; done: - if (response.extra_data.data) { + if (response.extra_data.data) { free(response.extra_data.data); - } - + } + if (!WBC_ERROR_IS_OK(wbc_status)) { if (domain_name) talloc_free(domain_name); @@ -421,4 +421,4 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid, } return wbc_status; -} +} diff --git a/source3/nsswitch/libwbclient/wbc_util.c b/source3/nsswitch/libwbclient/wbc_util.c index 7eb19731a7..ff3cec8689 100644 --- a/source3/nsswitch/libwbclient/wbc_util.c +++ b/source3/nsswitch/libwbclient/wbc_util.c @@ -60,7 +60,7 @@ wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo) struct winbindd_response response; wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; struct wbcDomainInfo *info = NULL; - + if (!domain || !dinfo) { wbc_status = WBC_ERR_INVALID_PARAM; BAIL_ON_WBC_ERROR(wbc_status); @@ -71,7 +71,7 @@ wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo) ZERO_STRUCT(request); ZERO_STRUCT(response); - strncpy(request.domain_name, domain, + strncpy(request.domain_name, domain, sizeof(request.domain_name)-1); wbc_status = wbcRequestResponse(WINBINDD_DOMAIN_INFO, @@ -82,15 +82,15 @@ wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo) info = talloc(NULL, struct wbcDomainInfo); BAIL_ON_PTR_ERROR(info, wbc_status); - info->short_name = talloc_strdup(info, + info->short_name = talloc_strdup(info, response.data.domain_info.name); BAIL_ON_PTR_ERROR(info->short_name, wbc_status); - info->dns_name = talloc_strdup(info, + info->dns_name = talloc_strdup(info, response.data.domain_info.alt_name); BAIL_ON_PTR_ERROR(info->dns_name, wbc_status); - wbc_status = wbcStringToSid(response.data.domain_info.sid, + wbc_status = wbcStringToSid(response.data.domain_info.sid, &info->sid); BAIL_ON_WBC_ERROR(wbc_status); @@ -102,7 +102,7 @@ wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo) info->flags |= WBC_DOMINFO_PRIMARY; *dinfo = info; - + wbc_status = WBC_ERR_SUCCESS; done: diff --git a/source3/nsswitch/libwbclient/wbclient.h b/source3/nsswitch/libwbclient/wbclient.h index 2867aad69e..6b85d7e8b3 100644 --- a/source3/nsswitch/libwbclient/wbclient.h +++ b/source3/nsswitch/libwbclient/wbclient.h @@ -177,7 +177,7 @@ wbcErr wbcDomainSequenceNumbers(void); * Athenticate functions */ -wbcErr wbcAuthenticateUser(const char *username, +wbcErr wbcAuthenticateUser(const char *username, const char *password); -- cgit From 40328027211ed915a83e47200dcd34c9f919e192 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 12:13:20 +0100 Subject: Ignore generated pkgconfig files. Guenther (This used to be commit 1688eae5e868744fb209f59ed526b1a91d1fe0db) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d3266edbbe..00ad9c82c0 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ source/proto_exists source/winbindd/winbindd_proto.h source/cscope.out source/torture.tdb +source/pkgconfig/*.pc -- cgit From b0994bead72bcd5f4346592be8264f5056612c95 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 13:17:15 +0100 Subject: In libnetjoin don't mix admin password with machine account pwd. Guenther (This used to be commit 5b2eec21c27f07653e2dbb75c0f9ab4a60736773) --- source3/libnet/libnet_join.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 6edcdb8945..ae3ed060fe 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -152,8 +152,8 @@ static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, goto done; } - E_md4hash(r->in.password, md4_trust_password); - encode_pw_buffer(pwbuf, r->in.password, STR_UNICODE); + E_md4hash(password, md4_trust_password); + encode_pw_buffer(pwbuf, password, STR_UNICODE); generate_random_buffer((uint8*)md5buffer, sizeof(md5buffer)); digested_session_key = data_blob_talloc(mem_ctx, 0, 16); -- cgit From 98ae29c26a7930ad93061a07145bde19956b791d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 13:34:40 +0100 Subject: Fix configure output for libnetapi. Guenther (This used to be commit d00ce6685a2cad7cd5526d4b13d43d157cd13481) --- source3/configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/configure.in b/source3/configure.in index d7fde01619..d51134dd73 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -5102,7 +5102,7 @@ LIBNETAPI_SHARED= LIBNETAPI= AC_MSG_CHECKING(whether to build the libnetapi shared library) AC_ARG_WITH(libnetapi, -[ --with-libnetapi Build the libnetapi shared library (default=no undefined API)], +[ --with-libnetapi Build the libnetapi shared library (default=yes if shared libs supported)], [ case "$withval" in *) AC_MSG_RESULT(no) -- cgit From 6afaafe083ad23e51743ccd5245cf7384b2c4bd9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 13:36:56 +0100 Subject: Let DsGetDCName figure out whether domain_name is a flat_name when unjoining. Guenther (This used to be commit 75165ba4e7acafaca42f6afd1fb8b56e00bcbed7) --- source3/lib/netapi/joindomain.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index e3d5eada02..60f48a7b5e 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -233,7 +233,6 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED | DS_WRITABLE_REQUIRED | - DS_IS_FLAT_NAME | DS_RETURN_DNS_NAME; if (lp_realm()) { domain = lp_realm(); -- cgit From 53e1014472fd42f62f62b0b671e89422326d9240 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 13:40:42 +0100 Subject: Use -g instead of -gstabs as many have reported gdb problems with -gstabs. Guenther (This used to be commit 8befb22672d54a9255e5bdaf9cb0bb4e2b631245) --- source3/configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/configure.in b/source3/configure.in index d51134dd73..934a99462b 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -455,7 +455,7 @@ AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer Turn on developer warnin # DEVELOPER_CFLAGS, so that you can turn them on and off with a simple # Makefile edit, avoiding the need to re-run configure. if test x"$ac_cv_prog_gcc" = x"yes" ; then - DEVELOPER_CFLAGS="-gstabs -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER" + DEVELOPER_CFLAGS="-g -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER" # Add -Wdeclaration-after-statement if compiler supports it AC_CACHE_CHECK( [that the C compiler understands -Wdeclaration-after-statement], -- cgit From 78acbddbd51a8201100a958447265ad9d7f46229 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 12:08:49 +0100 Subject: Happy new year again. Michael (This used to be commit e568f42e2146fa6510a86746581409450887ff16) --- source3/utils/net_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index feee16f564..6c61c24a52 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -2,7 +2,7 @@ * Samba Unix/Linux SMB client library * Distributed SMB/CIFS Server Management Utility * Local configuration interface - * Copyright (C) Michael Adam 2007 + * Copyright (C) Michael Adam 2007-2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by -- cgit From 46123918506112d02db42e19407057dd943b8720 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:31:23 +0100 Subject: Rename libnet_smbconf_add_string_to_array() to libnet_conf_add_string_to_array(). This is the start of making nomenclature more consistent (functions in libnet_conf.c should be called libnet_conf_*, not libnet_smbconf_* ... Michael (This used to be commit 0dd3967bfd88a4d90941e80134c549f5ade63ad0) --- source3/libnet/libnet_conf.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 01c4237f20..68726fa5d9 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -31,10 +31,10 @@ /** * add a string to a talloced array of strings. */ -static WERROR libnet_smbconf_add_string_to_array(TALLOC_CTX *mem_ctx, - char ***array, - uint32_t count, - const char *string) +static WERROR libnet_conf_add_string_to_array(TALLOC_CTX *mem_ctx, + char ***array, + uint32_t count, + const char *string) { char **new_array = NULL; @@ -346,19 +346,19 @@ static WERROR libnet_smbconf_reg_get_values(TALLOC_CTX *mem_ctx, { char *valstring; - werr = libnet_smbconf_add_string_to_array(tmp_ctx, - &tmp_valnames, - count, valname); + werr = libnet_conf_add_string_to_array(tmp_ctx, + &tmp_valnames, + count, valname); if (!W_ERROR_IS_OK(werr)) { goto done; } valstring = libnet_smbconf_format_registry_value(tmp_ctx, valvalue); - werr = libnet_smbconf_add_string_to_array(tmp_ctx, - &tmp_valstrings, - count, - valstring); + werr = libnet_conf_add_string_to_array(tmp_ctx, + &tmp_valstrings, + count, + valstring); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -540,9 +540,9 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, /* make sure "global" is always listed first */ if (libnet_smbconf_share_exists(GLOBAL_NAME)) { - werr = libnet_smbconf_add_string_to_array(tmp_ctx, - &tmp_share_names, - 0, GLOBAL_NAME); + werr = libnet_conf_add_string_to_array(tmp_ctx, + &tmp_share_names, + 0, GLOBAL_NAME); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -565,10 +565,10 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, continue; } - werr = libnet_smbconf_add_string_to_array(tmp_ctx, - &tmp_share_names, - added_count, - subkey_name); + werr = libnet_conf_add_string_to_array(tmp_ctx, + &tmp_share_names, + added_count, + subkey_name); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From e598b93d2faf568c6ac03b0ca32dcf22fa0e1352 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:33:10 +0100 Subject: Rename libnet_smbconf_reg_open_path() to libnet_conf_reg_open_path(). Michael (This used to be commit 9868364e2c7827ac7914bee711a65d4456a5e366) --- source3/libnet/libnet_conf.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 68726fa5d9..86b2d8b605 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -57,10 +57,10 @@ static WERROR libnet_conf_add_string_to_array(TALLOC_CTX *mem_ctx, /** * Open a registry key specified by "path" */ -static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx, - const char *path, - uint32 desired_access, - struct registry_key **key) +static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx, + const char *path, + uint32 desired_access, + struct registry_key **key) { WERROR werr = WERR_OK; NT_USER_TOKEN *token; @@ -117,7 +117,7 @@ static WERROR libnet_smbconf_reg_open_service_key(TALLOC_CTX *ctx, path = talloc_asprintf(ctx, "%s\\%s", KEY_SMBCONF, servicename); - werr = libnet_smbconf_reg_open_path(ctx, path, desired_access, key); + werr = libnet_conf_reg_open_path(ctx, path, desired_access, key); done: TALLOC_FREE(path); @@ -131,8 +131,7 @@ static WERROR libnet_smbconf_reg_open_basekey(TALLOC_CTX *ctx, uint32 desired_access, struct registry_key **key) { - return libnet_smbconf_reg_open_path(ctx, KEY_SMBCONF, desired_access, - key); + return libnet_conf_reg_open_path(ctx, KEY_SMBCONF, desired_access, key); } static bool libnet_smbconf_value_exists(struct registry_key *key, @@ -408,8 +407,8 @@ WERROR libnet_smbconf_drop(void) } p = strrchr(path, '\\'); *p = '\0'; - werr = libnet_smbconf_reg_open_path(mem_ctx, path, REG_KEY_WRITE, - &parent_key); + werr = libnet_conf_reg_open_path(mem_ctx, path, REG_KEY_WRITE, + &parent_key); if (!W_ERROR_IS_OK(werr)) { goto done; -- cgit From dde8701b85d88a5536a21d80a161c67c7e8634c9 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:36:25 +0100 Subject: Rename libnet_smbconf_reg_open_service_key() to libnet_conf_reg_open_service_key(). Michael (This used to be commit 4d86d2dd6f0a577e446ccb4b362b3cd80f819600) --- source3/libnet/libnet_conf.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 86b2d8b605..735fddcfd2 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -101,10 +101,10 @@ done: /** * Open a subkey of KEY_SMBCONF (i.e a service) */ -static WERROR libnet_smbconf_reg_open_service_key(TALLOC_CTX *ctx, - const char *servicename, - uint32 desired_access, - struct registry_key **key) +static WERROR libnet_conf_reg_open_service_key(TALLOC_CTX *ctx, + const char *servicename, + uint32 desired_access, + struct registry_key **key) { WERROR werr = WERR_OK; char *path = NULL; @@ -600,8 +600,8 @@ bool libnet_smbconf_share_exists(const char *servicename) TALLOC_CTX *mem_ctx = talloc_stackframe(); struct registry_key *key = NULL; - werr = libnet_smbconf_reg_open_service_key(mem_ctx, servicename, - REG_KEY_READ, &key); + werr = libnet_conf_reg_open_service_key(mem_ctx, servicename, + REG_KEY_READ, &key); if (W_ERROR_IS_OK(werr)) { ret = true; } @@ -641,8 +641,8 @@ WERROR libnet_smbconf_getshare(TALLOC_CTX *mem_ctx, const char *servicename, WERROR werr = WERR_OK; struct registry_key *key = NULL; - werr = libnet_smbconf_reg_open_service_key(mem_ctx, servicename, - REG_KEY_READ, &key); + werr = libnet_conf_reg_open_service_key(mem_ctx, servicename, + REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -692,8 +692,8 @@ WERROR libnet_smbconf_setparm(const char *service, goto done; } - werr = libnet_smbconf_reg_open_service_key(mem_ctx, service, - REG_KEY_WRITE, &key); + werr = libnet_conf_reg_open_service_key(mem_ctx, service, REG_KEY_WRITE, + &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -727,8 +727,8 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - werr = libnet_smbconf_reg_open_service_key(mem_ctx, service, - REG_KEY_READ, &key); + werr = libnet_conf_reg_open_service_key(mem_ctx, service, REG_KEY_READ, + &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -769,8 +769,8 @@ WERROR libnet_smbconf_delparm(const char *service, return WERR_NO_SUCH_SERVICE; } - werr = libnet_smbconf_reg_open_service_key(mem_ctx, service, - REG_KEY_ALL, &key); + werr = libnet_conf_reg_open_service_key(mem_ctx, service, REG_KEY_ALL, + &key); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From cd84256866d6d2bbd7494b67ae96c3546902e794 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:38:55 +0100 Subject: Rename libnet_smbconf_reg_open_basekey() to libnet_conf_reg_open_base_key(). Michael (This used to be commit c2ba52b2c34abc42b4ff7945715dc36e08a2f112) --- source3/libnet/libnet_conf.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 735fddcfd2..53d70bd4f6 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -127,9 +127,9 @@ done: /* * open the base key KEY_SMBCONF */ -static WERROR libnet_smbconf_reg_open_basekey(TALLOC_CTX *ctx, - uint32 desired_access, - struct registry_key **key) +static WERROR libnet_conf_reg_open_base_key(TALLOC_CTX *ctx, + uint32 desired_access, + struct registry_key **key) { return libnet_conf_reg_open_path(ctx, KEY_SMBCONF, desired_access, key); } @@ -171,8 +171,8 @@ static WERROR libnet_smbconf_reg_create_service_key(TALLOC_CTX *ctx, goto done; } - werr = libnet_smbconf_reg_open_basekey(create_ctx, REG_KEY_WRITE, - &create_parent); + werr = libnet_conf_reg_open_base_key(create_ctx, REG_KEY_WRITE, + &create_parent); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -548,9 +548,8 @@ WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, added_count++; } - werr = libnet_smbconf_reg_open_basekey(tmp_ctx, - SEC_RIGHTS_ENUM_SUBKEYS, - &key); + werr = libnet_conf_reg_open_base_key(tmp_ctx, SEC_RIGHTS_ENUM_SUBKEYS, + &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -664,7 +663,7 @@ WERROR libnet_smbconf_delshare(const char *servicename) struct registry_key *key = NULL; TALLOC_CTX *ctx = talloc_stackframe(); - werr = libnet_smbconf_reg_open_basekey(ctx, REG_KEY_WRITE, &key); + werr = libnet_conf_reg_open_base_key(ctx, REG_KEY_WRITE, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From d3e54d913c705337d3caf88ee72d38c7f45f0949 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:40:40 +0100 Subject: Rename libnet_smbconf_value_exists() to libnet_conf_value_exists(). Michael (This used to be commit 49f740797bb7fc5edacbd4c3e8b1eb1aab131ea4) --- source3/libnet/libnet_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 53d70bd4f6..0032d549eb 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -134,8 +134,8 @@ static WERROR libnet_conf_reg_open_base_key(TALLOC_CTX *ctx, return libnet_conf_reg_open_path(ctx, KEY_SMBCONF, desired_access, key); } -static bool libnet_smbconf_value_exists(struct registry_key *key, - const char *param) +static bool libnet_conf_value_exists(struct registry_key *key, + const char *param) { bool ret = false; WERROR werr = WERR_OK; @@ -732,7 +732,7 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - if (!libnet_smbconf_value_exists(key, param)) { + if (!libnet_conf_value_exists(key, param)) { werr = WERR_INVALID_PARAM; goto done; } @@ -774,7 +774,7 @@ WERROR libnet_smbconf_delparm(const char *service, goto done; } - if (!libnet_smbconf_value_exists(key, param)) { + if (!libnet_conf_value_exists(key, param)) { werr = WERR_INVALID_PARAM; goto done; } -- cgit From 340cb434db8d3e063a2fb15cb74e550e90c4cf95 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:42:40 +0100 Subject: Rename libnet_smbconf_reg_create_service_key() to libnet_conf_reg_create_service_key(). Michael (This used to be commit cd1846943cbcc02ea9fa3b9237bd02e667a475db) --- source3/libnet/libnet_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 0032d549eb..b88242ef8a 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -154,9 +154,9 @@ static bool libnet_conf_value_exists(struct registry_key *key, /* * create a subkey of KEY_SMBCONF */ -static WERROR libnet_smbconf_reg_create_service_key(TALLOC_CTX *ctx, - const char * subkeyname, - struct registry_key **newkey) +static WERROR libnet_conf_reg_create_service_key(TALLOC_CTX *ctx, + const char * subkeyname, + struct registry_key **newkey) { WERROR werr = WERR_OK; struct registry_key *create_parent = NULL; @@ -623,7 +623,7 @@ WERROR libnet_smbconf_create_share(const char *servicename) goto done; } - werr = libnet_smbconf_reg_create_service_key(mem_ctx, servicename, &key); + werr = libnet_conf_reg_create_service_key(mem_ctx, servicename, &key); done: TALLOC_FREE(mem_ctx); -- cgit From 547c3583e42e22e42432a10c79803219ee043dc7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:43:34 +0100 Subject: Rename libnet_smbconf_reg_set_value() to libnet_conf_reg_set_value(). Michael (This used to be commit 96b2923bc3c57700352869627c38609529d53cd2) --- source3/libnet/libnet_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index b88242ef8a..594e1f7a1d 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -196,9 +196,9 @@ done: /* * add a value to a key. */ -static WERROR libnet_smbconf_reg_set_value(struct registry_key *key, - const char *valname, - const char *valstr) +static WERROR libnet_conf_reg_set_value(struct registry_key *key, + const char *valname, + const char *valstr) { struct registry_value val; WERROR werr = WERR_OK; @@ -697,7 +697,7 @@ WERROR libnet_smbconf_setparm(const char *service, goto done; } - werr = libnet_smbconf_reg_set_value(key, param, valstr); + werr = libnet_conf_reg_set_value(key, param, valstr); done: TALLOC_FREE(mem_ctx); -- cgit From 6ab11e5f981618f58ebd82b89a79846ac048aadf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:45:14 +0100 Subject: Rename libnet_smbconf_format_registry_value() to libnet_conf_format_registry_value(). Michael (This used to be commit 3f9f35335127a673639fa30c88cdea6c79f04b92) --- source3/libnet/libnet_conf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 594e1f7a1d..9a0cd9ff2f 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -270,8 +270,8 @@ done: * which are ar stored as REG_SZ values, so the incomplete * handling should be ok. */ -static char *libnet_smbconf_format_registry_value(TALLOC_CTX *mem_ctx, - struct registry_value *value) +static char *libnet_conf_format_registry_value(TALLOC_CTX *mem_ctx, + struct registry_value *value) { char *result = NULL; @@ -352,8 +352,8 @@ static WERROR libnet_smbconf_reg_get_values(TALLOC_CTX *mem_ctx, goto done; } - valstring = libnet_smbconf_format_registry_value(tmp_ctx, - valvalue); + valstring = libnet_conf_format_registry_value(tmp_ctx, + valvalue); werr = libnet_conf_add_string_to_array(tmp_ctx, &tmp_valstrings, count, @@ -742,7 +742,7 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - *valstr = libnet_smbconf_format_registry_value(mem_ctx, value); + *valstr = libnet_conf_format_registry_value(mem_ctx, value); if (*valstr == NULL) { werr = WERR_NOMEM; -- cgit From 12a0cd531060f6a54c7600f3682bbb37fe91bac1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:46:45 +0100 Subject: Rename libnet_smbconf_reg_get_values() to libnet_conf_reg_get_values(). Now all internal helper functions are converted to the consistent naming scheme. Michael (This used to be commit c23e6636a886d93b98c9439ba081def0385f67ac) --- source3/libnet/libnet_conf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 9a0cd9ff2f..191692dc62 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -311,11 +311,11 @@ static char *libnet_conf_format_registry_value(TALLOC_CTX *mem_ctx, * Get the values of a key as a list of value names * and a list of value strings (ordered) */ -static WERROR libnet_smbconf_reg_get_values(TALLOC_CTX *mem_ctx, - struct registry_key *key, - uint32_t *num_values, - char ***value_names, - char ***value_strings) +static WERROR libnet_conf_reg_get_values(TALLOC_CTX *mem_ctx, + struct registry_key *key, + uint32_t *num_values, + char ***value_names, + char ***value_strings) { TALLOC_CTX *tmp_ctx = NULL; WERROR werr = WERR_OK; @@ -646,8 +646,8 @@ WERROR libnet_smbconf_getshare(TALLOC_CTX *mem_ctx, const char *servicename, goto done; } - werr = libnet_smbconf_reg_get_values(mem_ctx, key, num_params, - param_names, param_values); + werr = libnet_conf_reg_get_values(mem_ctx, key, num_params, + param_names, param_values); done: TALLOC_FREE(key); -- cgit From 05ff62cf78447dc8caacf4a9d0b4b746f8d8e481 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:48:56 +0100 Subject: Rename libnet_smbconf_drop() to libnet_conf_drop(). Michael (This used to be commit 42ae33a96228e916d7d530d844be6937a80d4fea) --- source3/libnet/libnet_conf.c | 2 +- source3/utils/net_conf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 191692dc62..f9f1759de2 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -391,7 +391,7 @@ done: /** * Drop the whole configuration (restarting empty). */ -WERROR libnet_smbconf_drop(void) +WERROR libnet_conf_drop(void) { char *path, *p; WERROR werr = WERR_OK; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 6c61c24a52..2f94f3b722 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -447,7 +447,7 @@ static int net_conf_drop(int argc, const char **argv) goto done; } - werr = libnet_smbconf_drop(); + werr = libnet_conf_drop(); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error deleting configuration: %s\n", dos_errstr(werr)); -- cgit From 90837d048b18ae72199b6f7ed7e1d17b0cc71102 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:50:55 +0100 Subject: Rename libnet_smbconf_get_config() to libnet_conf_get_config(). Michael (This used to be commit e8f7c07699b5b93acd81b24bca908769f0b5e8d8) --- source3/libnet/libnet_conf.c | 6 +++--- source3/utils/net_conf.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index f9f1759de2..ec055439d7 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -437,9 +437,9 @@ done: * param_names : list of lists of parameter names for each share * param_values : list of lists of parameter values for each share */ -WERROR libnet_smbconf_get_config(TALLOC_CTX *mem_ctx, uint32_t *num_shares, - char ***share_names, uint32_t **num_params, - char ****param_names, char ****param_values) +WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx, uint32_t *num_shares, + char ***share_names, uint32_t **num_params, + char ****param_names, char ****param_values) { WERROR werr = WERR_OK; TALLOC_CTX *tmp_ctx = NULL; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 2f94f3b722..7730187e7d 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -291,9 +291,9 @@ static int net_conf_list(int argc, const char **argv) goto done; } - werr = libnet_smbconf_get_config(ctx, &num_shares, &share_names, - &num_params, ¶m_names, - ¶m_values); + werr = libnet_conf_get_config(ctx, &num_shares, &share_names, + &num_params, ¶m_names, + ¶m_values); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error getting config: %s\n", dos_errstr(werr)); -- cgit From daf1a460c821f247c43c22f1e26785d3acdb3ac3 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:53:04 +0100 Subject: Rename libnet_smbconf_get_share_names() to libnet_conf_get_share_names(). Michael (This used to be commit 2e4beee66b3672c3259b312aca3d482598731119) --- source3/libnet/libnet_conf.c | 8 ++++---- source3/utils/net_conf.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ec055439d7..3cd3933b1f 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -464,8 +464,8 @@ WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx, uint32_t *num_shares, goto done; } - werr = libnet_smbconf_get_share_names(tmp_ctx, &tmp_num_shares, - &tmp_share_names); + werr = libnet_conf_get_share_names(tmp_ctx, &tmp_num_shares, + &tmp_share_names); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -515,8 +515,8 @@ done: /** * get the list of share names defined in the configuration. */ -WERROR libnet_smbconf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, - char ***share_names) +WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, + char ***share_names) { uint32_t count; uint32_t added_count = 0; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 7730187e7d..930d7b3508 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -420,7 +420,7 @@ static int net_conf_listshares(int argc, const char **argv) goto done; } - werr = libnet_smbconf_get_share_names(ctx, &num_shares, &share_names); + werr = libnet_conf_get_share_names(ctx, &num_shares, &share_names); if (!W_ERROR_IS_OK(werr)) { goto done; } -- cgit From 630de5f555b7fb897e1bb700b2a0a3d8d611e9bd Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:54:31 +0100 Subject: Rename libnet_smbconf_share_exists() to libnet_conf_share_exists(). Michael (This used to be commit 3258758e5c8dfc2c681e1285cb34aaacae697a55) --- source3/libnet/libnet_conf.c | 12 ++++++------ source3/utils/net_conf.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 3cd3933b1f..cf11a42329 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -538,7 +538,7 @@ WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, } /* make sure "global" is always listed first */ - if (libnet_smbconf_share_exists(GLOBAL_NAME)) { + if (libnet_conf_share_exists(GLOBAL_NAME)) { werr = libnet_conf_add_string_to_array(tmp_ctx, &tmp_share_names, 0, GLOBAL_NAME); @@ -592,7 +592,7 @@ done: /** * check if a share/service of a given name exists */ -bool libnet_smbconf_share_exists(const char *servicename) +bool libnet_conf_share_exists(const char *servicename) { bool ret = false; WERROR werr = WERR_OK; @@ -618,7 +618,7 @@ WERROR libnet_smbconf_create_share(const char *servicename) TALLOC_CTX *mem_ctx = talloc_stackframe(); struct registry_key *key = NULL; - if (libnet_smbconf_share_exists(servicename)) { + if (libnet_conf_share_exists(servicename)) { werr = WERR_ALREADY_EXISTS; goto done; } @@ -686,7 +686,7 @@ WERROR libnet_smbconf_setparm(const char *service, struct registry_key *key = NULL; TALLOC_CTX *mem_ctx = talloc_stackframe(); - if (!libnet_smbconf_share_exists(service)) { + if (!libnet_conf_share_exists(service)) { werr = WERR_NO_SUCH_SERVICE; goto done; } @@ -721,7 +721,7 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, goto done; } - if (!libnet_smbconf_share_exists(service)) { + if (!libnet_conf_share_exists(service)) { werr = WERR_NO_SUCH_SERVICE; goto done; } @@ -764,7 +764,7 @@ WERROR libnet_smbconf_delparm(const char *service, WERROR werr = WERR_OK; TALLOC_CTX *mem_ctx = talloc_stackframe(); - if (!libnet_smbconf_share_exists(service)) { + if (!libnet_conf_share_exists(service)) { return WERR_NO_SUCH_SERVICE; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 930d7b3508..be1447f182 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -207,7 +207,7 @@ static int import_process_service(TALLOC_CTX *ctx, if (opt_testmode) { d_printf("[%s]\n", servicename); } else { - if (libnet_smbconf_share_exists(servicename)) { + if (libnet_conf_share_exists(servicename)) { werr = libnet_smbconf_delshare(servicename); if (!W_ERROR_IS_OK(werr)) { goto done; @@ -596,7 +596,7 @@ static int net_conf_addshare(int argc, const char **argv) goto done; } - if (libnet_smbconf_share_exists(sharename)) { + if (libnet_conf_share_exists(sharename)) { d_fprintf(stderr, "ERROR: share %s already exists.\n", sharename); goto done; -- cgit From 3f3a29ed509916751e8ead326dba3e2221cab199 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:55:43 +0100 Subject: Rename libnet_smbconf_create_share() to libnet_conf_create_share(). Michael (This used to be commit 6bc4ee210855dbfbee9e86b59e90b08ecb3a9df9) --- source3/libnet/libnet_conf.c | 2 +- source3/utils/net_conf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index cf11a42329..be45e30d50 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -612,7 +612,7 @@ bool libnet_conf_share_exists(const char *servicename) /** * Add a service if it does not already exist. */ -WERROR libnet_smbconf_create_share(const char *servicename) +WERROR libnet_conf_create_share(const char *servicename) { WERROR werr; TALLOC_CTX *mem_ctx = talloc_stackframe(); diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index be1447f182..c080da2d91 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -631,7 +631,7 @@ static int net_conf_addshare(int argc, const char **argv) * create the share */ - werr = libnet_smbconf_create_share(sharename); + werr = libnet_conf_create_share(sharename); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error creating share %s: %s\n", sharename, dos_errstr(werr)); -- cgit From e1aa474a32a8b6faa952ad4e9e2e91b8727ad56e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 13:59:14 +0100 Subject: Rename libnet_smbconf_getshare() to libnet_conf_get_share(). Michael (This used to be commit 1575612f1936312125e7778a9a4227e444ea36cf) --- source3/libnet/libnet_conf.c | 14 +++++++------- source3/utils/net_conf.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index be45e30d50..594dea9603 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -482,10 +482,10 @@ WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx, uint32_t *num_shares, } for (count = 0; count < tmp_num_shares; count++) { - werr = libnet_smbconf_getshare(mem_ctx, tmp_share_names[count], - &tmp_num_params[count], - &tmp_param_names[count], - &tmp_param_values[count]); + werr = libnet_conf_get_share(mem_ctx, tmp_share_names[count], + &tmp_num_params[count], + &tmp_param_names[count], + &tmp_param_values[count]); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -633,9 +633,9 @@ done: /** * get a definition of a share (service) from configuration. */ -WERROR libnet_smbconf_getshare(TALLOC_CTX *mem_ctx, const char *servicename, - uint32_t *num_params, char ***param_names, - char ***param_values) +WERROR libnet_conf_get_share(TALLOC_CTX *mem_ctx, const char *servicename, + uint32_t *num_params, char ***param_names, + char ***param_values) { WERROR werr = WERR_OK; struct registry_key *key = NULL; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index c080da2d91..7859e0e615 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -480,8 +480,8 @@ static int net_conf_showshare(int argc, const char **argv) sharename = argv[0]; - werr = libnet_smbconf_getshare(ctx, sharename, &num_params, - ¶m_names, ¶m_values); + werr = libnet_conf_get_share(ctx, sharename, &num_params, + ¶m_names, ¶m_values); if (!W_ERROR_IS_OK(werr)) { d_printf("error getting share parameters: %s\n", dos_errstr(werr)); -- cgit From e89411effda51f9012d1830d18adcb968637baac Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 14:01:50 +0100 Subject: Rename libnet_smbconf_delshare() to libnet_conf_delete_share(). Michael (This used to be commit 2075baf551ca7fc6bcee6b93f63fd7fbf75f9a50) --- source3/libnet/libnet_conf.c | 2 +- source3/utils/net_conf.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 594dea9603..0f11bbbc49 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -657,7 +657,7 @@ done: /** * delete a service from configuration */ -WERROR libnet_smbconf_delshare(const char *servicename) +WERROR libnet_conf_delete_share(const char *servicename) { WERROR werr = WERR_OK; struct registry_key *key = NULL; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 7859e0e615..340cb37541 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -208,7 +208,7 @@ static int import_process_service(TALLOC_CTX *ctx, d_printf("[%s]\n", servicename); } else { if (libnet_conf_share_exists(servicename)) { - werr = libnet_smbconf_delshare(servicename); + werr = libnet_conf_delete_share(servicename); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -691,7 +691,7 @@ static int net_conf_delshare(int argc, const char **argv) } sharename = argv[0]; - werr = libnet_smbconf_delshare(sharename); + werr = libnet_conf_delete_share(sharename); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error deleting share %s: %s\n", sharename, dos_errstr(werr)); -- cgit From b9f904b59d867c290675ec1013218ba7333253c5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 14:06:09 +0100 Subject: Rename libnet_smbconf_setparm() to libnet_conf_set_parameter(). Michael (This used to be commit e00cb415d30b3e72ccfb7e5c366c95ec0f9c6247) --- source3/libnet/libnet_conf.c | 8 ++++---- source3/utils/net_conf.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 0f11bbbc49..ad9ae4994b 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -678,9 +678,9 @@ done: /** * set a configuration parameter to the value provided. */ -WERROR libnet_smbconf_setparm(const char *service, - const char *param, - const char *valstr) +WERROR libnet_conf_set_parameter(const char *service, + const char *param, + const char *valstr) { WERROR werr; struct registry_key *key = NULL; @@ -796,6 +796,6 @@ done: WERROR libnet_smbconf_set_global_param(const char *param, const char *val) { - return libnet_smbconf_setparm(GLOBAL_NAME, param, val); + return libnet_conf_set_parameter(GLOBAL_NAME, param, val); } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 340cb37541..c8de6a555b 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -229,9 +229,9 @@ static int import_process_service(TALLOC_CTX *ctx, if (opt_testmode) { d_printf("\t%s = %s\n", parm->label, valstr); } else { - werr = libnet_smbconf_setparm(servicename, - parm->label, - valstr); + werr = libnet_conf_set_parameter(servicename, + parm->label, + valstr); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter '%s'" @@ -642,7 +642,7 @@ static int net_conf_addshare(int argc, const char **argv) * fill the share with parameters */ - werr = libnet_smbconf_setparm(sharename, "path", path); + werr = libnet_conf_set_parameter(sharename, "path", path); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "path", dos_errstr(werr)); @@ -650,7 +650,7 @@ static int net_conf_addshare(int argc, const char **argv) } if (comment != NULL) { - werr = libnet_smbconf_setparm(sharename, "comment", comment); + werr = libnet_conf_set_parameter(sharename, "comment", comment); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "comment", dos_errstr(werr)); @@ -658,14 +658,14 @@ static int net_conf_addshare(int argc, const char **argv) } } - werr = libnet_smbconf_setparm(sharename, "guest ok", guest_ok); + werr = libnet_conf_set_parameter(sharename, "guest ok", guest_ok); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "'guest ok'", dos_errstr(werr)); goto done; } - werr = libnet_smbconf_setparm(sharename, "writeable", writeable); + werr = libnet_conf_set_parameter(sharename, "writeable", writeable); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "writeable", dos_errstr(werr)); @@ -719,7 +719,7 @@ static int net_conf_setparm(int argc, const char **argv) param = strdup_lower(argv[1]); value_str = argv[2]; - werr = libnet_smbconf_setparm(service, param, value_str); + werr = libnet_conf_set_parameter(service, param, value_str); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting value '%s': %s\n", -- cgit From 55771b356d632ffe7d1d773670a71366e3d7302a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 14:08:45 +0100 Subject: Rename libnet_smbconf_getparm() to libnet_conf_get_parameter(). Michael (This used to be commit d08556dbc7071933feaeec538f01ac8f6a637b1d) --- source3/libnet/libnet_conf.c | 8 ++++---- source3/utils/net_conf.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ad9ae4994b..f5504b78d5 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -707,10 +707,10 @@ done: /** * get the value of a configuration parameter as a string */ -WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, - const char *service, - const char *param, - char **valstr) +WERROR libnet_conf_get_parameter(TALLOC_CTX *mem_ctx, + const char *service, + const char *param, + char **valstr) { WERROR werr = WERR_OK; struct registry_key *key = NULL; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index c8de6a555b..c62c555ebe 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -753,7 +753,7 @@ static int net_conf_getparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - werr = libnet_smbconf_getparm(ctx, service, param, &valstr); + werr = libnet_conf_get_parameter(ctx, service, param, &valstr); if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, -- cgit From 2476254ccdf629d7889b9cff458a6e1097fc71ba Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 14:11:20 +0100 Subject: Rename libnet_smbconf_delparm() to libnet_conf_delete_parameter(). Michael (This used to be commit 073eeca51e46da6a687175aadbfdbb9e029532d6) --- source3/libnet/libnet_conf.c | 3 +-- source3/libnet/libnet_join.c | 2 +- source3/utils/net_conf.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index f5504b78d5..fbe47b212b 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -757,8 +757,7 @@ done: /** * delete a parameter from configuration */ -WERROR libnet_smbconf_delparm(const char *service, - const char *param) +WERROR libnet_conf_delete_parameter(const char *service, const char *param) { struct registry_key *key = NULL; WERROR werr = WERR_OK; diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index ae3ed060fe..00ab608274 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -379,7 +379,7 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) W_ERROR_NOT_OK_RETURN(werr); } - werr = libnet_smbconf_delparm("GLOBAL", "realm"); + werr = libnet_conf_delete_parameter("GLOBAL", "realm"); return werr; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index c62c555ebe..2d4b3f4054 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -795,7 +795,7 @@ static int net_conf_delparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - werr = libnet_smbconf_delparm(service, param); + werr = libnet_conf_delete_parameter(service, param); if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, -- cgit From 5655ae7a2468e8fc93b1a8d9ac4b2f35abbf3703 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 14:15:05 +0100 Subject: Rename libnet_smbconf_set_global_param() to libnet_conf_set_global_parameter(). Now all functions are converted to the consistent naming scheme. Michael (This used to be commit a559533c0c8a80f3f4078bbc2675de395359485f) --- source3/lib/netapi/serverinfo.c | 4 ++-- source3/libnet/libnet_conf.c | 4 ++-- source3/libnet/libnet_join.c | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 27c7c4b2fc..0e356e0ee7 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -167,8 +167,8 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, return WERR_NOT_SUPPORTED; } - return libnet_smbconf_set_global_param("server string", - info1005->comment); + return libnet_conf_set_global_parameter("server string", + info1005->comment); } static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx, diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index fbe47b212b..ea3f708883 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -792,8 +792,8 @@ done: * **********************************************************************/ -WERROR libnet_smbconf_set_global_param(const char *param, - const char *val) +WERROR libnet_conf_set_global_parameter(const char *param, + const char *val) { return libnet_conf_set_parameter(GLOBAL_NAME, param, val); } diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 00ab608274..478cccf725 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -338,11 +338,11 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) { - werr = libnet_smbconf_set_global_param("security", "user"); + werr = libnet_conf_set_global_parameter("security", "user"); W_ERROR_NOT_OK_RETURN(werr); - werr = libnet_smbconf_set_global_param("workgroup", - r->in.domain_name); + werr = libnet_conf_set_global_parameter("workgroup", + r->in.domain_name); return werr; } @@ -350,18 +350,18 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) is_ad = true; } - werr = libnet_smbconf_set_global_param("security", "domain"); + werr = libnet_conf_set_global_parameter("security", "domain"); W_ERROR_NOT_OK_RETURN(werr); - werr = libnet_smbconf_set_global_param("workgroup", - r->out.netbios_domain_name); + werr = libnet_conf_set_global_parameter("workgroup", + r->out.netbios_domain_name); W_ERROR_NOT_OK_RETURN(werr); if (is_ad) { - werr = libnet_smbconf_set_global_param("security", "ads"); + werr = libnet_conf_set_global_parameter("security", "ads"); W_ERROR_NOT_OK_RETURN(werr); - werr = libnet_smbconf_set_global_param("realm", + werr = libnet_conf_set_global_parameter("realm", r->out.dns_domain_name); W_ERROR_NOT_OK_RETURN(werr); } @@ -375,7 +375,7 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - werr = libnet_smbconf_set_global_param("security", "user"); + werr = libnet_conf_set_global_parameter("security", "user"); W_ERROR_NOT_OK_RETURN(werr); } -- cgit From 30829d1bdad9387650486f05280a2061af19796a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 14:17:42 +0100 Subject: Use GLOBAL_NAME constant. Michael (This used to be commit 4c404d627ccfaf1c17f4b6b1ebab6fce357d9ab1) --- source3/libnet/libnet_join.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 478cccf725..c289ad33e5 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -379,7 +379,7 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) W_ERROR_NOT_OK_RETURN(werr); } - werr = libnet_conf_delete_parameter("GLOBAL", "realm"); + werr = libnet_conf_delete_parameter(GLOBAL_NAME, "realm"); return werr; } -- cgit From 6dce6ba0a6551c4db29ccf51e346f20ea1f8430e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 14:34:31 +0100 Subject: Add a comment header and do some slight reformatting. Michael (This used to be commit 5d557e3f95b8d53114c25ba7fa3e564a50be9e05) --- source3/libnet/libnet_conf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ea3f708883..86ef3e5517 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -124,7 +124,7 @@ done: return werr; } -/* +/** * open the base key KEY_SMBCONF */ static WERROR libnet_conf_reg_open_base_key(TALLOC_CTX *ctx, @@ -134,6 +134,9 @@ static WERROR libnet_conf_reg_open_base_key(TALLOC_CTX *ctx, return libnet_conf_reg_open_path(ctx, KEY_SMBCONF, desired_access, key); } +/** + * check if a value exists in a given registry key + */ static bool libnet_conf_value_exists(struct registry_key *key, const char *param) { @@ -151,7 +154,7 @@ static bool libnet_conf_value_exists(struct registry_key *key, return ret; } -/* +/** * create a subkey of KEY_SMBCONF */ static WERROR libnet_conf_reg_create_service_key(TALLOC_CTX *ctx, @@ -193,7 +196,7 @@ done: return werr; } -/* +/** * add a value to a key. */ static WERROR libnet_conf_reg_set_value(struct registry_key *key, @@ -792,8 +795,7 @@ done: * **********************************************************************/ -WERROR libnet_conf_set_global_parameter(const char *param, - const char *val) +WERROR libnet_conf_set_global_parameter(const char *param, const char *val) { return libnet_conf_set_parameter(GLOBAL_NAME, param, val); } -- cgit From 5470f8f638505b8dccc11ca0038632aa472608d8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jan 2008 15:33:09 +0100 Subject: Make libnet_conf handle opening/initialization of the registry. Open state is currently tracked by a global variable to avoid double initialization. Later, this can possibly be replaced by a conf-context created by an initialization function and passed around to the other api functions. Michael (This used to be commit 77713e776405800ac54c692a77cd4efd153042cb) --- source3/libnet/libnet_conf.c | 32 ++++++++++++++++++++++++++++++++ source3/utils/net_conf.c | 5 ----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 86ef3e5517..665261723b 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -21,6 +21,11 @@ #include "includes.h" #include "libnet/libnet.h" +/* + * yuck - static variable to keep track of the registry initialization. + */ +static bool registry_initialized = false; + /********************************************************************** * * Helper functions (mostly registry related) @@ -54,6 +59,26 @@ static WERROR libnet_conf_add_string_to_array(TALLOC_CTX *mem_ctx, return WERR_OK; } +static WERROR libnet_conf_reg_initialize(void) +{ + WERROR werr = WERR_OK; + + if (registry_initialized) { + goto done; + } + + if (!registry_init_regdb()) { + /* proper error code? */ + werr = WERR_GENERAL_FAILURE; + goto done; + } + + registry_initialized = true; + +done: + return werr; +} + /** * Open a registry key specified by "path" */ @@ -78,6 +103,13 @@ static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx, goto done; } + werr = libnet_conf_reg_initialize(); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, ("Error initializing registry: %s\n", + dos_errstr(werr))); + goto done; + } + token = registry_create_admin_token(tmp_ctx); if (token == NULL) { DEBUG(1, ("Error creating admin token\n")); diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 2d4b3f4054..a758391630 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -852,11 +852,6 @@ int net_conf(int argc, const char **argv) {NULL, NULL, NULL} }; - if (!registry_init_regdb()) { - d_fprintf(stderr, "Error initializing the registry!\n"); - goto done; - } - ret = net_run_function2(argc, argv, "net conf", func); regdb_close(); -- cgit From f8dacb9860dfcf1b19191ebeb4a1c0279955464f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 16:40:04 +0100 Subject: Add some more join related werror codes. Guenther (This used to be commit 62e7d467ab1b2f98327960eec3a3a925b2f04bda) --- source3/include/doserr.h | 2 ++ source3/libsmb/doserr.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/source3/include/doserr.h b/source3/include/doserr.h index 079a5664dd..08f5b3e39d 100644 --- a/source3/include/doserr.h +++ b/source3/include/doserr.h @@ -216,12 +216,14 @@ #define WERR_BUF_TOO_SMALL W_ERROR(2123) #define WERR_JOB_NOT_FOUND W_ERROR(2151) #define WERR_DEST_NOT_FOUND W_ERROR(2152) +#define WERR_USER_EXISTS W_ERROR(2224) #define WERR_NOT_LOCAL_DOMAIN W_ERROR(2320) #define WERR_DOMAIN_CONTROLLER_NOT_FOUND W_ERROR(2453) #define WERR_SETUP_ALREADY_JOINED W_ERROR(2691) #define WERR_SETUP_NOT_JOINED W_ERROR(2692) #define WERR_SETUP_DOMAIN_CONTROLLER W_ERROR(2693) +#define WERR_DEFAULT_JOIN_REQUIRED W_ERROR(2694) #define WERR_DEVICE_NOT_AVAILABLE W_ERROR(4319) #define WERR_STATUS_MORE_ENTRIES W_ERROR(0x0105) diff --git a/source3/libsmb/doserr.c b/source3/libsmb/doserr.c index dd556bba5a..ba68b5a1e8 100644 --- a/source3/libsmb/doserr.c +++ b/source3/libsmb/doserr.c @@ -63,6 +63,7 @@ werror_code_struct dos_errs[] = { "WERR_JOB_NOT_FOUND", WERR_JOB_NOT_FOUND }, { "WERR_DEST_NOT_FOUND", WERR_DEST_NOT_FOUND }, { "WERR_NOT_LOCAL_DOMAIN", WERR_NOT_LOCAL_DOMAIN }, + { "WERR_USER_EXISTS", WERR_USER_EXISTS }, { "WERR_NO_LOGON_SERVERS", WERR_NO_LOGON_SERVERS }, { "WERR_NO_SUCH_LOGON_SESSION", WERR_NO_SUCH_LOGON_SESSION }, { "WERR_PRINTER_DRIVER_IN_USE", WERR_PRINTER_DRIVER_IN_USE }, @@ -77,6 +78,7 @@ werror_code_struct dos_errs[] = { "WERR_SETUP_NOT_JOINED", WERR_SETUP_NOT_JOINED }, { "WERR_SETUP_ALREADY_JOINED", WERR_SETUP_ALREADY_JOINED }, { "WERR_SETUP_DOMAIN_CONTROLLER", WERR_SETUP_DOMAIN_CONTROLLER }, + { "WERR_DEFAULT_JOIN_REQUIRED", WERR_DEFAULT_JOIN_REQUIRED }, { "WERR_DEVICE_NOT_AVAILABLE", WERR_DEVICE_NOT_AVAILABLE }, { "WERR_LOGON_FAILURE", WERR_LOGON_FAILURE }, { "WERR_NO_SUCH_DOMAIN", WERR_NO_SUCH_DOMAIN }, @@ -110,6 +112,7 @@ werror_str_struct dos_err_strs[] = { { WERR_SETUP_ALREADY_JOINED, "Machine is already joined" }, { WERR_SETUP_DOMAIN_CONTROLLER, "Machine is a Domain Controller" }, { WERR_LOGON_FAILURE, "Invalid logon credentials" }, + { WERR_USER_EXISTS, "User account already exists" }, }; /***************************************************************************** -- cgit From be88a6738823e3a19c4e935dd970ab4c078ceaee Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 16:41:38 +0100 Subject: Minor libnetapi join cosmetic cleanup. Guenther (This used to be commit 4deef80bed374af5032c0f3081d2ee3c70be99df) --- source3/lib/netapi/joindomain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 60f48a7b5e..d200c9b7b0 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -114,7 +114,7 @@ static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx, if (!pipe_cli) { werr = ntstatus_to_werror(status); goto done; - }; + } if (password) { encode_wkssvc_join_password_buffer(ctx, @@ -300,7 +300,7 @@ static WERROR NetUnjoinDomainRemote(struct libnetapi_ctx *ctx, if (!pipe_cli) { werr = ntstatus_to_werror(status); goto done; - }; + } if (password) { encode_wkssvc_join_password_buffer(ctx, @@ -407,7 +407,7 @@ static WERROR NetGetJoinInformationRemote(struct libnetapi_ctx *ctx, if (!pipe_cli) { werr = ntstatus_to_werror(status); goto done; - }; + } status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, ctx, server_name, -- cgit From 192700bd08ba893cad9fb38f80231ad7cf9eb89f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 16:46:26 +0100 Subject: Use different error code for libnet_conf initialization failure. Guenther (This used to be commit 65537eae842065a1dd68d8e532e61502b61e1dbe) --- source3/libnet/libnet_conf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 665261723b..c8e55a70b2 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -68,8 +68,7 @@ static WERROR libnet_conf_reg_initialize(void) } if (!registry_init_regdb()) { - /* proper error code? */ - werr = WERR_GENERAL_FAILURE; + werr = WERR_REG_IO_FAILURE; goto done; } -- cgit From b076a7e802a89bdc5b369e98c7d69d8f970d8265 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Jan 2008 17:28:09 +0100 Subject: Add ads_get_joinable_ous(). Guenther (This used to be commit 5bbceac88159ef6ff83d9cc62c77c7af2116967d) --- source3/include/ads_protos.h | 4 +++ source3/libads/ldap.c | 60 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/source3/include/ads_protos.h b/source3/include/ads_protos.h index 0292d91f4f..738df3ed40 100644 --- a/source3/include/ads_protos.h +++ b/source3/include/ads_protos.h @@ -114,3 +114,7 @@ ADS_STATUS ads_get_tokensids(ADS_STRUCT *ads, DOM_SID *primary_group_sid, DOM_SID **sids, size_t *num_sids); +ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + char ***ous, + size_t *num_ous); diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 953693ce48..843d57988c 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -2790,6 +2790,66 @@ ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffix return status; } +/** + * get the joinable ous for a domain + * @param ads connection to ads server + * @param mem_ctx Pointer to talloc context + * @param ous Pointer to an array of ous + * @param num_ous Pointer to the number of ous + * @return status of search + **/ +ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + char ***ous, + size_t *num_ous) +{ + ADS_STATUS status; + LDAPMessage *res = NULL; + LDAPMessage *msg = NULL; + const char *attrs[] = { "dn", NULL }; + int count = 0; + + status = ads_search(ads, &res, + "(|(objectClass=domain)(objectclass=organizationalUnit))", + attrs); + if (!ADS_ERR_OK(status)) { + return status; + } + + count = ads_count_replies(ads, res); + if (count < 1) { + ads_msgfree(ads, res); + return ADS_ERROR(LDAP_NO_RESULTS_RETURNED); + } + + for (msg = ads_first_entry(ads, res); msg; + msg = ads_next_entry(ads, msg)) { + + char *dn = NULL; + + dn = ads_get_dn(ads, msg); + if (!dn) { + ads_msgfree(ads, res); + return ADS_ERROR(LDAP_NO_MEMORY); + } + + if (!add_string_to_array(mem_ctx, dn, + (const char ***)ous, + (int *)num_ous)) { + ads_memfree(ads, dn); + ads_msgfree(ads, res); + return ADS_ERROR(LDAP_NO_MEMORY); + } + + ads_memfree(ads, dn); + } + + ads_msgfree(ads, res); + + return status; +} + + /** * pull a DOM_SID from an extended dn string * @param mem_ctx TALLOC_CTX -- cgit From 8122eb767a83cd5f070ee99abae037c2a30c43e9 Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 3 Jan 2008 17:13:38 -0600 Subject: Update mount.cifs help Steve (This used to be commit b9d2da4d10e6e7ac2dc604565c7f2ce39d0916b5) --- source3/client/mount.cifs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c index a25ccc54de..79f402a7d4 100644 --- a/source3/client/mount.cifs.c +++ b/source3/client/mount.cifs.c @@ -39,7 +39,7 @@ #include #define MOUNT_CIFS_VERSION_MAJOR "1" -#define MOUNT_CIFS_VERSION_MINOR "10" +#define MOUNT_CIFS_VERSION_MINOR "11" #ifndef MOUNT_CIFS_VENDOR_SUFFIX #ifdef _SAMBA_BUILD_ @@ -136,14 +136,16 @@ static void mount_cifs_usage(void) printf("\nLess commonly used options:"); printf("\n\tcredentials=,guest,perm,noperm,setuids,nosetuids,rw,ro,"); printf("\n\tsep=,iocharset=,suid,nosuid,exec,noexec,serverino,"); - printf("\n\tdirectio,mapchars,nomapchars,nolock,servernetbiosname="); + printf("\n\tmapchars,nomapchars,nolock,servernetbiosname="); + printf("\n\tdirectio,nounix,cifsacl,sec=,sign"); printf("\n\nOptions not needed for servers supporting CIFS Unix extensions"); printf("\n\t(e.g. unneeded for mounts to most Samba versions):"); printf("\n\tuid=,gid=,dir_mode=,file_mode=,sfu"); printf("\n\nRarely used options:"); printf("\n\tport=,rsize=,wsize=,unc=,ip=,"); printf("\n\tdev,nodev,nouser_xattr,netbiosname=,hard,soft,intr,"); - printf("\n\tnointr,ignorecase,noposixpaths,noacl"); + printf("\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=,nobrl"); + printf("\n\tin6_addr"); printf("\n\nOptions are described in more detail in the manual page"); printf("\n\tman 8 mount.cifs\n"); printf("\nTo display the version number of the mount helper:"); -- cgit From 8dc1bf89a7ab78eb88a796e8d09e563b4d7d9649 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 11:21:53 +0100 Subject: Robustness fix for libnet join when unjoining. Guenther (This used to be commit d7f01d940feb7dfedb6c4b8b88f5443434e03428) --- source3/libnet/libnet_join.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index c289ad33e5..70777df247 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -319,10 +319,11 @@ static NTSTATUS do_DomainUnjoin(TALLOC_CTX *mem_ctx, } done: - rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); - rpccli_samr_close(pipe_hnd, mem_ctx, &sam_pol); - - cli_rpc_pipe_close(pipe_hnd); + if (pipe_hnd) { + rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_close(pipe_hnd, mem_ctx, &sam_pol); + cli_rpc_pipe_close(pipe_hnd); + } if (cli) { cli_shutdown(cli); -- cgit From cf6e59de2b475e14660a9b71daad2ab5699d53a7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 11:54:38 +0100 Subject: Fix some error strings in netdomjoin-gui. Guenther (This used to be commit aaea8f1ed744e9662f92a3840d86ad1aff943d18) --- .../examples/netdomjoin-gui/netdomjoin-gui.c | 43 ++++++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index beb12be8b1..3abf6fd5dc 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -1,7 +1,7 @@ /* * Unix SMB/CIFS implementation. * Join Support (gtk + netapi) - * Copyright (C) Guenther Deschner 2007 + * Copyright (C) Guenther Deschner 2007-2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -124,7 +124,6 @@ static void free_join_state(struct join_state *s) SAFE_FREE(s->my_fqdn); SAFE_FREE(s->my_dnsdomain); SAFE_FREE(s->my_hostname); - } static void do_cleanup(struct join_state *state) @@ -365,7 +364,8 @@ static void callback_do_join(GtkWidget *widget, uint32_t unjoin_flags = 0; gboolean domain_join = FALSE; gboolean try_unjoin = FALSE; - const char *domain_or_workgroup = NULL; + const char *new_workgroup_type = NULL; + const char *initial_workgroup_type = NULL; struct join_state *state = (struct join_state *)data; @@ -376,14 +376,33 @@ static void callback_do_join(GtkWidget *widget, gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt)); } + switch (state->name_type_initial) { + case NetSetupWorkgroupName: + initial_workgroup_type = "workgroup"; + break; + case NetSetupDomainName: + initial_workgroup_type = "domain"; + break; + default: + break; + } + + switch (state->name_type_new) { + case NetSetupWorkgroupName: + new_workgroup_type = "workgroup"; + break; + case NetSetupDomainName: + new_workgroup_type = "domain"; + break; + default: + break; + } + if (state->name_type_new == NetSetupDomainName) { domain_join = TRUE; join_flags = WKSSVC_JOIN_FLAGS_JOIN_TYPE | WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE | WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED; /* for testing */ - domain_or_workgroup = "domain"; - } else { - domain_or_workgroup = "workgroup"; } if ((state->name_type_initial == NetSetupDomainName) && @@ -394,7 +413,7 @@ static void callback_do_join(GtkWidget *widget, } debug("callback_do_join: Joining a %s named %s using join_flags 0x%08x ", - domain_or_workgroup, + new_workgroup_type, state->name_buffer_new, join_flags); if (domain_join) { @@ -422,8 +441,8 @@ static void callback_do_join(GtkWidget *widget, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "The following error occured attempting to unjoin the %s: \"%s\": %s", - domain_or_workgroup, - state->name_buffer_new, + initial_workgroup_type, + state->name_buffer_initial, err_str); g_signal_connect_swapped(dialog, "response", @@ -451,7 +470,7 @@ static void callback_do_join(GtkWidget *widget, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "The following error occured attempting to join the %s: \"%s\": %s", - domain_or_workgroup, + new_workgroup_type, state->name_buffer_new, err_str); @@ -465,7 +484,7 @@ static void callback_do_join(GtkWidget *widget, } debug("callback_do_join: Successfully joined %s\n", - domain_or_workgroup); + new_workgroup_type); dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -473,7 +492,7 @@ static void callback_do_join(GtkWidget *widget, GTK_BUTTONS_OK, "Welcome to the %s %s.", state->name_buffer_new, - domain_or_workgroup); + new_workgroup_type); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); -- cgit From 5c09517d7d9fa6252e5cece990f56fcb525414e0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 12:57:49 +0100 Subject: Fix crash bug in regdb_close() when called with no ref count. Michael, please check. Guenther (This used to be commit d6575ff5d240ec431b6e837494913dbd06e5a299) --- source3/registry/reg_db.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index 25c6557c87..19799292ff 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -329,6 +329,10 @@ WERROR regdb_open( void ) int regdb_close( void ) { + if (tdb_refcount == 0) { + return 0; + } + tdb_refcount--; DEBUG(10,("regdb_close: decrementing refcount (%d)\n", tdb_refcount)); -- cgit From 564a54aa168a0866dbd8fb3ef512b1836be11442 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 15:08:28 +0100 Subject: Minor cosmetic cleanup for netdomjoin-gui. Guenther (This used to be commit 02e3887f3962b469c965110b6141a6655f2347af) --- .../netapi/examples/netdomjoin-gui/logo-small.png | Bin 0 -> 4485 bytes .../examples/netdomjoin-gui/netdomjoin-gui.c | 55 ++++++++++++++------- 2 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 source3/lib/netapi/examples/netdomjoin-gui/logo-small.png diff --git a/source3/lib/netapi/examples/netdomjoin-gui/logo-small.png b/source3/lib/netapi/examples/netdomjoin-gui/logo-small.png new file mode 100644 index 0000000000..f041198002 Binary files /dev/null and b/source3/lib/netapi/examples/netdomjoin-gui/logo-small.png differ diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index 3abf6fd5dc..d12e66bb26 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -35,6 +35,7 @@ #define SAMBA_ICON_PATH "/usr/share/pixmaps/samba/samba.ico" #define SAMBA_IMAGE_PATH "/usr/share/pixmaps/samba/logo.png" +#define SAMBA_IMAGE_PATH_SMALL "/usr/share/pixmaps/samba/logo-small.png" #define WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED ( 0x00000020 ) #define WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE ( 0x00000004 ) @@ -224,7 +225,8 @@ static void callback_do_reboot(GtkWidget *widget, gtk_widget_destroy(dialog); #endif - gtk_label_set_text(GTK_LABEL(state->label_reboot), "Changes will take effect after you restart this computer"); + gtk_label_set_text(GTK_LABEL(state->label_reboot), + "Changes will take effect after you restart this computer"); debug("destroying do_change window\n"); gtk_widget_destroy(GTK_WIDGET(state->window_do_change)); @@ -247,11 +249,14 @@ static void callback_do_reboot(GtkWidget *widget, SAFE_FREE(buffer); state->name_type_new = type; #endif - gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer), state->name_buffer_new); - if (state->name_type_new == 3) { - gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Domain:"); + gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer), + state->name_buffer_new); + if (state->name_type_new == NetSetupDomainName) { + gtk_label_set_text(GTK_LABEL(state->label_current_name_type), + "Domain:"); } else { - gtk_label_set_text(GTK_LABEL(state->label_current_name_type), "Workgroup:"); + gtk_label_set_text(GTK_LABEL(state->label_current_name_type), + "Workgroup:"); } } } @@ -779,6 +784,8 @@ static void callback_do_change(GtkWidget *widget, debug("callback_do_change called\n"); +#if 0 + /* FIXME: add proper warnings for Samba as a DC */ if (state->server_role == 3) { GtkWidget *dialog; dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), @@ -793,13 +800,14 @@ static void callback_do_change(GtkWidget *widget, gtk_widget_show(dialog); return; } +#endif state->button_ok = gtk_button_new_from_stock(GTK_STOCK_OK); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "Computer Name Changes"); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); - gtk_widget_set_size_request(GTK_WIDGET(window), 480, 500); /* breite * höhe */ + gtk_widget_set_size_request(GTK_WIDGET(window), 480, 500); gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); g_signal_connect(G_OBJECT(window), "delete_event", @@ -849,14 +857,17 @@ static void callback_do_change(GtkWidget *widget, char *str = NULL; entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); if (state->name_type_initial == NetSetupDomainName) { - asprintf(&str, "%s.%s", entry_text, state->my_dnsdomain); + asprintf(&str, "%s.%s", entry_text, + state->my_dnsdomain); } else { asprintf(&str, "%s.", entry_text); } - gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), str); + gtk_label_set_text(GTK_LABEL(state->label_full_computer_name), + str); free(str); gtk_misc_set_alignment(GTK_MISC(state->label_full_computer_name), 0, 0); - gtk_box_pack_start(GTK_BOX(box1), state->label_full_computer_name, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(box1), + state->label_full_computer_name, TRUE, TRUE, 0); gtk_widget_show(state->label_full_computer_name); } @@ -891,7 +902,8 @@ static void callback_do_change(GtkWidget *widget, G_CALLBACK(callback_continue), (gpointer)state); if (state->name_type_initial == NetSetupDomainName) { - gtk_entry_set_text(GTK_ENTRY(state->entry_domain), state->name_buffer_initial); + gtk_entry_set_text(GTK_ENTRY(state->entry_domain), + state->name_buffer_initial); gtk_widget_set_sensitive(state->entry_workgroup, FALSE); gtk_widget_set_sensitive(state->entry_domain, TRUE); } @@ -912,7 +924,8 @@ static void callback_do_change(GtkWidget *widget, G_CALLBACK(callback_do_join_workgroup), (gpointer)state); { - gtk_entry_set_max_length(GTK_ENTRY(state->entry_workgroup), MAX_NETBIOS_NAME_LEN); + gtk_entry_set_max_length(GTK_ENTRY(state->entry_workgroup), + MAX_NETBIOS_NAME_LEN); g_signal_connect(G_OBJECT(state->entry_workgroup), "changed", G_CALLBACK(callback_enter_workgroup_and_unlock), (gpointer)state); @@ -921,7 +934,8 @@ static void callback_do_change(GtkWidget *widget, (gpointer)state); if (state->name_type_initial == NetSetupWorkgroupName) { - gtk_entry_set_text(GTK_ENTRY(state->entry_workgroup), state->name_buffer_initial); + gtk_entry_set_text(GTK_ENTRY(state->entry_workgroup), + state->name_buffer_initial); gtk_widget_set_sensitive(GTK_WIDGET(state->entry_domain), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(state->entry_workgroup), TRUE); } @@ -998,21 +1012,25 @@ static int draw_main_window(struct join_state *state) icon = gdk_pixbuf_new_from_file(SAMBA_ICON_PATH, &error); if (icon == NULL) { - g_print("failed to load logo from %s : %s\n", + g_print("failed to load icon from %s : %s\n", SAMBA_ICON_PATH, error->message); } #if 1 - image = gtk_image_new_from_file(SAMBA_IMAGE_PATH); + image = gtk_image_new_from_file(SAMBA_IMAGE_PATH_SMALL); #else image = gtk_image_new_from_file("/usr/share/pixmaps/redhat-system_settings.png"); #endif + if (image == NULL) { + g_print("failed to load logo from %s : %s\n", + SAMBA_IMAGE_PATH_SMALL, error->message); + } window = gtk_window_new(GTK_WINDOW_TOPLEVEL); state->window_main = window; gtk_window_set_title(GTK_WINDOW(window), "Samba - Join Domain dialogue"); - gtk_widget_set_size_request(GTK_WIDGET(window), 600, 600); /* breite * höhe */ + gtk_widget_set_size_request(GTK_WIDGET(window), 600, 600); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); gtk_window_set_icon_from_file(GTK_WINDOW(window), SAMBA_ICON_PATH, NULL); @@ -1034,14 +1052,15 @@ static int draw_main_window(struct join_state *state) { /* gtk_box_pack_start(GTK_BOX(main_vbox), image, TRUE, TRUE, 10); */ - gtk_misc_set_alignment(GTK_MISC(image), 0, 0); +/* gtk_misc_set_alignment(GTK_MISC(image), 0, 0); */ + gtk_widget_set_size_request(GTK_WIDGET(image), 150, 40); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 10); gtk_widget_show(image); /* Label */ label = gtk_label_new("Samba uses the following information to identify your computer on the network."); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - gtk_widget_set_size_request(GTK_WIDGET(label), 500, 40); +/* gtk_misc_set_alignment(GTK_MISC(label), 0, 0); */ + gtk_widget_set_size_request(GTK_WIDGET(label), 400, 40); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_widget_show(label); -- cgit From f78c318eb0b50862b2e6ed6783ee5279af91709c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 15:18:42 +0100 Subject: Add debug switch to netdomjoin. Guenther (This used to be commit 2b221708c07967bccd68e8c7983791b4628405bb) --- source3/lib/netapi/examples/netdomjoin/netdomjoin.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source3/lib/netapi/examples/netdomjoin/netdomjoin.c b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c index e8b529927f..634d265597 100644 --- a/source3/lib/netapi/examples/netdomjoin/netdomjoin.c +++ b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c @@ -1,7 +1,7 @@ /* * Unix SMB/CIFS implementation. * Join Support (cmdline + netapi) - * Copyright (C) Guenther Deschner 2007 + * Copyright (C) Guenther Deschner 2007-2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,7 +56,10 @@ int main(int argc, char **argv) if (argc < 2) { printf("usage: netdomjoin\n"); - printf("\t[hostname=HOSTNAME] [domain=DOMAIN] \n"); + printf("\t[hostname] [domain=DOMAIN] " + " " + " " + "\n"); return 0; } @@ -87,6 +90,11 @@ int main(int argc, char **argv) str = get_string_param(argv[i]); libnetapi_set_password(ctx, str); } + if (strncasecmp(argv[i], "debug", strlen("debug"))== 0) { + const char *str = NULL; + str = get_string_param(argv[i]); + libnetapi_set_debuglevel(ctx, str); + } } status = NetJoinDomain(server_name, -- cgit From 1c183874abaad10188c9f9bf1db2863cbd4d1cef Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 15:20:46 +0100 Subject: Use the proper boolean constants. Michael (This used to be commit 2ba625e473e8eb23d692566d32a8ac965785df4e) --- source3/registry/reg_db.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index 19799292ff..eba220b76c 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -259,7 +259,7 @@ bool regdb_init( void ) uint32 vers_id; if ( tdb_reg ) - return True; + return true; if ( !(tdb_reg = tdb_wrap_open(NULL, state_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600)) ) { @@ -267,7 +267,7 @@ bool regdb_init( void ) if ( !tdb_reg ) { DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n", state_path("registry.tdb"), strerror(errno) )); - return False; + return false; } DEBUG(10,("regdb_init: Successfully created registry tdb\n")); @@ -287,10 +287,10 @@ bool regdb_init( void ) if ( !init_registry_data() ) { DEBUG(0,("init_registry: Failed to initialize data in registry!\n")); - return False; + return false; } - return True; + return true; } /*********************************************************************** @@ -368,7 +368,7 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr) uint8 *buffer = NULL; int i = 0; uint32 len, buflen; - bool ret = True; + bool ret = true; uint32 num_subkeys = regsubkey_ctr_numkeys(ctr); char *keyname = NULL; TALLOC_CTX *ctx = talloc_tos(); @@ -386,7 +386,7 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr) /* allocate some initial memory */ if (!(buffer = (uint8 *)SMB_MALLOC(1024))) { - return False; + return false; } buflen = 1024; len = 0; @@ -403,7 +403,7 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr) /* allocate some extra space */ if ((buffer = (uint8 *)SMB_REALLOC( buffer, len*2 )) == NULL) { DEBUG(0,("regdb_store_keys: Failed to realloc memory of size [%d]\n", len*2)); - ret = False; + ret = false; goto done; } buflen = len*2; @@ -417,7 +417,7 @@ static bool regdb_store_keys_internal(const char *key, REGSUBKEY_CTR *ctr) dbuf.dptr = buffer; dbuf.dsize = len; if ( tdb_store_bystring( tdb_reg->tdb, keyname, dbuf, TDB_REPLACE ) == -1) { - ret = False; + ret = false; goto done; } @@ -805,7 +805,7 @@ bool regdb_store_values( const char *key, REGVAL_CTR *values ) && (memcmp(old_data.dptr, data.dptr, data.dsize) == 0)) { SAFE_FREE(old_data.dptr); SAFE_FREE(data.dptr); - return True; + return true; } ret = tdb_trans_store_bystring(tdb_reg->tdb, keystr, data, TDB_REPLACE); -- cgit From 0399df22f0f0999338e48d7b9598a7b2f7b9aab5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 17:01:52 +0100 Subject: In libnet_join finally separate the admin from the machine pwd entirely. Guenther (This used to be commit d88bb94f0ef00ddbb48498797bd11448e0d74645) --- source3/lib/netapi/joindomain.c | 10 +++++----- source3/libnet/libnet_join.c | 28 +++++++++++++++------------- source3/libnet/libnet_join.h | 7 ++++--- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index d200c9b7b0..921f816cbe 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -1,7 +1,7 @@ /* * Unix SMB/CIFS implementation. * NetApi Join Support - * Copyright (C) Guenther Deschner 2007 + * Copyright (C) Guenther Deschner 2007-2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,8 +69,8 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, } if (password) { - r->in.password = talloc_strdup(mem_ctx, password); - W_ERROR_HAVE_NO_MEMORY(r->in.password); + r->in.admin_password = talloc_strdup(mem_ctx, password); + W_ERROR_HAVE_NO_MEMORY(r->in.admin_password); } r->in.join_flags = join_flags; @@ -254,8 +254,8 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, } if (password) { - r->in.password = talloc_strdup(mem_ctx, password); - W_ERROR_HAVE_NO_MEMORY(r->in.password); + r->in.admin_password = talloc_strdup(mem_ctx, password); + W_ERROR_HAVE_NO_MEMORY(r->in.admin_password); } r->in.unjoin_flags = unjoin_flags; diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 70777df247..26b4320267 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -2,7 +2,7 @@ * Unix SMB/CIFS implementation. * libnet Join Support * Copyright (C) Gerald (Jerry) Carter 2006 - * Copyright (C) Guenther Deschner 2007 + * Copyright (C) Guenther Deschner 2007-2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,7 +27,6 @@ static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, { struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_hnd = NULL; - const char *password = NULL; POLICY_HND sam_pol, domain_pol, user_pol, lsa_pol; NTSTATUS status = NT_STATUS_UNSUCCESSFUL; char *acct_name; @@ -46,17 +45,19 @@ static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, DATA_BLOB digested_session_key; uchar md4_trust_password[16]; - password = talloc_strdup(mem_ctx, - generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH)); - NT_STATUS_HAVE_NO_MEMORY(password); + if (!r->in.machine_password) { + r->in.machine_password = talloc_strdup(mem_ctx, generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH)); + NT_STATUS_HAVE_NO_MEMORY(r->in.machine_password); + } status = cli_full_connection(&cli, NULL, r->in.server_name, NULL, 0, "IPC$", "IPC", r->in.admin_account, - NULL, //r->in.domain_name, - r->in.password, - 0, Undefined, NULL); + NULL, + r->in.admin_password, + 0, + Undefined, NULL); if (!NT_STATUS_IS_OK(status)) { goto done; @@ -152,15 +153,16 @@ static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, goto done; } - E_md4hash(password, md4_trust_password); - encode_pw_buffer(pwbuf, password, STR_UNICODE); + E_md4hash(r->in.machine_password, md4_trust_password); + encode_pw_buffer(pwbuf, r->in.machine_password, STR_UNICODE); generate_random_buffer((uint8*)md5buffer, sizeof(md5buffer)); digested_session_key = data_blob_talloc(mem_ctx, 0, 16); MD5Init(&md5ctx); MD5Update(&md5ctx, md5buffer, sizeof(md5buffer)); - MD5Update(&md5ctx, cli->user_session_key.data, cli->user_session_key.length); + MD5Update(&md5ctx, cli->user_session_key.data, + cli->user_session_key.length); MD5Final(digested_session_key.data, &md5ctx); SamOEMhashBlob(pwbuf, sizeof(pwbuf), &digested_session_key); @@ -237,8 +239,8 @@ static NTSTATUS do_DomainUnjoin(TALLOC_CTX *mem_ctx, NULL, 0, "IPC$", "IPC", r->in.admin_account, - NULL, //r->in.domain_name, - r->in.password, + NULL, + r->in.admin_password, 0, Undefined, NULL); if (!NT_STATUS_IS_OK(status)) { diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h index 46ab27e8b0..85c756f77b 100644 --- a/source3/libnet/libnet_join.h +++ b/source3/libnet/libnet_join.h @@ -1,7 +1,7 @@ /* * Unix SMB/CIFS implementation. * libnet Join Support - * Copyright (C) Guenther Deschner 2007 + * Copyright (C) Guenther Deschner 2007-2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +26,8 @@ struct libnet_JoinCtx { const char *domain_name; const char *account_ou; const char *admin_account; - const char *password; + const char *admin_password; + const char *machine_password; uint32_t join_flags; const char *os_version; const char *os_string; @@ -50,7 +51,7 @@ struct libnet_UnjoinCtx { const char *server_name; const char *domain_name; const char *admin_account; - const char *password; + const char *admin_password; uint32_t unjoin_flags; bool modify_config; struct dom_sid *domain_sid; -- cgit From 6f84ea9cd78e72b324ab6fad654b9aa109364d82 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 17:09:21 +0100 Subject: Separate out storing and removing secrets in libnet_join/unjoin. Guenther (This used to be commit b59ca2d9c3375c0d0b9f585e48d718689586bb92) --- source3/libnet/libnet_join.c | 76 ++++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 26b4320267..bd52ab7064 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -22,8 +22,27 @@ #include "libnet/libnet_join.h" #include "libnet/libnet_proto.h" -static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, - struct libnet_JoinCtx *r) +static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + if (!secrets_store_domain_sid(r->out.netbios_domain_name, + r->out.domain_sid)) + { + return false; + } + + if (!secrets_store_machine_password(r->in.machine_password, + r->out.netbios_domain_name, + SEC_CHAN_WKSTA)) + { + return false; + } + + return true; +} + +static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) { struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_hnd = NULL; @@ -196,21 +215,6 @@ static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); cli_rpc_pipe_close(pipe_hnd); - if (!secrets_store_domain_sid(r->out.netbios_domain_name, - r->out.domain_sid)) - { - status = NT_STATUS_INTERNAL_DB_ERROR; - goto done; - } - - if (!secrets_store_machine_password(password, - r->out.netbios_domain_name, - SEC_CHAN_WKSTA)) - { - status = NT_STATUS_INTERNAL_DB_ERROR; - goto done; - } - status = NT_STATUS_OK; done: if (cli) { @@ -220,8 +224,22 @@ static NTSTATUS do_DomainJoin(TALLOC_CTX *mem_ctx, return status; } -static NTSTATUS do_DomainUnjoin(TALLOC_CTX *mem_ctx, - struct libnet_UnjoinCtx *r) +static bool libnet_join_unjoindomain_remove_secrets(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r) +{ + if (!secrets_delete_machine_password_ex(lp_workgroup())) { + return false; + } + + if (!secrets_delete_domain_sid(lp_workgroup())) { + return false; + } + + return true; +} + +static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r) { struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_hnd = NULL; @@ -310,16 +328,6 @@ static NTSTATUS do_DomainUnjoin(TALLOC_CTX *mem_ctx, rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); - if (!secrets_delete_machine_password_ex(lp_workgroup())) { - status = NT_STATUS_INTERNAL_DB_ERROR; - goto done; - } - - if (!secrets_delete_domain_sid(lp_workgroup())) { - status = NT_STATUS_INTERNAL_DB_ERROR; - goto done; - } - done: if (pipe_hnd) { rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); @@ -484,13 +492,17 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - status = do_DomainJoin(mem_ctx, r); + status = libnet_join_joindomain_rpc(mem_ctx, r); if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { return WERR_SETUP_ALREADY_JOINED; } return ntstatus_to_werror(status); } + + if (!libnet_join_joindomain_store_secrets(mem_ctx, r)) { + return WERR_SETUP_NOT_JOINED; + } } werr = do_JoinConfig(r); @@ -513,13 +525,15 @@ WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx, if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - status = do_DomainUnjoin(mem_ctx, r); + status = libnet_join_unjoindomain_rpc(mem_ctx, r); if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { return WERR_SETUP_NOT_JOINED; } return ntstatus_to_werror(status); } + + libnet_join_unjoindomain_remove_secrets(mem_ctx, r); } werr = do_UnjoinConfig(r); -- cgit From 28ef4878d937405340cc1984ef674ad0b670ef0c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 17:11:14 +0100 Subject: Rename server_name to dc_name in libnet join structures. Guenther (This used to be commit ff5e15b1ba0d5c39ceef9f9995c107e510162564) --- source3/lib/netapi/joindomain.c | 14 ++++++++------ source3/libnet/libnet_join.c | 6 ++++-- source3/libnet/libnet_join.h | 5 +++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 921f816cbe..0d4452e1df 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -54,8 +54,9 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); } - r->in.server_name = talloc_strdup(mem_ctx, info->domain_controller_name); - W_ERROR_HAVE_NO_MEMORY(r->in.server_name); + r->in.dc_name = talloc_strdup(mem_ctx, + info->domain_controller_name); + W_ERROR_HAVE_NO_MEMORY(r->in.dc_name); } if (account_ou) { @@ -224,8 +225,8 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, W_ERROR_NOT_OK_RETURN(werr); if (server_name) { - r->in.server_name = talloc_strdup(mem_ctx, server_name); - W_ERROR_HAVE_NO_MEMORY(r->in.server_name); + r->in.dc_name = talloc_strdup(mem_ctx, server_name); + W_ERROR_HAVE_NO_MEMORY(r->in.dc_name); } else { NTSTATUS status; @@ -244,8 +245,9 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); } - r->in.server_name = talloc_strdup(mem_ctx, info->domain_controller_name); - W_ERROR_HAVE_NO_MEMORY(r->in.server_name); + r->in.dc_name = talloc_strdup(mem_ctx, + info->domain_controller_name); + W_ERROR_HAVE_NO_MEMORY(r->in.dc_name); } if (account) { diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index bd52ab7064..95b643ffa6 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -69,7 +69,8 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, NT_STATUS_HAVE_NO_MEMORY(r->in.machine_password); } - status = cli_full_connection(&cli, NULL, r->in.server_name, + status = cli_full_connection(&cli, NULL, + r->in.dc_name, NULL, 0, "IPC$", "IPC", r->in.admin_account, @@ -253,7 +254,8 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx, SAM_USERINFO_CTR ctr, *qctr = NULL; SAM_USER_INFO_16 p16; - status = cli_full_connection(&cli, NULL, r->in.server_name, + status = cli_full_connection(&cli, NULL, + r->in.dc_name, NULL, 0, "IPC$", "IPC", r->in.admin_account, diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h index 85c756f77b..9e7b8a9813 100644 --- a/source3/libnet/libnet_join.h +++ b/source3/libnet/libnet_join.h @@ -22,7 +22,8 @@ struct libnet_JoinCtx { struct { - const char *server_name; + const char *dc_name; + const char *machine_name; const char *domain_name; const char *account_ou; const char *admin_account; @@ -48,7 +49,7 @@ struct libnet_JoinCtx { struct libnet_UnjoinCtx { struct { - const char *server_name; + const char *dc_name; const char *domain_name; const char *admin_account; const char *admin_password; -- cgit From 77219ddd220649986fc4f1532271a832d25528bc Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 17:33:24 +0100 Subject: Fix build warning. Guenther (This used to be commit a43125d9e9052fab8eb561976f45d1db4622482e) --- source3/utils/net_conf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index a758391630..63d5477c9d 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -856,7 +856,6 @@ int net_conf(int argc, const char **argv) regdb_close(); -done: return ret; } -- cgit From 2a8722d4c3177077f5d6cc648f4ef42e38e0ab4d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 19:49:57 +0100 Subject: Fix the behaviour of "net conf setparm" to create the share if necessary. This moves functionality taken away from libnet_conf_set_parameter() to the higher level user frontend function. (Somehow I thought I had done this already ... :-) Michael (This used to be commit fc0fca980f08a0af65d82784ef5a50a7b1ac0927) --- source3/utils/net_conf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 63d5477c9d..2df2410160 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -719,6 +719,15 @@ static int net_conf_setparm(int argc, const char **argv) param = strdup_lower(argv[1]); value_str = argv[2]; + if (!libnet_conf_share_exists(service)) { + werr = libnet_conf_create_share(service); + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error creating share '%s': %s\n", + service, dos_errstr(werr)); + goto done; + } + } + werr = libnet_conf_set_parameter(service, param, value_str); if (!W_ERROR_IS_OK(werr)) { -- cgit From b1472c0956c6d016973c2a76e4dfce5ecc3b9c05 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 19:52:22 +0100 Subject: Remove the final regdb_close() from net_conf.c This is to hide the registry from net_conf. Right now, it does not harm if "net conf" does not close the registry file explicitly just before exiting. I am working out a proper way of handling open/close operations transparently in the libnet_conf library. Michael (This used to be commit 790ef789444945fbae5637f0b469665859171dcd) --- source3/utils/net_conf.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 2df2410160..d212b451bc 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -863,8 +863,6 @@ int net_conf(int argc, const char **argv) ret = net_run_function2(argc, argv, "net conf", func); - regdb_close(); - return ret; } -- cgit From f215dec8311b733c2db52c87a4e34dafecbea736 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 19:58:19 +0100 Subject: Map WERR_NO_SUCH_SERVICE with dos_errstr(). Michael (This used to be commit df5839b5376e903486982ddc7c4f4fbd4550c60a) --- source3/libsmb/doserr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libsmb/doserr.c b/source3/libsmb/doserr.c index ba68b5a1e8..79445a2410 100644 --- a/source3/libsmb/doserr.c +++ b/source3/libsmb/doserr.c @@ -92,6 +92,7 @@ werror_code_struct dos_errs[] = { "WERR_REG_CORRUPT", WERR_REG_CORRUPT }, { "WERR_REG_IO_FAILURE", WERR_REG_IO_FAILURE }, { "WERR_REG_FILE_INVALID", WERR_REG_FILE_INVALID }, + { "WERR_NO_SUCH_SERVICE", WERR_NO_SUCH_SERVICE }, { "WERR_SERVICE_DISABLED", WERR_SERVICE_DISABLED }, { "WERR_CAN_NOT_COMPLETE", WERR_CAN_NOT_COMPLETE}, { "WERR_INVALID_FLAGS", WERR_INVALID_FLAGS}, -- cgit From 9a45dcef4d7c0f85d371afb2f7e09ae63bb7ae65 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Fri, 4 Jan 2008 13:31:07 -0600 Subject: When connecting to an AD DC, use the DsGetDCName variant. This allows us to deal with child domains in transitive forest trusts. It also allows us to fill in the forest name to the target domain to the struct winbindd_domain *. (This used to be commit ed30516bb0f55f9ba466debf91b6e33d1c28a484) --- source3/winbindd/winbindd_cm.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 33674d2cf7..99e401d53f 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -601,8 +601,34 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain, orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000); - werr = rpccli_netlogon_getanydcname(netlogon_pipe, mem_ctx, our_domain->dcname, + if (our_domain->active_directory) { + struct DS_DOMAIN_CONTROLLER_INFO *domain_info = NULL; + + werr = rpccli_netlogon_dsr_getdcname(netlogon_pipe, + mem_ctx, + our_domain->dcname, + domain->name, + NULL, + NULL, + DS_RETURN_DNS_NAME, + &domain_info); + if (W_ERROR_IS_OK(werr)) { + fstrcpy(tmp, domain_info->domain_controller_name); + if (strlen(domain->alt_name) == 0) { + fstrcpy(domain->alt_name, + CONST_DISCARD(char*, domain_info->domain_name)); + } + if (strlen(domain->forest_name) == 0) { + fstrcpy(domain->forest_name, + CONST_DISCARD(char*, domain_info->dns_forest_name)); + } + } + } else { + + werr = rpccli_netlogon_getanydcname(netlogon_pipe, mem_ctx, + our_domain->dcname, domain->name, &tmp); + } /* And restore our original timeout. */ cli_set_timeout(netlogon_pipe->cli, orig_timeout); @@ -1869,9 +1895,17 @@ no_lsarpc_ds: if (dns_name) fstrcpy(domain->alt_name, dns_name); - if ( forest_name ) + /* See if we can set some domain trust flags about + ourself */ + + if ( forest_name ) { fstrcpy(domain->forest_name, forest_name); + if (strequal(domain->forest_name, domain->alt_name)) { + domain->domain_flags = DS_DOMAIN_TREE_ROOT; + } + } + if (dom_sid) sid_copy(&domain->sid, dom_sid); } else { -- cgit From bcc2a6a9d759adc52ed9176bd1153da4b5a79722 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Fri, 4 Jan 2008 13:32:58 -0600 Subject: Ensure that winbindd_getgroups() can deal with a UPN name. A user logging in via GDM was not getting a complete list of supplementary groups in his/her token. This is because getgroup() was not able to find the winbindd_domain* using the DNS name. Fallback to matching the DNS name is the short name match failes. (This used to be commit 2030a8de19a2c7c735a8aa367dd953e4a5c447b8) --- source3/winbindd/winbindd_group.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c index fbd2fee692..62e8d1c40b 100644 --- a/source3/winbindd/winbindd_group.c +++ b/source3/winbindd/winbindd_group.c @@ -1494,9 +1494,18 @@ void winbindd_getgroups(struct winbindd_cli_state *state) s->username = talloc_strdup( state->mem_ctx, state->request.data.username ); } - /* Get info for the domain */ + /* Get info for the domain (either by short domain name or + DNS name in the case of a UPN) */ s->domain = find_domain_from_name_noinit(s->domname); + if (!s->domain) { + char *p = strchr(s->username, '@'); + + if (p) { + s->domain = find_domain_from_name_noinit(p+1); + } + + } if (s->domain == NULL) { DEBUG(7, ("could not find domain entry for domain %s\n", -- cgit From 4093b0632cda821f331f9ff50c51aa63c799292f Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Fri, 4 Jan 2008 13:34:10 -0600 Subject: Add a missing check for dealing with a one-way trust in query_user(). (This used to be commit f89e356bdaa203ef0a3ce6b8bd52170afa68a2c9) --- source3/winbindd/winbindd_rpc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c index ffb47692cb..f5e1226447 100644 --- a/source3/winbindd/winbindd_rpc.c +++ b/source3/winbindd/winbindd_rpc.c @@ -456,6 +456,12 @@ static NTSTATUS query_user(struct winbindd_domain *domain, return NT_STATUS_OK; } + if ( !winbindd_can_contact_domain( domain ) ) { + DEBUG(10,("query_user: No incoming trust for domain %s\n", + domain->name)); + return NT_STATUS_OK; + } + /* no cache; hit the wire */ result = cm_connect_sam(domain, mem_ctx, &cli, &dom_pol); -- cgit From 84a50e21541e4c3a0bfb70d5d501dc4b7e6f9714 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Fri, 4 Jan 2008 13:35:41 -0600 Subject: Fix the inherited trust flags when spidering the trust heirarchy. Also *do not* clear the trust list when rescanning or else it is possible to suffer from a race condition where no trusted domains can be found. (This used to be commit e7164a252bf213a74d6eeac5aa04645eed5be241) --- source3/winbindd/winbindd_ads.c | 12 ++++++++++++ source3/winbindd/winbindd_util.c | 10 +++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c index c9b2a52388..3aba824b0b 100644 --- a/source3/winbindd/winbindd_ads.c +++ b/source3/winbindd/winbindd_ads.c @@ -1270,12 +1270,24 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain, d.domain_type = domains[i].trust_type; d.domain_trust_attribs = domains[i].trust_attributes; } else { + /* Look up the record in the cache */ + struct winbindd_tdc_domain *parent; + DEBUG(10,("trusted_domains(ads): Inheriting trust " "flags for domain %s\n", d.alt_name)); + + parent = wcache_tdc_fetch_domain(NULL, domain->name); + if (parent) { + d.domain_flags = parent->trust_flags; + d.domain_type = parent->trust_type; + d.domain_trust_attribs = parent->trust_attribs; + } else { d.domain_flags = domain->domain_flags; d.domain_type = domain->domain_type; d.domain_trust_attribs = domain->domain_trust_attribs; } + TALLOC_FREE(parent); + } wcache_tdc_add_domain( &d ); diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 70468b6bcd..cc12d4b7ea 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -500,9 +500,13 @@ void rescan_trusted_domains( void ) ((now-last_trustdom_scan) < WINBINDD_RESCAN_FREQ) ) return; - /* clear the TRUSTDOM cache first */ - - wcache_tdc_clear(); + /* I use to clear the cache here and start over but that + caused problems in child processes that needed the + trust dom list early on. Removing it means we + could have some trusted domains listed that have been + removed from our primary domain's DC until a full + restart. This should be ok since I think this is what + Windows does as well. */ /* this will only add new domains we didn't already know about in the domain_list()*/ -- cgit From 34fb7839658af03da0a5f3939777ceb6576dfb42 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 21:03:24 +0100 Subject: Update the introductory comment to net_conf.c to mention linbet_conf. Michael (This used to be commit e166b886375b450534c894676ab1f64571dd46b8) --- source3/utils/net_conf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index d212b451bc..f1bf330950 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -19,9 +19,13 @@ */ /* - * This is an interface to the configuration stored inside the - * samba registry. In the future there might be support for other - * configuration backends as well. + * This is an interface to the Samba's configuration as made available + * by the libnet_conf interface (source/libnet/libnet_conf.c). + * + * This currently supports local interaction with the configuration + * stored in the registry. But other backends and remote access via + * rpc (to registry stored configuration) might get implemented in + * the future. */ #include "includes.h" -- cgit From dee8e32d8d66fb07817f28780978cd2b928233ad Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 21:05:51 +0100 Subject: Remove the word "registry" from the help output of the "net conf" command. Michael (This used to be commit 8d9e3e08f3cc6a1f54661d1e54a3902ad50be191) --- source3/utils/net_conf.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index f1bf330950..1cf98aa3a2 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -24,8 +24,7 @@ * * This currently supports local interaction with the configuration * stored in the registry. But other backends and remote access via - * rpc (to registry stored configuration) might get implemented in - * the future. + * rpc might get implemented in the future. */ #include "includes.h" @@ -847,15 +846,15 @@ int net_conf(int argc, const char **argv) {"import", net_conf_import, "Import configuration from file in smb.conf format."}, {"listshares", net_conf_listshares, - "List the registry shares."}, + "List the share names."}, {"drop", net_conf_drop, - "Delete the complete configuration from registry."}, + "Delete the complete configuration."}, {"showshare", net_conf_showshare, - "Show the definition of a registry share."}, + "Show the definition of a share."}, {"addshare", net_conf_addshare, - "Create a new registry share."}, + "Create a new share."}, {"delshare", net_conf_delshare, - "Delete a registry share."}, + "Delete a share."}, {"setparm", net_conf_setparm, "Store a parameter."}, {"getparm", net_conf_getparm, -- cgit From dbdaa5eeec62e2a643a8be36db0a30c20092b064 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 21:09:55 +0100 Subject: Fix a comment. Michael (This used to be commit fc9c3f39b5af55026f1e5e964857c203cf6c9316) --- source3/utils/net_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 1cf98aa3a2..52dcda03db 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -19,7 +19,7 @@ */ /* - * This is an interface to the Samba's configuration as made available + * This is an interface to Samba's configuration as made available * by the libnet_conf interface (source/libnet/libnet_conf.c). * * This currently supports local interaction with the configuration -- cgit From 517ad5318d3d196713b96f69eff8e2f5d38d922a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 21:16:48 +0100 Subject: Fix spacing - spaces mixed with tabs. Michael (This used to be commit a4ef828102417f04af1e9823c89404e77e4fd5c1) --- source3/utils/net_conf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 52dcda03db..38cdeacc11 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -46,9 +46,9 @@ static int net_conf_import_usage(int argc, const char**argv) d_printf("USAGE: net conf import [--test|-T] " "[]\n" "\t[--test|-T] testmode - do not act, just print " - "what would be done\n" + "what would be done\n" "\t only import service , " - "ignore the rest\n"); + "ignore the rest\n"); return -1; } @@ -139,14 +139,14 @@ static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm, valstr = talloc_asprintf(ctx, "%s", BOOLSTR(!*(bool *)ptr)); break; case P_ENUM: - for (i = 0; parm->enum_list[i].name; i++) { - if (*(int *)ptr == parm->enum_list[i].value) + for (i = 0; parm->enum_list[i].name; i++) { + if (*(int *)ptr == parm->enum_list[i].value) { valstr = talloc_asprintf(ctx, "%s", - parm->enum_list[i].name); - break; - } - } + parm->enum_list[i].name); + break; + } + } break; case P_OCTAL: { char *o = octal_string(*(int *)ptr); -- cgit From 2f195e52fa0eb656c40be4b0ba5b7de4acd18c05 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 21:35:29 +0100 Subject: Fix a DEBUG statement. Michael (This used to be commit 18360b852c662d933ceff9854725f878a5de9a7d) --- source3/registry/reg_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index eba220b76c..f50a41816c 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -286,7 +286,7 @@ bool regdb_init( void ) /* always setup the necessary keys and values */ if ( !init_registry_data() ) { - DEBUG(0,("init_registry: Failed to initialize data in registry!\n")); + DEBUG(0,("regdb_init: Failed to initialize data in registry!\n")); return false; } -- cgit From 9254bb4ef1c3c3a52ea8e935edb0e7a86ec3ea7a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 12:56:23 -0800 Subject: Refactor the crypto code after a very helpful conversation with Volker. Mostly making sure we have data on the incoming packet type, not stored in the smb header. Jeremy. (This used to be commit c4e5a505043965eec77b5bb9bc60957e8f3b97c8) --- source3/client/client.c | 10 ++- source3/include/smb.h | 4 + source3/include/smb_macros.h | 11 ++- source3/lib/dummysmbd.c | 21 ----- source3/lib/util_sock.c | 74 ------------------ source3/libsmb/smb_seal.c | 25 +++--- source3/libsmb/smb_signing.c | 8 +- source3/param/loadparm.c | 5 +- source3/printing/nt_printing.c | 2 +- source3/smbd/aio.c | 27 +++---- source3/smbd/blocking.c | 34 ++++---- source3/smbd/error.c | 4 +- source3/smbd/ipc.c | 53 +++++++------ source3/smbd/lanman.c | 2 +- source3/smbd/notify.c | 46 ++++++----- source3/smbd/nttrans.c | 39 ++++++---- source3/smbd/open.c | 4 +- source3/smbd/oplock.c | 26 +++---- source3/smbd/pipes.c | 3 +- source3/smbd/process.c | 173 +++++++++++++++++++++++++++-------------- source3/smbd/reply.c | 55 ++++++------- source3/smbd/seal.c | 44 +++++++---- source3/smbd/sesssetup.c | 2 +- source3/smbd/trans2.c | 69 +++++++++------- source3/utils/smbfilter.c | 28 ++++++- 25 files changed, 410 insertions(+), 359 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 2a86035cf0..fbcfa531ed 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4328,16 +4328,22 @@ static void readline_callback(void) timeout.tv_usec = 0; sys_select_intr(cli->fd+1,&fds,NULL,NULL,&timeout); - /* We deliberately use receive_smb instead of + /* We deliberately use receive_smb_raw instead of client_receive_smb as we want to receive session keepalives and then drop them here. */ if (FD_ISSET(cli->fd,&fds)) { - if (!receive_smb(cli->fd,cli->inbuf,0,&cli->smb_rw_error)) { + if (!receive_smb_raw(cli->fd,cli->inbuf,0,0,&cli->smb_rw_error)) { DEBUG(0, ("Read from server failed, maybe it closed the " "connection\n")); return; } + if(CVAL(cli->inbuf,0) != SMBkeepalive) { + DEBUG(0, ("Read from server " + "returned unexpected packet!\n")); + return; + } + goto again; } diff --git a/source3/include/smb.h b/source3/include/smb.h index 75fe31e041..49245eaa83 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -659,6 +659,7 @@ typedef struct connection_struct { int num_files_open; unsigned int num_smb_operations; /* Count of smb operations on this tree. */ int encrypt_level; + bool encrypted_tid; /* Semantics requested by the client or forced by the server config. */ bool case_sensitive; @@ -694,6 +695,8 @@ struct smb_request { const uint8 *inbuf; uint8 *outbuf; size_t unread_bytes; + bool encrypted; + connection_struct *conn; }; /* Defines for the sent_oplock_break field above. */ @@ -757,6 +760,7 @@ struct pending_message_list { struct pending_message_list *next, *prev; struct timeval request_time; /* When was this first issued? */ struct timeval end_time; /* When does this time out? */ + bool encrypted; DATA_BLOB buf; DATA_BLOB private_data; }; diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 9bacdce1db..3324f3fc02 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -158,10 +158,10 @@ #define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx))) #define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx))) -#define ERROR_DOS(class,code) error_packet(inbuf,outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__) -#define ERROR_NT(status) error_packet(inbuf,outbuf,0,0,status,__LINE__,__FILE__) -#define ERROR_FORCE_NT(status) error_packet(inbuf,outbuf,-1,-1,status,__LINE__,__FILE__) -#define ERROR_BOTH(status,class,code) error_packet(inbuf,outbuf,class,code,status,__LINE__,__FILE__) +#define ERROR_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__) +#define ERROR_NT(status) error_packet(outbuf,0,0,status,__LINE__,__FILE__) +#define ERROR_FORCE_NT(status) error_packet(outbuf,-1,-1,status,__LINE__,__FILE__) +#define ERROR_BOTH(status,class,code) error_packet(outbuf,class,code,status,__LINE__,__FILE__) #define reply_nterror(req,status) reply_nt_error(req,status,__LINE__,__FILE__) #define reply_force_nterror(req,status) reply_force_nt_error(req,status,__LINE__,__FILE__) @@ -192,6 +192,9 @@ #define _smb_setlen_large(buf,len) do { buf[0] = 0; buf[1] = ((len)&0xFF0000)>>16; \ buf[2] = ((len)&0xFF00)>>8; buf[3] = (len)&0xFF; } while (0) +#define ENCRYPTION_REQUIRED(conn) ((conn) ? ((conn)->encrypt_level == Required) : false) +#define IS_CONN_ENCRYPTED(conn) ((conn) ? (conn)->encrypted_tid : false) + /******************************************************************* find the difference in milliseconds between two struct timeval values diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c index 464ba92306..dbe886e3d1 100644 --- a/source3/lib/dummysmbd.c +++ b/source3/lib/dummysmbd.c @@ -51,24 +51,3 @@ NTSTATUS can_delete_directory(struct connection_struct *conn, { return NT_STATUS_OK; } - -NTSTATUS srv_decrypt_buffer(char *buf) -{ - return NT_STATUS_OK; -} - -NTSTATUS srv_encrypt_buffer(char *buffer, char **buf_out) -{ - *buf_out = buffer; - return NT_STATUS_OK; -} - -void srv_free_enc_buffer(char *buf) -{ - ; -} - -bool srv_encryption_on(void) -{ - return false; -} diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index b92cd3d624..945506ea77 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1276,80 +1276,6 @@ ssize_t receive_smb_raw(int fd, return len; } -/**************************************************************************** - Wrapper for receive_smb_raw(). - Checks the MAC on signed packets. -****************************************************************************/ - -bool receive_smb(int fd, char *buffer, unsigned int timeout, enum smb_read_errors *pre) -{ - if (receive_smb_raw(fd, buffer, timeout, 0, pre) < 0) { - return false; - } - - if (srv_encryption_on()) { - NTSTATUS status = srv_decrypt_buffer(buffer); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0, ("receive_smb: SMB decryption failed " - "on incoming packet! Error %s\n", - nt_errstr(status) )); - cond_set_smb_read_error(pre, SMB_READ_BAD_DECRYPT); - return false; - } - } - - /* Check the incoming SMB signature. */ - if (!srv_check_sign_mac(buffer, true)) { - DEBUG(0, ("receive_smb: SMB Signature verification " - "failed on incoming packet!\n")); - cond_set_smb_read_error(pre,SMB_READ_BAD_SIG); - return false; - } - - return true; -} - -/**************************************************************************** - Send an smb to a fd. -****************************************************************************/ - -bool send_smb(int fd, char *buffer) -{ - size_t len; - size_t nwritten=0; - ssize_t ret; - char *buf_out = buffer; - - /* Sign the outgoing packet if required. */ - srv_calculate_sign_mac(buf_out); - - if (srv_encryption_on()) { - NTSTATUS status = srv_encrypt_buffer(buffer, &buf_out); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0, ("send_smb: SMB encryption failed " - "on outgoing packet! Error %s\n", - nt_errstr(status) )); - return false; - } - } - - len = smb_len(buf_out) + 4; - - while (nwritten < len) { - ret = write_data(fd,buf_out+nwritten,len - nwritten); - if (ret <= 0) { - DEBUG(0,("Error writing %d bytes to client. %d. (%s)\n", - (int)len,(int)ret, strerror(errno) )); - srv_free_enc_buffer(buf_out); - return false; - } - nwritten += ret; - } - - srv_free_enc_buffer(buf_out); - return true; -} - /**************************************************************************** Open a socket of the specified type, port, and address for incoming data. ****************************************************************************/ diff --git a/source3/libsmb/smb_seal.c b/source3/libsmb/smb_seal.c index 055a27d05a..b5befbf7cd 100644 --- a/source3/libsmb/smb_seal.c +++ b/source3/libsmb/smb_seal.c @@ -23,13 +23,13 @@ Pull out the encryption context for this packet. 0 means global context. ******************************************************************************/ -NTSTATUS get_enc_ctx_num(const char *buf, uint16 *p_enc_ctx_num) +NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num) { if (smb_len(buf) < 8) { return NT_STATUS_INVALID_BUFFER_SIZE; } - if (buf[4] == (char)0xFF) { + if (buf[4] == 0xFF) { if (buf[5] == 'S' && buf [6] == 'M' && buf[7] == 'B') { /* Not an encrypted buffer. */ return NT_STATUS_NOT_FOUND; @@ -93,8 +93,8 @@ NTSTATUS common_ntlm_decrypt_buffer(NTLMSSP_STATE *ntlmssp_state, char *buf) memcpy(buf + 8, inbuf + 8 + NTLMSSP_SIG_SIZE, data_len); - /* Reset the length. */ - _smb_setlen(buf,data_len + 4); + /* Reset the length and overwrite the header. */ + smb_setlen(buf,data_len + 4); SAFE_FREE(inbuf); return NT_STATUS_OK; @@ -203,7 +203,8 @@ static NTSTATUS common_gss_decrypt_buffer(struct smb_tran_enc_state_gss *gss_sta } memcpy(buf + 8, out_buf.value, out_buf.length); - _smb_setlen(buf, out_buf.length + 4); + /* Reset the length and overwrite the header. */ + smb_setlen(buf, out_buf.length + 4); gss_release_buffer(&minor, &out_buf); return NT_STATUS_OK; @@ -440,9 +441,9 @@ void cli_free_enc_buffer(struct cli_state *cli, char *buf) { /* We know this is an smb buffer, and we * didn't malloc, only copy, for a keepalive, - * so ignore session keepalives. */ + * so ignore non-session messages. */ - if(CVAL(buf,0) == SMBkeepalive) { + if(CVAL(buf,0)) { return; } @@ -461,12 +462,12 @@ NTSTATUS cli_decrypt_message(struct cli_state *cli) NTSTATUS status; uint16 enc_ctx_num; - /* Ignore session keepalives. */ - if(CVAL(cli->inbuf,0) == SMBkeepalive) { + /* Ignore non-session messages. */ + if(CVAL(cli->inbuf,0)) { return NT_STATUS_OK; } - status = get_enc_ctx_num(cli->inbuf, &enc_ctx_num); + status = get_enc_ctx_num((const uint8_t *)cli->inbuf, &enc_ctx_num); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -484,8 +485,8 @@ NTSTATUS cli_decrypt_message(struct cli_state *cli) NTSTATUS cli_encrypt_message(struct cli_state *cli, char **buf_out) { - /* Ignore session keepalives. */ - if(CVAL(cli->outbuf,0) == SMBkeepalive) { + /* Ignore non-session messages. */ + if(CVAL(cli->outbuf,0)) { return NT_STATUS_OK; } diff --git a/source3/libsmb/smb_signing.c b/source3/libsmb/smb_signing.c index d5cbe3b125..f03c21bd0e 100644 --- a/source3/libsmb/smb_signing.c +++ b/source3/libsmb/smb_signing.c @@ -745,8 +745,8 @@ bool srv_oplock_set_signing(bool onoff) bool srv_check_sign_mac(const char *inbuf, bool must_be_ok) { - /* Check if it's a session keepalive. */ - if(CVAL(inbuf,0) == SMBkeepalive) { + /* Check if it's a non-session message. */ + if(CVAL(inbuf,0)) { return True; } @@ -759,8 +759,8 @@ bool srv_check_sign_mac(const char *inbuf, bool must_be_ok) void srv_calculate_sign_mac(char *outbuf) { - /* Check if it's a session keepalive. */ - if(CVAL(outbuf,0) == SMBkeepalive) { + /* Check if it's a non-session message. */ + if(CVAL(outbuf,0)) { return; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 16e9372009..29166cf02e 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -6213,7 +6213,7 @@ uint32 lp_get_spoolss_state( void ) } /******************************************************************* - Ensure we don't use sendfile if server smb signing or selaing is active. + Ensure we don't use sendfile if server smb signing is active. ********************************************************************/ bool lp_use_sendfile(int snum) @@ -6224,8 +6224,7 @@ bool lp_use_sendfile(int snum) } return (_lp_use_sendfile(snum) && (get_remote_arch() != RA_WIN95) && - !srv_is_signing_active() && - !srv_encryption_on()); + !srv_is_signing_active()); } /******************************************************************* diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index f115fba91f..bae32e89f7 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1867,7 +1867,7 @@ WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract goto err_exit; } - create_directory(conn, new_dir); + create_directory(conn, NULL, new_dir); /* For each driver file, archi\filexxx.yyy, if there is a duplicate file * listed for this driver which has already been moved, skip it (note: diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index a439c3a4f0..bc1761b0fd 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -236,7 +236,7 @@ bool schedule_aio_read_and_X(connection_struct *conn, } construct_reply_common((char *)req->inbuf, aio_ex->outbuf); - srv_set_message((const char *)req->inbuf, aio_ex->outbuf, 12, 0, True); + srv_set_message(aio_ex->outbuf, 12, 0, True); SCVAL(aio_ex->outbuf,smb_vwv0,0xFF); /* Never a chained reply. */ a = &aio_ex->acb; @@ -356,8 +356,9 @@ bool schedule_aio_write_and_X(connection_struct *conn, SSVAL(aio_ex->outbuf,smb_vwv2,numtowrite); SSVAL(aio_ex->outbuf,smb_vwv4,(numtowrite>>16)&1); show_msg(aio_ex->outbuf); - if (!send_smb(smbd_server_fd(),aio_ex->outbuf)) { - exit_server_cleanly("handle_aio_write: send_smb " + if (!srv_send_smb(smbd_server_fd(),aio_ex->outbuf, + IS_CONN_ENCRYPTED(fsp->conn))) { + exit_server_cleanly("handle_aio_write: srv_send_smb " "failed."); } DEBUG(10,("schedule_aio_write_and_X: scheduled aio_write " @@ -387,7 +388,6 @@ static int handle_aio_read_complete(struct aio_extra *aio_ex) int ret = 0; int outsize; char *outbuf = aio_ex->outbuf; - const char *inbuf = aio_ex->inbuf; char *data = smb_buf(outbuf); ssize_t nread = SMB_VFS_AIO_RETURN(aio_ex->fsp,&aio_ex->acb); @@ -410,9 +410,9 @@ static int handle_aio_read_complete(struct aio_extra *aio_ex) ret = errno; ERROR_NT(map_nt_error_from_unix(ret)); - outsize = srv_set_message(inbuf,outbuf,0,0,true); + outsize = srv_set_message(outbuf,0,0,true); } else { - outsize = srv_set_message(inbuf, outbuf,12,nread,False); + outsize = srv_set_message(outbuf,12,nread,False); SSVAL(outbuf,smb_vwv2,0xFFFF); /* Remaining - must be * -1. */ SSVAL(outbuf,smb_vwv5,nread); SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf)); @@ -425,10 +425,11 @@ static int handle_aio_read_complete(struct aio_extra *aio_ex) (int)aio_ex->acb.aio_nbytes, (int)nread ) ); } - _smb_setlen(outbuf,outsize - 4); + smb_setlen(outbuf,outsize - 4); show_msg(outbuf); - if (!send_smb(smbd_server_fd(),outbuf)) { - exit_server_cleanly("handle_aio_read_complete: send_smb " + if (!srv_send_smb(smbd_server_fd(),outbuf, + IS_CONN_ENCRYPTED(aio_ex->fsp->conn))) { + exit_server_cleanly("handle_aio_read_complete: srv_send_smb " "failed."); } @@ -497,7 +498,7 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex) ret = errno; ERROR_BOTH(map_nt_error_from_unix(ret), ERRHRD, ERRdiskfull); - srv_set_message(inbuf,outbuf,0,0,true); + srv_set_message(outbuf,0,0,true); } else { bool write_through = BITSETW(aio_ex->inbuf+smb_vwv7,0); NTSTATUS status; @@ -516,15 +517,15 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex) ret = errno; ERROR_BOTH(map_nt_error_from_unix(ret), ERRHRD, ERRdiskfull); - srv_set_message(inbuf,outbuf,0,0,true); + srv_set_message(outbuf,0,0,true); DEBUG(5,("handle_aio_write: sync_file for %s returned %s\n", fsp->fsp_name, nt_errstr(status) )); } } show_msg(outbuf); - if (!send_smb(smbd_server_fd(),outbuf)) { - exit_server_cleanly("handle_aio_write: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(),outbuf,IS_CONN_ENCRYPTED(fsp->conn))) { + exit_server_cleanly("handle_aio_write: srv_send_smb failed."); } DEBUG(10,("handle_aio_write_complete: scheduled aio_write completed " diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 0078bb7d13..c56f635dde 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -41,6 +41,7 @@ typedef struct _blocking_lock_record { enum brl_type lock_type; char *inbuf; int length; + bool encrypted; } blocking_lock_record; /* dlink list we store pending lock records on. */ @@ -149,7 +150,7 @@ static bool recalc_brl_timeout(void) ****************************************************************************/ bool push_blocking_lock_request( struct byte_range_lock *br_lck, - const char *inbuf, int length, + const struct smb_request *req, files_struct *fsp, int lock_timeout, int lock_num, @@ -161,6 +162,7 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck, uint32 blocking_pid) { static bool set_lock_msg; + size_t length = smb_len(req->inbuf)+4; blocking_lock_record *blr; NTSTATUS status; @@ -188,7 +190,7 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck, return False; } - blr->com_type = CVAL(inbuf,smb_com); + blr->com_type = CVAL(req->inbuf,smb_com); blr->fsp = fsp; if (lock_timeout == -1) { blr->expire_time.tv_sec = 0; @@ -204,8 +206,9 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck, blr->lock_type = lock_type; blr->offset = offset; blr->count = count; - memcpy(blr->inbuf, inbuf, length); + memcpy(blr->inbuf, req->inbuf, length); blr->length = length; + blr->encrypted = req->encrypted; /* Add a pending lock record for this. */ status = brl_lock(smbd_messaging_context(), br_lck, @@ -242,7 +245,7 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck, blr->fsp->fnum, blr->fsp->fsp_name )); /* Push the MID of this packet on the signing queue. */ - srv_defer_sign_response(SVAL(inbuf,smb_mid)); + srv_defer_sign_response(SVAL(req->inbuf,smb_mid)); return True; } @@ -259,7 +262,7 @@ static void reply_lockingX_success(blocking_lock_record *blr) smb_panic("Could not allocate smb_request"); } - init_smb_request(req, (uint8 *)blr->inbuf, 0); + init_smb_request(req, (uint8 *)blr->inbuf, 0, blr->encrypted); reply_outbuf(req, 2, 0); /* @@ -272,8 +275,10 @@ static void reply_lockingX_success(blocking_lock_record *blr) chain_reply(req); - if (!send_smb(smbd_server_fd(),(char *)req->outbuf)) { - exit_server_cleanly("send_blocking_reply: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + (char *)req->outbuf, + IS_CONN_ENCRYPTED(blr->fsp->conn))) { + exit_server_cleanly("send_blocking_reply: srv_send_smb failed."); } } @@ -309,8 +314,9 @@ static void generic_blocking_lock_error(blocking_lock_record *blr, NTSTATUS stat } ERROR_NT(status); - if (!send_smb(smbd_server_fd(),outbuf)) { - exit_server_cleanly("generic_blocking_lock_error: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(),outbuf, + IS_CONN_ENCRYPTED(blr->fsp->conn))) { + exit_server_cleanly("generic_blocking_lock_error: srv_send_smb failed."); } } @@ -388,8 +394,10 @@ static void blocking_lock_reply_error(blocking_lock_record *blr, NTSTATUS status */ SCVAL(outbuf,smb_com,SMBtrans2); ERROR_NT(status); - if (!send_smb(smbd_server_fd(),outbuf)) { - exit_server_cleanly("blocking_lock_reply_error: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + outbuf, + IS_CONN_ENCRYPTED(blr->fsp->conn))) { + exit_server_cleanly("blocking_lock_reply_error: srv_send_smb failed."); } break; } @@ -531,12 +539,12 @@ static bool process_trans2(blocking_lock_record *blr) return True; } - init_smb_request(req, (uint8 *)blr->inbuf, 0); + init_smb_request(req, (uint8 *)blr->inbuf, 0, blr->encrypted); SCVAL(req->inbuf, smb_com, SMBtrans2); SSVAL(params,0,0); /* Fake up max_data_bytes here - we know it fits. */ - send_trans2_replies(req, params, 2, NULL, 0, 0xffff); + send_trans2_replies(blr->fsp->conn, req, params, 2, NULL, 0, 0xffff); return True; } diff --git a/source3/smbd/error.c b/source3/smbd/error.c index c669e74146..de2de088ec 100644 --- a/source3/smbd/error.c +++ b/source3/smbd/error.c @@ -81,9 +81,9 @@ void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatu } } -int error_packet(const char *inbuf, char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file) +int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file) { - int outsize = srv_set_message(inbuf, outbuf,0,0,True); + int outsize = srv_set_message(outbuf,0,0,True); error_packet_set(outbuf, eclass, ecode, ntstatus, line, file); return outsize; } diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index f28016ccb3..a89f5cbbfe 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -30,7 +30,7 @@ extern int max_send; #define NERR_notsupported 50 -static void api_no_reply(struct smb_request *req); +static void api_no_reply(connection_struct *conn, struct smb_request *req); /******************************************************************* copies parameters and data, as needed, into the smb buffer @@ -81,7 +81,8 @@ static void copy_trans_params_and_data(char *outbuf, int align, Send a trans reply. ****************************************************************************/ -void send_trans_reply(struct smb_request *req, +void send_trans_reply(connection_struct *conn, + struct smb_request *req, char *rparam, int rparam_len, char *rdata, int rdata_len, bool buffer_too_large) @@ -129,8 +130,10 @@ void send_trans_reply(struct smb_request *req, } show_msg((char *)req->outbuf); - if (!send_smb(smbd_server_fd(),(char *)req->outbuf)) - exit_server_cleanly("send_trans_reply: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + (char *)req->outbuf, + IS_CONN_ENCRYPTED(conn))) + exit_server_cleanly("send_trans_reply: srv_send_smb failed."); TALLOC_FREE(req->outbuf); @@ -175,8 +178,10 @@ void send_trans_reply(struct smb_request *req, } show_msg((char *)req->outbuf); - if (!send_smb(smbd_server_fd(), (char *)req->outbuf)) - exit_server_cleanly("send_trans_reply: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + (char *)req->outbuf, + IS_CONN_ENCRYPTED(conn))) + exit_server_cleanly("send_trans_reply: srv_send_smb failed."); tot_data_sent += this_ldata; tot_param_sent += this_lparam; @@ -188,7 +193,7 @@ void send_trans_reply(struct smb_request *req, Start the first part of an RPC reply which began with an SMBtrans request. ****************************************************************************/ -static void api_rpc_trans_reply(struct smb_request *req, smb_np_struct *p) +static void api_rpc_trans_reply(connection_struct *conn, struct smb_request *req, smb_np_struct *p) { bool is_data_outstanding; char *rdata = (char *)SMB_MALLOC(p->max_trans_reply); @@ -203,11 +208,11 @@ static void api_rpc_trans_reply(struct smb_request *req, smb_np_struct *p) if((data_len = read_from_pipe( p, rdata, p->max_trans_reply, &is_data_outstanding)) < 0) { SAFE_FREE(rdata); - api_no_reply(req); + api_no_reply(conn,req); return; } - send_trans_reply(req, NULL, 0, rdata, data_len, is_data_outstanding); + send_trans_reply(conn, req, NULL, 0, rdata, data_len, is_data_outstanding); SAFE_FREE(rdata); return; } @@ -216,7 +221,7 @@ static void api_rpc_trans_reply(struct smb_request *req, smb_np_struct *p) WaitNamedPipeHandleState ****************************************************************************/ -static void api_WNPHS(struct smb_request *req, smb_np_struct *p, +static void api_WNPHS(connection_struct *conn, struct smb_request *req, smb_np_struct *p, char *param, int param_len) { uint16 priority; @@ -231,10 +236,10 @@ static void api_WNPHS(struct smb_request *req, smb_np_struct *p, if (wait_rpc_pipe_hnd_state(p, priority)) { /* now send the reply */ - send_trans_reply(req, NULL, 0, NULL, 0, False); + send_trans_reply(conn, req, NULL, 0, NULL, 0, False); return; } - api_no_reply(req); + api_no_reply(conn,req); } @@ -242,7 +247,7 @@ static void api_WNPHS(struct smb_request *req, smb_np_struct *p, SetNamedPipeHandleState ****************************************************************************/ -static void api_SNPHS(struct smb_request *req, smb_np_struct *p, +static void api_SNPHS(connection_struct *conn, struct smb_request *req, smb_np_struct *p, char *param, int param_len) { uint16 id; @@ -257,10 +262,10 @@ static void api_SNPHS(struct smb_request *req, smb_np_struct *p, if (set_rpc_pipe_hnd_state(p, id)) { /* now send the reply */ - send_trans_reply(req, NULL, 0, NULL, 0, False); + send_trans_reply(conn, req, NULL, 0, NULL, 0, False); return; } - api_no_reply(req); + api_no_reply(conn,req); } @@ -268,7 +273,7 @@ static void api_SNPHS(struct smb_request *req, smb_np_struct *p, When no reply is generated, indicate unsupported. ****************************************************************************/ -static void api_no_reply(struct smb_request *req) +static void api_no_reply(connection_struct *conn, struct smb_request *req) { char rparam[4]; @@ -279,7 +284,7 @@ static void api_no_reply(struct smb_request *req) DEBUG(3,("Unsupported API fd command\n")); /* now send the reply */ - send_trans_reply(req, rparam, 4, NULL, 0, False); + send_trans_reply(conn, req, rparam, 4, NULL, 0, False); return; } @@ -321,7 +326,7 @@ static void api_fd_reply(connection_struct *conn, uint16 vuid, /* Win9x does this call with a unicode pipe name, not a pnum. */ /* Just return success for now... */ DEBUG(3,("Got TRANSACT_WAITNAMEDPIPEHANDLESTATE on text pipe name\n")); - send_trans_reply(req, NULL, 0, NULL, 0, False); + send_trans_reply(conn, req, NULL, 0, NULL, 0, False); return; } @@ -349,18 +354,18 @@ static void api_fd_reply(connection_struct *conn, uint16 vuid, /* dce/rpc command */ reply = write_to_pipe(p, data, tdscnt); if (!reply) { - api_no_reply(req); + api_no_reply(conn, req); return; } - api_rpc_trans_reply(req, p); + api_rpc_trans_reply(conn, req, p); break; case TRANSACT_WAITNAMEDPIPEHANDLESTATE: /* Wait Named Pipe Handle state */ - api_WNPHS(req, p, params, tpscnt); + api_WNPHS(conn, req, p, params, tpscnt); break; case TRANSACT_SETNAMEDPIPEHANDLESTATE: /* Set Named Pipe Handle state */ - api_SNPHS(req, p, params, tpscnt); + api_SNPHS(conn, req, p, params, tpscnt); break; default: reply_nterror(req, NT_STATUS_INVALID_PARAMETER); @@ -472,8 +477,10 @@ static void handle_trans(connection_struct *conn, struct smb_request *req, state->max_data_return, state->max_param_return); - if (state->close_on_completion) + if (state->close_on_completion) { close_cnum(conn,state->vuid); + req->conn = NULL; + } return; } diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 3ab216c062..5a6df1f139 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -4605,7 +4605,7 @@ void api_reply(connection_struct *conn, uint16 vuid, /* If api_Unsupported returns false we can't return anything. */ if (reply) { - send_trans_reply(req, rparam, rparam_len, + send_trans_reply(conn, req, rparam, rparam_len, rdata, rdata_len, False); } diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index baab48f77e..7287210802 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -128,10 +128,10 @@ static bool notify_marshall_changes(int num_changes, Setup the common parts of the return packet and send it. *****************************************************************************/ -static void change_notify_reply_packet(const uint8 *request_buf, +static void change_notify_reply_packet(connection_struct *conn, + const uint8 *request_buf, NTSTATUS error_code) { - const char *inbuf = (const char *)request_buf; char outbuf[smb_size+38]; memset(outbuf, '\0', sizeof(outbuf)); @@ -143,15 +143,18 @@ static void change_notify_reply_packet(const uint8 *request_buf, * Seems NT needs a transact command with an error code * in it. This is a longer packet than a simple error. */ - srv_set_message((const char *)request_buf, outbuf,18,0,False); + srv_set_message(outbuf,18,0,False); show_msg(outbuf); - if (!send_smb(smbd_server_fd(),outbuf)) - exit_server_cleanly("change_notify_reply_packet: send_smb " + if (!srv_send_smb(smbd_server_fd(), + outbuf, + IS_CONN_ENCRYPTED(conn))) + exit_server_cleanly("change_notify_reply_packet: srv_send_smb " "failed."); } -void change_notify_reply(const uint8 *request_buf, uint32 max_param, +void change_notify_reply(connection_struct *conn, + const uint8 *request_buf, uint32 max_param, struct notify_change_buf *notify_buf) { prs_struct ps; @@ -159,7 +162,7 @@ void change_notify_reply(const uint8 *request_buf, uint32 max_param, uint8 tmp_request[smb_size]; if (notify_buf->num_changes == -1) { - change_notify_reply_packet(request_buf, NT_STATUS_OK); + change_notify_reply_packet(conn, request_buf, NT_STATUS_OK); notify_buf->num_changes = 0; return; } @@ -172,12 +175,12 @@ void change_notify_reply(const uint8 *request_buf, uint32 max_param, * We exceed what the client is willing to accept. Send * nothing. */ - change_notify_reply_packet(request_buf, NT_STATUS_OK); + change_notify_reply_packet(conn, request_buf, NT_STATUS_OK); goto done; } if (!(req = talloc(talloc_tos(), struct smb_request))) { - change_notify_reply_packet(request_buf, NT_STATUS_NO_MEMORY); + change_notify_reply_packet(conn, request_buf, NT_STATUS_NO_MEMORY); goto done; } @@ -190,9 +193,9 @@ void change_notify_reply(const uint8 *request_buf, uint32 max_param, smb_setlen((char *)tmp_request, smb_size); SCVAL(tmp_request, smb_wct, 0); - init_smb_request(req, tmp_request,0); + init_smb_request(req, tmp_request,0, conn->encrypted_tid); - send_nt_replies(req, NT_STATUS_OK, prs_data_p(&ps), + send_nt_replies(conn, req, NT_STATUS_OK, prs_data_p(&ps), prs_offset(&ps), NULL, 0); done: @@ -243,9 +246,10 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter, return status; } -NTSTATUS change_notify_add_request(const uint8 *inbuf, uint32 max_param, - uint32 filter, bool recursive, - struct files_struct *fsp) +NTSTATUS change_notify_add_request(const struct smb_request *req, + uint32 max_param, + uint32 filter, bool recursive, + struct files_struct *fsp) { struct notify_change_request *request = NULL; struct notify_mid_map *map = NULL; @@ -259,7 +263,7 @@ NTSTATUS change_notify_add_request(const uint8 *inbuf, uint32 max_param, request->mid_map = map; map->req = request; - memcpy(request->request_buf, inbuf, sizeof(request->request_buf)); + memcpy(request->request_buf, req->inbuf, sizeof(request->request_buf)); request->max_param = max_param; request->filter = filter; request->fsp = fsp; @@ -268,11 +272,11 @@ NTSTATUS change_notify_add_request(const uint8 *inbuf, uint32 max_param, DLIST_ADD_END(fsp->notify->requests, request, struct notify_change_request *); - map->mid = SVAL(inbuf, smb_mid); + map->mid = SVAL(req->inbuf, smb_mid); DLIST_ADD(notify_changes_by_mid, map); /* Push the MID of this packet on the signing queue. */ - srv_defer_sign_response(SVAL(inbuf,smb_mid)); + srv_defer_sign_response(SVAL(req->inbuf,smb_mid)); return NT_STATUS_OK; } @@ -325,7 +329,8 @@ void remove_pending_change_notify_requests_by_mid(uint16 mid) return; } - change_notify_reply_packet(map->req->request_buf, NT_STATUS_CANCELLED); + change_notify_reply_packet(map->req->fsp->conn, + map->req->request_buf, NT_STATUS_CANCELLED); change_notify_remove_request(map->req); } @@ -341,7 +346,7 @@ void remove_pending_change_notify_requests_by_fid(files_struct *fsp, } while (fsp->notify->requests != NULL) { - change_notify_reply_packet( + change_notify_reply_packet(fsp->conn, fsp->notify->requests->request_buf, status); change_notify_remove_request(fsp->notify->requests); } @@ -435,7 +440,8 @@ static void notify_fsp(files_struct *fsp, uint32 action, const char *name) * TODO: do we have to walk the lists of requests pending? */ - change_notify_reply(fsp->notify->requests->request_buf, + change_notify_reply(fsp->conn, + fsp->notify->requests->request_buf, fsp->notify->requests->max_param, fsp->notify); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 69772b6bec..8ac0217dcd 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -66,7 +66,8 @@ static char *nttrans_realloc(char **ptr, size_t size) HACK ! Always assumes smb_setup field is zero. ****************************************************************************/ -void send_nt_replies(struct smb_request *req, NTSTATUS nt_error, +void send_nt_replies(connection_struct *conn, + struct smb_request *req, NTSTATUS nt_error, char *params, int paramsize, char *pdata, int datasize) { @@ -242,8 +243,10 @@ void send_nt_replies(struct smb_request *req, NTSTATUS nt_error, /* Send the packet */ show_msg((char *)req->outbuf); - if (!send_smb(smbd_server_fd(),(char *)req->outbuf)) { - exit_server_cleanly("send_nt_replies: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + (char *)req->outbuf, + IS_CONN_ENCRYPTED(conn))) { + exit_server_cleanly("send_nt_replies: srv_send_smb failed."); } TALLOC_FREE(req->outbuf); @@ -726,7 +729,7 @@ static void do_nt_transact_create_pipe(connection_struct *conn, DEBUG(5,("do_nt_transact_create_pipe: open name = %s\n", fname)); /* Send the required number of replies */ - send_nt_replies(req, NT_STATUS_OK, params, param_len, *ppdata, 0); + send_nt_replies(conn, req, NT_STATUS_OK, params, param_len, *ppdata, 0); return; } @@ -1080,7 +1083,7 @@ static void call_nt_transact_create(connection_struct *conn, DEBUG(5,("call_nt_transact_create: open name = %s\n", fname)); /* Send the required number of replies */ - send_nt_replies(req, NT_STATUS_OK, params, param_len, *ppdata, 0); + send_nt_replies(conn, req, NT_STATUS_OK, params, param_len, *ppdata, 0); return; } @@ -1474,7 +1477,7 @@ static void call_nt_transact_notify_change(connection_struct *conn, * here. */ - change_notify_reply(req->inbuf, max_param_count, fsp->notify); + change_notify_reply(fsp->conn, req->inbuf, max_param_count, fsp->notify); /* * change_notify_reply() above has independently sent its @@ -1487,7 +1490,9 @@ static void call_nt_transact_notify_change(connection_struct *conn, * No changes pending, queue the request */ - status = change_notify_add_request(req->inbuf, max_param_count, filter, + status = change_notify_add_request(req, + max_param_count, + filter, recursive, fsp); if (!NT_STATUS_IS_OK(status)) { reply_nterror(req, status); @@ -1554,7 +1559,7 @@ static void call_nt_transact_rename(connection_struct *conn, /* * Rename was successful. */ - send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0); + send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, NULL, 0); DEBUG(3,("nt transact rename from = %s, to = %s succeeded.\n", fsp->fsp_name, new_name)); @@ -1657,7 +1662,7 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, SIVAL(params,0,(uint32)sd_size); if (max_data_count < sd_size) { - send_nt_replies(req, NT_STATUS_BUFFER_TOO_SMALL, + send_nt_replies(conn, req, NT_STATUS_BUFFER_TOO_SMALL, params, 4, *ppdata, 0); TALLOC_FREE(frame); return; @@ -1686,7 +1691,7 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, SMB_ASSERT(sd_size == blob.length); memcpy(data, blob.data, sd_size); - send_nt_replies(req, NT_STATUS_OK, params, 4, data, (int)sd_size); + send_nt_replies(conn, req, NT_STATUS_OK, params, 4, data, (int)sd_size); TALLOC_FREE(frame); return; @@ -1744,7 +1749,7 @@ static void call_nt_transact_set_security_desc(connection_struct *conn, } done: - send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0); + send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, NULL, 0); return; } @@ -1793,7 +1798,7 @@ static void call_nt_transact_ioctl(connection_struct *conn, so we can know if we need to pre-allocate or not */ DEBUG(10,("FSCTL_SET_SPARSE: called on FID[0x%04X](but not implemented)\n", fidnum)); - send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0); + send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, NULL, 0); return; case FSCTL_CREATE_OR_GET_OBJECT_ID: @@ -1819,7 +1824,7 @@ static void call_nt_transact_ioctl(connection_struct *conn, push_file_id_16(pdata, &fsp->file_id); memcpy(pdata+16,create_volume_objectid(conn,objid),16); push_file_id_16(pdata+32, &fsp->file_id); - send_nt_replies(req, NT_STATUS_OK, NULL, 0, + send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, pdata, data_count); return; } @@ -1964,7 +1969,7 @@ static void call_nt_transact_ioctl(connection_struct *conn, talloc_destroy(shadow_data->mem_ctx); - send_nt_replies(req, NT_STATUS_OK, NULL, 0, + send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, pdata, data_count); return; @@ -2020,7 +2025,7 @@ static void call_nt_transact_ioctl(connection_struct *conn, */ /* this works for now... */ - send_nt_replies(req, NT_STATUS_OK, NULL, 0, NULL, 0); + send_nt_replies(conn, req, NT_STATUS_OK, NULL, 0, NULL, 0); return; } default: @@ -2306,7 +2311,7 @@ static void call_nt_transact_get_user_quota(connection_struct *conn, break; } - send_nt_replies(req, nt_status, params, param_len, + send_nt_replies(conn, req, nt_status, params, param_len, pdata, data_len); } @@ -2436,7 +2441,7 @@ static void call_nt_transact_set_user_quota(connection_struct *conn, return; } - send_nt_replies(req, NT_STATUS_OK, params, param_len, + send_nt_replies(conn, req, NT_STATUS_OK, params, param_len, pdata, data_len); } #endif /* HAVE_SYS_QUOTAS */ diff --git a/source3/smbd/open.c b/source3/smbd/open.c index b6e6adde8a..e3fae02b83 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2267,7 +2267,7 @@ NTSTATUS open_directory(connection_struct *conn, return NT_STATUS_OK; } -NTSTATUS create_directory(connection_struct *conn, const char *directory) +NTSTATUS create_directory(connection_struct *conn, struct smb_request *req, const char *directory) { NTSTATUS status; SMB_STRUCT_STAT sbuf; @@ -2275,7 +2275,7 @@ NTSTATUS create_directory(connection_struct *conn, const char *directory) SET_STAT_INVALID(sbuf); - status = open_directory(conn, NULL, directory, &sbuf, + status = open_directory(conn, req, directory, &sbuf, FILE_READ_ATTRIBUTES, /* Just a stat open */ FILE_SHARE_NONE, /* Ignored for stat opens */ FILE_CREATE, diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 8a5b1f4ecd..277e07c178 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -252,13 +252,7 @@ static char *new_break_smb_message(TALLOC_CTX *mem_ctx, } memset(result,'\0',smb_size); - if (!srv_encryption_on()) { - cli_set_message(result,8,0,true); - } else { - char inbuf[8]; - smb_set_enclen(inbuf,4,srv_enc_ctx()); - srv_set_message(inbuf,result,8,0,true); - } + srv_set_message(result,8,0,true); SCVAL(result,smb_com,SMBlockingX); SSVAL(result,smb_tid,fsp->conn->cnum); SSVAL(result,smb_pid,0xFFFF); @@ -455,8 +449,10 @@ static void process_oplock_async_level2_break_message(struct messaging_context * sign_state = srv_oplock_set_signing(False); show_msg(break_msg); - if (!send_smb(smbd_server_fd(), break_msg)) { - exit_server_cleanly("oplock_break: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + break_msg, + IS_CONN_ENCRYPTED(fsp->conn))) { + exit_server_cleanly("oplock_break: srv_send_smb failed."); } /* Restore the sign state to what it was. */ @@ -560,8 +556,10 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx, sign_state = srv_oplock_set_signing(False); show_msg(break_msg); - if (!send_smb(smbd_server_fd(), break_msg)) { - exit_server_cleanly("oplock_break: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + break_msg, + IS_CONN_ENCRYPTED(fsp->conn))) { + exit_server_cleanly("oplock_break: srv_send_smb failed."); } /* Restore the sign state to what it was. */ @@ -637,8 +635,10 @@ static void process_kernel_oplock_break(struct messaging_context *msg_ctx, sign_state = srv_oplock_set_signing(False); show_msg(break_msg); - if (!send_smb(smbd_server_fd(), break_msg)) { - exit_server_cleanly("oplock_break: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + break_msg, + IS_CONN_ENCRYPTED(fsp->conn))) { + exit_server_cleanly("oplock_break: srv_send_smb failed."); } /* Restore the sign state to what it was. */ diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 88b67c03e5..6b4b83d97d 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -291,8 +291,7 @@ void reply_pipe_read_and_X(struct smb_request *req) return; } - srv_set_message((const char *)req->inbuf, - (char *)req->outbuf, 12, nread, False); + srv_set_message((char *)req->outbuf, 12, nread, False); SSVAL(req->outbuf,smb_vwv5,nread); SSVAL(req->outbuf,smb_vwv6,smb_offset(data,req->outbuf)); diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 48a6d18bc9..32d1d058e3 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -50,14 +50,52 @@ enum smb_read_errors *get_srv_read_error(void) return &smb_read_error; } +/**************************************************************************** + Send an smb to a fd. +****************************************************************************/ + +bool srv_send_smb(int fd, char *buffer, bool do_encrypt) +{ + size_t len; + size_t nwritten=0; + ssize_t ret; + char *buf_out = buffer; + + /* Sign the outgoing packet if required. */ + srv_calculate_sign_mac(buf_out); + + if (do_encrypt) { + NTSTATUS status = srv_encrypt_buffer(buffer, &buf_out); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("send_smb: SMB encryption failed " + "on outgoing packet! Error %s\n", + nt_errstr(status) )); + return false; + } + } + + len = smb_len(buf_out) + 4; + + while (nwritten < len) { + ret = write_data(fd,buf_out+nwritten,len - nwritten); + if (ret <= 0) { + DEBUG(0,("Error writing %d bytes to client. %d. (%s)\n", + (int)len,(int)ret, strerror(errno) )); + srv_free_enc_buffer(buf_out); + return false; + } + nwritten += ret; + } + + srv_free_enc_buffer(buf_out); + return true; +} + /******************************************************************* Setup the word count and byte count for a smb message. - copying the '0xFF X X X' bytes from incoming - buffer (so we copy any encryption context). ********************************************************************/ -int srv_set_message(const char *frombuf, - char *buf, +int srv_set_message(char *buf, int num_words, int num_bytes, bool zero) @@ -67,22 +105,14 @@ int srv_set_message(const char *frombuf, } SCVAL(buf,smb_wct,num_words); SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); - _smb_setlen(buf,(smb_size + num_words*2 + num_bytes - 4)); - if (buf != frombuf) { - memcpy(buf+4, frombuf+4, 4); - } + smb_setlen(buf,(smb_size + num_words*2 + num_bytes - 4)); return (smb_size + num_words*2 + num_bytes); } -static bool valid_smb_header(const char *inbuf) +static bool valid_smb_header(const uint8_t *inbuf) { - if (srv_encryption_on()) { - uint16_t enc_num; - NTSTATUS status = get_enc_ctx_num(inbuf, &enc_num); - if (!NT_STATUS_IS_OK(status)) { - return false; - } - return (enc_num == 0); + if (is_encrypted_packet(inbuf)) { + return true; } return (strncmp(smb_base(inbuf),"\377SMB",4) == 0); } @@ -162,7 +192,7 @@ static ssize_t read_packet_remainder(int fd, (2*14) + /* word count (including bcc) */ \ 1 /* pad byte */) -ssize_t receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx, +static ssize_t receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx, const char lenbuf[4], int fd, char **buffer, @@ -202,7 +232,7 @@ ssize_t receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx, * valid writeX call. */ - if (is_valid_writeX_buffer(writeX_header)) { + if (is_valid_writeX_buffer((uint8_t *)writeX_header)) { /* * If the data offset is beyond what * we've read, drain the extra bytes. @@ -310,7 +340,7 @@ static ssize_t receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, return -1; } - if (CVAL(lenbuf,0) != SMBkeepalive && + if (CVAL(lenbuf,0) == 0 && min_recv_size && smb_len_large(lenbuf) > min_recv_size && /* Could be a UNIX large writeX. */ !srv_is_signing_active()) { @@ -350,18 +380,24 @@ static ssize_t receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, return len + 4; } -ssize_t receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd, char **buffer, - unsigned int timeout, size_t *p_unread) +static ssize_t receive_smb_talloc(TALLOC_CTX *mem_ctx, + int fd, + char **buffer, + unsigned int timeout, + size_t *p_unread, + bool *p_encrypted) { ssize_t len; + *p_encrypted = false; + len = receive_smb_raw_talloc(mem_ctx, fd, buffer, timeout, p_unread); if (len < 0) { return -1; } - if (srv_encryption_on()) { + if (is_encrypted_packet((uint8_t *)*buffer)) { NTSTATUS status = srv_decrypt_buffer(*buffer); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("receive_smb_talloc: SMB decryption failed on " @@ -371,6 +407,7 @@ ssize_t receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd, char **buffer, SMB_READ_BAD_DECRYPT); return -1; } + *p_encrypted = true; } /* Check the incoming SMB signature. */ @@ -390,7 +427,8 @@ ssize_t receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd, char **buffer, void init_smb_request(struct smb_request *req, const uint8 *inbuf, - size_t unread_bytes) + size_t unread_bytes, + bool encrypted) { size_t req_size = smb_len(inbuf) + 4; /* Ensure we have at least smb_size bytes. */ @@ -406,6 +444,8 @@ void init_smb_request(struct smb_request *req, req->tid = SVAL(inbuf, smb_tid); req->wct = CVAL(inbuf, smb_wct); req->unread_bytes = unread_bytes; + req->encrypted = encrypted; + req->conn = conn_find(req->tid); /* Ensure we have at least wct words and 2 bytes of bcc. */ if (smb_size + req->wct*2 > req_size) { @@ -463,6 +503,7 @@ static bool push_queued_message(struct smb_request *req, msg->request_time = request_time; msg->end_time = end_time; + msg->encrypted = req->encrypted; if (private_data) { msg->private_data = data_blob_talloc(msg, private_data, @@ -738,7 +779,8 @@ static bool receive_message_or_smb(TALLOC_CTX *mem_ctx, char **buffer, size_t *buffer_len, int timeout, - size_t *p_unread) + size_t *p_unread, + bool *p_encrypted) { fd_set r_fds, w_fds; int selrtn; @@ -805,6 +847,7 @@ static bool receive_message_or_smb(TALLOC_CTX *mem_ctx, return False; } *buffer_len = msg->buf.length; + *p_encrypted = msg->encrypted; /* We leave this message on the queue so the open code can know this is a retry. */ @@ -921,7 +964,8 @@ static bool receive_message_or_smb(TALLOC_CTX *mem_ctx, goto again; } - len = receive_smb_talloc(mem_ctx, smbd_server_fd(), buffer, 0, p_unread); + len = receive_smb_talloc(mem_ctx, smbd_server_fd(), + buffer, 0, p_unread, p_encrypted); if (len == -1) { return False; @@ -1288,8 +1332,7 @@ void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes) } construct_reply_common((char *)req->inbuf, (char *)req->outbuf); - srv_set_message((const char *)req->inbuf, - (char *)req->outbuf, num_words, num_bytes, false); + srv_set_message((char *)req->outbuf, num_words, num_bytes, false); /* * Zero out the word area, the caller has to take care of the bcc area * himself @@ -1347,11 +1390,11 @@ static void smb_dump(const char *name, int type, const char *data, ssize_t len) find. ****************************************************************************/ -static void switch_message(uint8 type, struct smb_request *req, int size) +static connection_struct *switch_message(uint8 type, struct smb_request *req, int size) { int flags; uint16 session_tag; - connection_struct *conn; + connection_struct *conn = NULL; static uint16 last_session_tag = UID_FIELD_INVALID; @@ -1359,7 +1402,7 @@ static void switch_message(uint8 type, struct smb_request *req, int size) /* Make sure this is an SMB packet. smb_size contains NetBIOS header * so subtract 4 from it. */ - if (!valid_smb_header((const char *)req->inbuf) + if (!valid_smb_header(req->inbuf) || (size < (smb_size - 4))) { DEBUG(2,("Non-SMB packet of length %d. Terminating server\n", smb_len(req->inbuf))); @@ -1370,7 +1413,7 @@ static void switch_message(uint8 type, struct smb_request *req, int size) DEBUG(0,("Unknown message type %d!\n",type)); smb_dump("Unknown", 1, (char *)req->inbuf, size); reply_unknown_new(req, type); - return; + return NULL; } flags = smb_messages[type].flags; @@ -1378,7 +1421,7 @@ static void switch_message(uint8 type, struct smb_request *req, int size) /* In share mode security we must ignore the vuid. */ session_tag = (lp_security() == SEC_SHARE) ? UID_FIELD_INVALID : req->vuid; - conn = conn_find(req->tid); + conn = req->conn; DEBUG(3,("switch message %s (pid %d) conn 0x%lx\n", smb_fn_name(type), (int)sys_getpid(), (unsigned long)conn)); @@ -1423,12 +1466,12 @@ static void switch_message(uint8 type, struct smb_request *req, int size) } else { reply_doserror(req, ERRSRV, ERRinvnid); } - return; + return NULL; } if (!change_to_user(conn,session_tag)) { reply_nterror(req, NT_STATUS_DOS(ERRSRV, ERRbaduid)); - return; + return conn; } /* All NEED_WRITE and CAN_IPC flags must also have AS_USER. */ @@ -1436,13 +1479,13 @@ static void switch_message(uint8 type, struct smb_request *req, int size) /* Does it need write permission? */ if ((flags & NEED_WRITE) && !CAN_WRITE(conn)) { reply_nterror(req, NT_STATUS_MEDIA_WRITE_PROTECTED); - return; + return conn; } /* IPC services are limited */ if (IS_IPC(conn) && !(flags & CAN_IPC)) { reply_doserror(req, ERRSRV,ERRaccess); - return; + return conn; } } else { /* This call needs to be run as root */ @@ -1451,21 +1494,24 @@ static void switch_message(uint8 type, struct smb_request *req, int size) /* load service specific parameters */ if (conn) { + if (req->encrypted) { + conn->encrypted_tid = true; + /* encrypted required from now on. */ + conn->encrypt_level = Required; + } else if (ENCRYPTION_REQUIRED(conn)) { + uint8 com = CVAL(req->inbuf,smb_com); + if (com != SMBtrans2 && com != SMBtranss2) { + exit_server_cleanly("encryption required " + "on connection"); + return conn; + } + } + if (!set_current_service(conn,SVAL(req->inbuf,smb_flg), (flags & (AS_USER|DO_CHDIR) ?True:False))) { reply_doserror(req, ERRSRV, ERRaccess); - return; - } - - if (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF ) { - /* An encrypted packet has 0xFF 'E' at offset 4 - * which is little endian 0x45FF */ - uint8 com = CVAL(req->inbuf,smb_com); - if (com != SMBtrans2 && com != SMBtranss2) { - reply_nterror(req, NT_STATUS_ACCESS_DENIED); - return; - } + return conn; } conn->num_smb_operations++; } @@ -1476,19 +1522,21 @@ static void switch_message(uint8 type, struct smb_request *req, int size) !check_access(smbd_server_fd(), lp_hostsallow(-1), lp_hostsdeny(-1)))) { reply_doserror(req, ERRSRV, ERRaccess); - return; + return conn; } smb_messages[type].fn_new(conn, req); + return req->conn; } /**************************************************************************** Construct a reply to the incoming packet. ****************************************************************************/ -static void construct_reply(char *inbuf, int size, size_t unread_bytes) +static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool encrypted) { uint8 type = CVAL(inbuf,smb_com); + connection_struct *conn; struct smb_request *req; chain_size = 0; @@ -1498,9 +1546,9 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes) if (!(req = talloc(talloc_tos(), struct smb_request))) { smb_panic("could not allocate smb_request"); } - init_smb_request(req, (uint8 *)inbuf, unread_bytes); + init_smb_request(req, (uint8 *)inbuf, unread_bytes, encrypted); - switch_message(type, req, size); + conn = switch_message(type, req, size); if (req->unread_bytes) { /* writeX failed. drain socket. */ @@ -1519,8 +1567,10 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes) show_msg((char *)req->outbuf); } - if (!send_smb(smbd_server_fd(), (char *)req->outbuf)) { - exit_server_cleanly("construct_reply: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + (char *)req->outbuf, + IS_CONN_ENCRYPTED(conn)||req->encrypted)) { + exit_server_cleanly("construct_reply: srv_send_smb failed."); } TALLOC_FREE(req); @@ -1532,7 +1582,7 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes) Process an smb from the client ****************************************************************************/ -static void process_smb(char *inbuf, size_t nread, size_t unread_bytes) +static void process_smb(char *inbuf, size_t nread, size_t unread_bytes, bool encrypted) { static int trans_num; int msg_type = CVAL(inbuf,0); @@ -1553,7 +1603,7 @@ static void process_smb(char *inbuf, size_t nread, size_t unread_bytes) static unsigned char buf[5] = {0x83, 0, 0, 1, 0x81}; DEBUG( 1, ( "Connection denied from %s\n", client_addr(get_client_fd(),addr,sizeof(addr)) ) ); - (void)send_smb(smbd_server_fd(),(char *)buf); + (void)srv_send_smb(smbd_server_fd(),(char *)buf,false); exit_server_cleanly("connection denied"); } } @@ -1574,7 +1624,7 @@ static void process_smb(char *inbuf, size_t nread, size_t unread_bytes) show_msg(inbuf); - construct_reply(inbuf,nread,unread_bytes); + construct_reply(inbuf,nread,unread_bytes,encrypted); trans_num++; } @@ -1611,7 +1661,7 @@ void remove_from_common_flags2(uint32 v) void construct_reply_common(const char *inbuf, char *outbuf) { - srv_set_message(inbuf,outbuf,0,0,false); + srv_set_message(outbuf,0,0,false); SCVAL(outbuf,smb_com,CVAL(inbuf,smb_com)); SIVAL(outbuf,smb_rcls,0); @@ -1734,7 +1784,7 @@ void chain_reply(struct smb_request *req) if (!(req2 = talloc(talloc_tos(), struct smb_request))) { smb_panic("could not allocate smb_request"); } - init_smb_request(req2, (uint8 *)inbuf2,0); + init_smb_request(req2, (uint8 *)inbuf2,0, req->encrypted); /* process the request */ switch_message(smb_com2, req2, new_size); @@ -2020,6 +2070,7 @@ void smbd_process(void) int num_echos; char *inbuf; size_t inbuf_len; + bool encrypted = false; TALLOC_CTX *frame = talloc_stackframe(); errno = 0; @@ -2035,7 +2086,9 @@ void smbd_process(void) run_events(smbd_event_context(), 0, NULL, NULL); while (!receive_message_or_smb(NULL, &inbuf, &inbuf_len, - select_timeout, &unread_bytes)) { + select_timeout, + &unread_bytes, + &encrypted)) { if(!timeout_processing(&select_timeout, &last_timeout_processing_time)) return; @@ -2054,7 +2107,7 @@ void smbd_process(void) */ num_echos = smb_echo_count; - process_smb(inbuf, inbuf_len, unread_bytes); + process_smb(inbuf, inbuf_len, unread_bytes, encrypted); TALLOC_FREE(inbuf); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index c859efd370..b6efccdb15 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -391,7 +391,7 @@ void reply_special(char *inbuf) /* * We only really use 4 bytes of the outbuf, but for the smb_setlen - * calculation & friends (send_smb uses that) we need the full smb + * calculation & friends (srv_send_smb uses that) we need the full smb * header. */ char outbuf[smb_size]; @@ -470,7 +470,7 @@ void reply_special(char *inbuf) DEBUG(5,("init msg_type=0x%x msg_flags=0x%x\n", msg_type, msg_flags)); - send_smb(smbd_server_fd(), outbuf); + srv_send_smb(smbd_server_fd(), outbuf, false); return; } @@ -523,6 +523,7 @@ void reply_tcon(connection_struct *conn, struct smb_request *req) password_blob = data_blob(password, pwlen+1); conn = make_connection(service,password_blob,dev,req->vuid,&nt_status); + req->conn = conn; data_blob_clear_free(&password_blob); @@ -578,6 +579,7 @@ void reply_tcon_and_X(connection_struct *conn, struct smb_request *req) /* we might have to close an old one */ if ((tcon_flags & 0x1) && conn) { close_cnum(conn,req->vuid); + req->conn = NULL; } if ((passlen > MAX_PASS_LEN) || (passlen >= smb_buflen(req->inbuf))) { @@ -646,6 +648,7 @@ void reply_tcon_and_X(connection_struct *conn, struct smb_request *req) conn = make_connection(service, password, client_devicetype, req->vuid, &nt_status); + req->conn =conn; data_blob_clear_free(&password); @@ -2725,7 +2728,7 @@ void reply_readbraw(connection_struct *conn, struct smb_request *req) START_PROFILE(SMBreadbraw); - if (srv_is_signing_active() || srv_encryption_on()) { + if (srv_is_signing_active() || is_encrypted_packet(req->inbuf)) { exit_server_cleanly("reply_readbraw: SMB signing/sealing is active - " "raw reads/writes are disallowed."); } @@ -2951,8 +2954,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", return; } - srv_set_message((const char *)req->inbuf, - (char *)req->outbuf, 5, nread+3, False); + srv_set_message((char *)req->outbuf, 5, nread+3, False); SSVAL(req->outbuf,smb_vwv0,nread); SSVAL(req->outbuf,smb_vwv5,nread+3); @@ -3039,8 +3041,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", return; } - srv_set_message((const char *)req->inbuf, - (char *)req->outbuf, 5, nread+3, False); + srv_set_message((char *)req->outbuf, 5, nread+3, False); SSVAL(req->outbuf,smb_vwv0,nread); SSVAL(req->outbuf,smb_vwv5,nread+3); @@ -3058,12 +3059,12 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", Setup readX header. ****************************************************************************/ -static int setup_readX_header(const char *inbuf, char *outbuf, size_t smb_maxcnt) +static int setup_readX_header(char *outbuf, size_t smb_maxcnt) { int outsize; char *data; - outsize = srv_set_message(inbuf, outbuf,12,smb_maxcnt,False); + outsize = srv_set_message(outbuf,12,smb_maxcnt,False); data = smb_buf(outbuf); memset(outbuf+smb_vwv0,'\0',24); /* valgrind init. */ @@ -3113,6 +3114,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req, */ if ((chain_size == 0) && (CVAL(req->inbuf,smb_vwv0) == 0xFF) && + !is_encrypted_packet(req->inbuf) && lp_use_sendfile(SNUM(conn)) && (fsp->wcp == NULL) ) { uint8 headerbuf[smb_size + 12 * 2]; DATA_BLOB header; @@ -3126,8 +3128,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req, header = data_blob_const(headerbuf, sizeof(headerbuf)); construct_reply_common((char *)req->inbuf, (char *)headerbuf); - setup_readX_header((const char *)req->inbuf, - (char *)headerbuf, smb_maxcnt); + setup_readX_header((char *)headerbuf, smb_maxcnt); if ((nread = SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp->fh->fd, &header, startpos, smb_maxcnt)) == -1) { /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */ @@ -3178,8 +3179,7 @@ normal_read: uint8 headerbuf[smb_size + 2*12]; construct_reply_common((char *)req->inbuf, (char *)headerbuf); - setup_readX_header((const char *)req->inbuf, - (char *)headerbuf, smb_maxcnt); + setup_readX_header((char *)headerbuf, smb_maxcnt); /* Send out the header. */ if (write_data(smbd_server_fd(), (char *)headerbuf, @@ -3206,8 +3206,7 @@ normal_read: return; } - setup_readX_header((const char *)req->inbuf, - (char *)req->outbuf, nread); + setup_readX_header((char *)req->outbuf, nread); DEBUG( 3, ( "send_file_readX fnum=%d max=%d nread=%d\n", fsp->fnum, (int)smb_maxcnt, (int)nread ) ); @@ -3272,7 +3271,7 @@ void reply_read_and_X(connection_struct *conn, struct smb_request *req) return; } /* We currently don't do this on signed or sealed data. */ - if (srv_is_signing_active() || srv_encryption_on()) { + if (srv_is_signing_active() || is_encrypted_packet(req->inbuf)) { reply_nterror(req, NT_STATUS_NOT_SUPPORTED); END_PROFILE(SMBreadX); return; @@ -3463,13 +3462,15 @@ void reply_writebraw(connection_struct *conn, struct smb_request *req) * it to send more bytes */ memcpy(buf, req->inbuf, smb_size); - outsize = srv_set_message((const char *)req->inbuf, buf, + outsize = srv_set_message(buf, Protocol>PROTOCOL_COREPLUS?1:0,0,True); SCVAL(buf,smb_com,SMBwritebraw); SSVALS(buf,smb_vwv0,0xFFFF); show_msg(buf); - if (!send_smb(smbd_server_fd(),buf)) { - exit_server_cleanly("reply_writebraw: send_smb " + if (!srv_send_smb(smbd_server_fd(), + buf, + IS_CONN_ENCRYPTED(conn))) { + exit_server_cleanly("reply_writebraw: srv_send_smb " "failed."); } @@ -3788,14 +3789,14 @@ void reply_write(connection_struct *conn, struct smb_request *req) (2*14) + /* word count (including bcc) */ \ 1 /* pad byte */) -bool is_valid_writeX_buffer(const char *inbuf) +bool is_valid_writeX_buffer(const uint8_t *inbuf) { size_t numtowrite; connection_struct *conn = NULL; unsigned int doff = 0; size_t len = smb_len_large(inbuf); - if (srv_encryption_on()) { + if (is_encrypted_packet(inbuf)) { /* Can't do this on encrypted * connections. */ return false; @@ -4476,6 +4477,7 @@ void reply_tdis(connection_struct *conn, struct smb_request *req) conn->used = False; close_cnum(conn,req->vuid); + req->conn = NULL; reply_outbuf(req, 0, 0); END_PROFILE(SMBtdis); @@ -4526,8 +4528,10 @@ void reply_echo(connection_struct *conn, struct smb_request *req) SSVAL(req->outbuf,smb_vwv0,seq_num); show_msg((char *)req->outbuf); - if (!send_smb(smbd_server_fd(),(char *)req->outbuf)) - exit_server_cleanly("reply_echo: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + (char *)req->outbuf, + IS_CONN_ENCRYPTED(conn)||req->encrypted)) + exit_server_cleanly("reply_echo: srv_send_smb failed."); } DEBUG(3,("echo %d times\n", smb_reverb)); @@ -4830,7 +4834,7 @@ void reply_mkdir(connection_struct *conn, struct smb_request *req) return; } - status = create_directory(conn, directory); + status = create_directory(conn, req, directory); DEBUG(5, ("create_directory returned %s\n", nt_errstr(status))); @@ -6803,8 +6807,7 @@ void reply_lockingX(connection_struct *conn, struct smb_request *req) * onto the blocking lock queue. */ if(push_blocking_lock_request(br_lck, - (char *)req->inbuf, - smb_len(req->inbuf)+4, + req, fsp, lock_timeout, i, diff --git a/source3/smbd/seal.c b/source3/smbd/seal.c index 24ecb77fd5..21fca73fea 100644 --- a/source3/smbd/seal.c +++ b/source3/smbd/seal.c @@ -36,24 +36,37 @@ static struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx; static struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx; /****************************************************************************** - Is server encryption on ? + Return global enc context - this must change if we ever do multiple contexts. ******************************************************************************/ -bool srv_encryption_on(void) +uint16_t srv_enc_ctx(void) { - if (srv_trans_enc_ctx) { - return common_encryption_on(srv_trans_enc_ctx->es); - } - return false; + return srv_trans_enc_ctx->es->enc_ctx_num; } /****************************************************************************** - Return global enc context - this must change if we ever do multiple contexts. + Is this an incoming encrypted packet ? ******************************************************************************/ -uint16 srv_enc_ctx(void) +bool is_encrypted_packet(const uint8_t *inbuf) { - return srv_trans_enc_ctx->es->enc_ctx_num; + NTSTATUS status; + uint16_t enc_num; + + /* Ignore non-session messages. */ + if(CVAL(inbuf,0)) { + return false; + } + + status = get_enc_ctx_num(inbuf, &enc_num); + if (!NT_STATUS_IS_OK(status)) { + return false; + } + + if (srv_trans_enc_ctx && enc_num == srv_enc_ctx()) { + return true; + } + return false; } /****************************************************************************** @@ -292,9 +305,9 @@ void srv_free_enc_buffer(char *buf) { /* We know this is an smb buffer, and we * didn't malloc, only copy, for a keepalive, - * so ignore session keepalives. */ + * so ignore non-session messages. */ - if(CVAL(buf,0) == SMBkeepalive) { + if(CVAL(buf,0)) { return; } @@ -309,8 +322,8 @@ void srv_free_enc_buffer(char *buf) NTSTATUS srv_decrypt_buffer(char *buf) { - /* Ignore session keepalives. */ - if(CVAL(buf,0) == SMBkeepalive) { + /* Ignore non-session messages. */ + if(CVAL(buf,0)) { return NT_STATUS_OK; } @@ -329,8 +342,8 @@ NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out) { *buf_out = buf; - /* Ignore session keepalives. */ - if(CVAL(buf,0) == SMBkeepalive) { + /* Ignore non-session messages. */ + if(CVAL(buf,0)) { return NT_STATUS_OK; } @@ -698,6 +711,7 @@ NTSTATUS srv_encryption_start(connection_struct *conn) srv_trans_enc_ctx->es->enc_on = true; partial_srv_trans_enc_ctx = NULL; + return NT_STATUS_OK; } diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index 8ca012ff24..e44a540554 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -139,7 +139,7 @@ static void reply_sesssetup_blob(connection_struct *conn, } show_msg((char *)req->outbuf); - send_smb(smbd_server_fd(),(char *)req->outbuf); + srv_send_smb(smbd_server_fd(),(char *)req->outbuf,req->encrypted); TALLOC_FREE(req->outbuf); } diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index eba8cb50f0..1e421a70b6 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -575,7 +575,8 @@ static struct ea_list *ea_list_union(struct ea_list *name_list, struct ea_list * HACK ! Always assumes smb_setup field is zero. ****************************************************************************/ -void send_trans2_replies(struct smb_request *req, +void send_trans2_replies(connection_struct *conn, + struct smb_request *req, const char *params, int paramsize, const char *pdata, @@ -737,8 +738,10 @@ void send_trans2_replies(struct smb_request *req, /* Send the packet */ show_msg((char *)req->outbuf); - if (!send_smb(smbd_server_fd(),(char *)req->outbuf)) - exit_server_cleanly("send_trans2_replies: send_smb failed."); + if (!srv_send_smb(smbd_server_fd(), + (char *)req->outbuf, + IS_CONN_ENCRYPTED(conn))) + exit_server_cleanly("send_trans2_replies: srv_send_smb failed."); TALLOC_FREE(req->outbuf); @@ -956,7 +959,7 @@ static void call_trans2open(connection_struct *conn, } /* Send the required number of replies */ - send_trans2_replies(req, params, 30, *ppdata, 0, max_data_bytes); + send_trans2_replies(conn, req, params, 30, *ppdata, 0, max_data_bytes); } /********************************************************* @@ -2026,7 +2029,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd SSVAL(params,6,0); /* Never an EA error */ SSVAL(params,8,last_entry_off); - send_trans2_replies(req, params, 10, pdata, PTR_DIFF(p,pdata), + send_trans2_replies(conn, req, params, 10, pdata, PTR_DIFF(p,pdata), max_data_bytes); if ((! *directory) && dptr_path(dptr_num)) { @@ -2350,7 +2353,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd SSVAL(params,4,0); /* Never an EA error */ SSVAL(params,6,last_entry_off); - send_trans2_replies(req, params, 8, pdata, PTR_DIFF(p,pdata), + send_trans2_replies(conn, req, params, 8, pdata, PTR_DIFF(p,pdata), max_data_bytes); return; @@ -2389,13 +2392,23 @@ static void call_trans2qfsinfo(connection_struct *conn, info_level = SVAL(params,0); - if (IS_IPC(conn) || - (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF )) { + if (IS_IPC(conn)) { + if (info_level != SMB_QUERY_CIFS_UNIX_INFO) { + DEBUG(0,("call_trans2qfsinfo: not an allowed " + "info level (0x%x) on IPC$.\n", + (unsigned int)info_level)); + reply_nterror(req, NT_STATUS_ACCESS_DENIED); + return; + } + } + + if (ENCRYPTION_REQUIRED(conn) && !req->encrypted) { if (info_level != SMB_QUERY_CIFS_UNIX_INFO) { DEBUG(0,("call_trans2qfsinfo: encryption required " "and info level 0x%x sent.\n", (unsigned int)info_level)); - reply_nterror(req, NT_STATUS_ACCESS_DENIED); + exit_server_cleanly("encryption required " + "on connection"); return; } } @@ -2906,7 +2919,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned } - send_trans2_replies(req, params, 0, pdata, data_len, + send_trans2_replies(conn, req, params, 0, pdata, data_len, max_data_bytes); DEBUG( 4, ( "%s info_level = %d\n", @@ -2952,12 +2965,13 @@ static void call_trans2setfsinfo(connection_struct *conn, } } - if (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF ) { + if (ENCRYPTION_REQUIRED(conn) && !req->encrypted) { if (info_level != SMB_REQUEST_TRANSPORT_ENCRYPTION) { DEBUG(0,("call_trans2setfsinfo: encryption required " "and info level 0x%x sent.\n", (unsigned int)info_level)); - reply_nterror(req, NT_STATUS_ACCESS_DENIED); + exit_server_cleanly("encryption required " + "on connection"); return; } } @@ -3048,7 +3062,7 @@ cap_low = 0x%x, cap_high = 0x%x\n", return; } - send_trans2_replies(req, + send_trans2_replies(conn, req, *pparams, param_len, *ppdata, @@ -3524,7 +3538,7 @@ static void call_trans2qpipeinfo(connection_struct *conn, return; } - send_trans2_replies(req, params, param_size, *ppdata, data_size, + send_trans2_replies(conn, req, params, param_size, *ppdata, data_size, max_data_bytes); return; @@ -4456,7 +4470,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd return; } - send_trans2_replies(req, params, param_size, *ppdata, data_size, + send_trans2_replies(conn, req, params, param_size, *ppdata, data_size, max_data_bytes); return; @@ -5160,8 +5174,7 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn, ****************************************************************************/ static NTSTATUS smb_set_posix_lock(connection_struct *conn, - const uint8 *inbuf, - int length, + const struct smb_request *req, const char *pdata, int total_data, files_struct *fsp) @@ -5171,6 +5184,7 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn, uint32 lock_pid; bool blocking_lock = False; enum brl_type lock_type; + NTSTATUS status = NT_STATUS_OK; if (fsp == NULL || fsp->fh->fd == -1) { @@ -5258,7 +5272,7 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn, * onto the blocking lock queue. */ if(push_blocking_lock_request(br_lck, - (char *)inbuf, length, + req, fsp, -1, /* infinite timeout. */ 0, @@ -6316,7 +6330,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn, DEBUG(3,("call_trans2setfilepathinfo: Cancelling print job (%s)\n", fsp->fsp_name )); SSVAL(params,0,0); - send_trans2_replies(req, params, 2, + send_trans2_replies(conn, req, params, 2, *ppdata, 0, max_data_bytes); return; @@ -6606,8 +6620,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn, reply_nterror(req, NT_STATUS_INVALID_LEVEL); return; } - status = smb_set_posix_lock(conn, req->inbuf, - smb_len(req->inbuf) + 4, + status = smb_set_posix_lock(conn, req, pdata, total_data, fsp); break; } @@ -6675,7 +6688,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn, } SSVAL(params,0,0); - send_trans2_replies(req, params, 2, *ppdata, data_return_size, + send_trans2_replies(conn, req, params, 2, *ppdata, data_return_size, max_data_bytes); return; @@ -6767,7 +6780,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req, return; } - status = create_directory(conn, directory); + status = create_directory(conn, req, directory); if (!NT_STATUS_IS_OK(status)) { reply_nterror(req, status); @@ -6793,7 +6806,7 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req, SSVAL(params,0,0); - send_trans2_replies(req, params, 2, *ppdata, 0, max_data_bytes); + send_trans2_replies(conn, req, params, 2, *ppdata, 0, max_data_bytes); return; } @@ -6847,7 +6860,7 @@ static void call_trans2findnotifyfirst(connection_struct *conn, if(fnf_handle == 0) fnf_handle = 257; - send_trans2_replies(req, params, 6, *ppdata, 0, max_data_bytes); + send_trans2_replies(conn, req, params, 6, *ppdata, 0, max_data_bytes); return; } @@ -6878,7 +6891,7 @@ static void call_trans2findnotifynext(connection_struct *conn, SSVAL(params,0,0); /* No changes */ SSVAL(params,2,0); /* No EA errors */ - send_trans2_replies(req, params, 4, *ppdata, 0, max_data_bytes); + send_trans2_replies(conn, req, params, 4, *ppdata, 0, max_data_bytes); return; } @@ -6928,7 +6941,7 @@ static void call_trans2getdfsreferral(connection_struct *conn, SSVAL(req->inbuf, smb_flg2, SVAL(req->inbuf,smb_flg2) | FLAGS2_DFS_PATHNAMES); - send_trans2_replies(req,0,0,*ppdata,reply_size, max_data_bytes); + send_trans2_replies(conn, req,0,0,*ppdata,reply_size, max_data_bytes); return; } @@ -6975,7 +6988,7 @@ static void call_trans2ioctl(connection_struct *conn, srvstr_push(pdata, req->flags2, pdata+18, lp_servicename(SNUM(conn)), 13, STR_ASCII|STR_TERMINATE); /* Service name */ - send_trans2_replies(req, *pparams, 0, *ppdata, 32, + send_trans2_replies(conn, req, *pparams, 0, *ppdata, 32, max_data_bytes); return; } diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c index 912d575c60..fb01e7f9a1 100644 --- a/source3/utils/smbfilter.c +++ b/source3/utils/smbfilter.c @@ -114,6 +114,30 @@ static void filter_request(char *buf) } +/**************************************************************************** + Send an smb to a fd. +****************************************************************************/ + +static bool send_smb(int fd, char *buffer) +{ + size_t len; + size_t nwritten=0; + ssize_t ret; + + len = smb_len(buffer) + 4; + + while (nwritten < len) { + ret = write_data(fd,buffer+nwritten,len - nwritten); + if (ret <= 0) { + DEBUG(0,("Error writing %d bytes to client. %d. (%s)\n", + (int)len,(int)ret, strerror(errno) )); + return false; + } + nwritten += ret; + } + + return true; +} static void filter_child(int c, struct sockaddr_storage *dest_ss) { @@ -145,7 +169,7 @@ static void filter_child(int c, struct sockaddr_storage *dest_ss) if (num <= 0) continue; if (c != -1 && FD_ISSET(c, &fds)) { - if (!receive_smb(c, packet, 0, NULL)) { + if (!receive_smb_raw(c, packet, 0, NULL)) { d_printf("client closed connection\n"); exit(0); } @@ -156,7 +180,7 @@ static void filter_child(int c, struct sockaddr_storage *dest_ss) } } if (s != -1 && FD_ISSET(s, &fds)) { - if (!receive_smb(s, packet, 0, NULL)) { + if (!receive_smb_raw(s, packet, 0, NULL)) { d_printf("server closed connection\n"); exit(0); } -- cgit From 3f42428f9bca5b8473501adc932405cae3c247bb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 21:45:28 +0100 Subject: Fix a misleading DEBUG message. At this stage, the (tcp) connection to the LDAP server has not been established, this is what is about to be attempted. What has been succesfully done, is a CLDAP netlogon query. Michael (This used to be commit 71c3c8ad4c92c5f6267b84ee1d207e5e49e9a4ec) --- source3/libads/ldap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 843d57988c..138dfe9015 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -400,7 +400,7 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads) got_connection: print_sockaddr(addr, sizeof(addr), &ads->ldap.ss); - DEBUG(3,("Connected to LDAP server %s\n", addr)); + DEBUG(3,("Successfully contacted LDAP server %s\n", addr)); if (!ads->auth.user_name) { /* Must use the userPrincipalName value here or sAMAccountName -- cgit From 4ad3464fb94c7088e7fd731113c682aa7756ef01 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 21:53:25 +0100 Subject: Unindent function header. Michael (This used to be commit cafda34783f0961c9b463803c19cfcb69f836e3f) --- source3/libads/ldap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 138dfe9015..712e7e2889 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -52,7 +52,7 @@ static void gotalarm_sig(void) gotalarm = 1; } - LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to) +LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to) { LDAP *ldp = NULL; -- cgit From 34e579fce5a6cc9ffa60fbe6e797b2e6b35c879e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 21:54:02 +0100 Subject: Enhance DEBUG-verbosity of ldap_open_with_timeout(). Michael (This used to be commit 9e70d1f24dd304c363a1bde97b5af618b46edc49) --- source3/libads/ldap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 712e7e2889..8a2b82a61d 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -56,6 +56,10 @@ LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to) { LDAP *ldp = NULL; + + DEBUG(10, ("Opening connection to LDAP server '%s:%d', timeout " + "%u seconds\n", server, port, to)); + /* Setup timeout */ gotalarm = 0; CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig); @@ -65,8 +69,10 @@ LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to) ldp = ldap_open(server, port); if (ldp == NULL) { - DEBUG(2,("Could not open LDAP connection to %s:%d: %s\n", + DEBUG(2,("Could not open connection to LDAP server %s:%d: %s\n", server, port, strerror(errno))); + } else { + DEBUG(10, ("Connected to LDAP server '%s:%d'\n", server, port)); } /* Teardown timeout. */ -- cgit From 2cb68e3898046ea0dd2ddcf1e32dc7dffca79be8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 21:56:57 +0100 Subject: Untangle assignment and result check. Michael (This used to be commit 465a3b356cffb855e26569d3752f15cac07208c0) --- source3/libads/ldap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 8a2b82a61d..ae8e1e4d4d 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -448,9 +448,9 @@ got_connection: /* Otherwise setup the TCP LDAP session */ - if ( (ads->ldap.ld = ldap_open_with_timeout(ads->config.ldap_server_name, - LDAP_PORT, lp_ldap_timeout())) == NULL ) - { + ads->ldap.ld = ldap_open_with_timeout(ads->config.ldap_server_name, + LDAP_PORT, lp_ldap_timeout()); + if (ads->ldap.ld == NULL) { return ADS_ERROR(LDAP_OPERATIONS_ERROR); } -- cgit From b54310cbaa9584a46decfa2a5bc4bb2a72381a98 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 22:06:15 +0100 Subject: Add a debug message (when the LDAP server has really been connected). Michael (This used to be commit 7d9d2de39072b3291b95ac3965df0d19f83792b9) --- source3/libads/ldap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index ae8e1e4d4d..44560c852d 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -453,6 +453,7 @@ got_connection: if (ads->ldap.ld == NULL) { return ADS_ERROR(LDAP_OPERATIONS_ERROR); } + DEBUG(3,("Connected to LDAP server %s\n", ads->config.ldap_server_name)); /* cache the successful connection for workgroup and realm */ if (ads_closest_dc(ads)) { -- cgit From 68b296510827c4d40a06ab16c6cfee883bc6bc1d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 13:24:24 -0800 Subject: Fix the build. Jeremy. (This used to be commit 25a0084af5978cc11cf4e83a641bc57e0e64eb89) --- source3/utils/smbfilter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c index fb01e7f9a1..8db969722a 100644 --- a/source3/utils/smbfilter.c +++ b/source3/utils/smbfilter.c @@ -169,7 +169,7 @@ static void filter_child(int c, struct sockaddr_storage *dest_ss) if (num <= 0) continue; if (c != -1 && FD_ISSET(c, &fds)) { - if (!receive_smb_raw(c, packet, 0, NULL)) { + if (!receive_smb_raw(c, packet, 0, 0, NULL)) { d_printf("client closed connection\n"); exit(0); } @@ -180,7 +180,7 @@ static void filter_child(int c, struct sockaddr_storage *dest_ss) } } if (s != -1 && FD_ISSET(s, &fds)) { - if (!receive_smb_raw(s, packet, 0, NULL)) { + if (!receive_smb_raw(s, packet, 0, 0, NULL)) { d_printf("server closed connection\n"); exit(0); } -- cgit From 4aba7475effff485f265fb975cf467fffd6c7db0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 4 Jan 2008 22:56:10 +0100 Subject: Re-Indent function ldap_open_with_timeout(). This reverts commit #cafda34783f0961c9b463803c19cfcb69f836e3f . I just learned (the hard way) that these indeted functions are not indented by accident but that the intention of this is to not include the prototype into proto.h. Michael (This used to be commit 2e5d01b2146bb9e057b2779d9fe7691ed46d9f45) --- source3/libads/ldap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 44560c852d..975e926864 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -52,7 +52,7 @@ static void gotalarm_sig(void) gotalarm = 1; } -LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to) + LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to) { LDAP *ldp = NULL; -- cgit From 6503c7338e2c46bf3c660759c078ff51835a40e9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 13:59:26 -0800 Subject: Fix interesting bug found with make valgrindtest. When cancelling a lock due to file closure make sure we null out the fsp pointer so it isn't dangling. This is an old bug (not related to the new changes). Jeremy. (This used to be commit b5ee972b0c04b4d119573d95ac458a3b6be30c5c) --- source3/smbd/blocking.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index c56f635dde..41963166f7 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -303,19 +303,20 @@ static void generic_blocking_lock_error(blocking_lock_record *blr, NTSTATUS stat /* Store the last lock error. */ files_struct *fsp = blr->fsp; - fsp->last_lock_failure.context.smbpid = blr->lock_pid; - fsp->last_lock_failure.context.tid = fsp->conn->cnum; - fsp->last_lock_failure.context.pid = procid_self(); - fsp->last_lock_failure.start = blr->offset; - fsp->last_lock_failure.size = blr->count; - fsp->last_lock_failure.fnum = fsp->fnum; - fsp->last_lock_failure.lock_type = READ_LOCK; /* Don't care. */ - fsp->last_lock_failure.lock_flav = blr->lock_flav; + if (fsp) { + fsp->last_lock_failure.context.smbpid = blr->lock_pid; + fsp->last_lock_failure.context.tid = fsp->conn->cnum; + fsp->last_lock_failure.context.pid = procid_self(); + fsp->last_lock_failure.start = blr->offset; + fsp->last_lock_failure.size = blr->count; + fsp->last_lock_failure.fnum = fsp->fnum; + fsp->last_lock_failure.lock_type = READ_LOCK; /* Don't care. */ + fsp->last_lock_failure.lock_flav = blr->lock_flav; + } } ERROR_NT(status); - if (!srv_send_smb(smbd_server_fd(),outbuf, - IS_CONN_ENCRYPTED(blr->fsp->conn))) { + if (!srv_send_smb(smbd_server_fd(),outbuf, blr->encrypted)) { exit_server_cleanly("generic_blocking_lock_error: srv_send_smb failed."); } } @@ -605,6 +606,9 @@ file %s fnum = %d\n", blr->com_type, fsp->fsp_name, fsp->fnum )); locktype, NT_STATUS_RANGE_NOT_LOCKED); } + /* We're closing the file fsp here, so ensure + * we don't have a dangling pointer. */ + blr->fsp = NULL; } } } -- cgit From 395c366237dec1a38a53248d2e8df17f877207aa Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 22:56:31 +0100 Subject: Do not pass emtpy wkssvc_PasswordBuffers to rpc functions. Guenther (This used to be commit fe75e5ccdfc2609380367e59215637b0de1ef241) --- source3/lib/netapi/joindomain.c | 12 ++++-------- source3/libsmb/smbencrypt.c | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 0d4452e1df..c7849c952f 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -90,13 +90,11 @@ static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx, { struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_cli = NULL; - struct wkssvc_PasswordBuffer encrypted_password; + struct wkssvc_PasswordBuffer *encrypted_password = NULL; NTSTATUS status; WERROR werr; unsigned int old_timeout = 0; - ZERO_STRUCT(encrypted_password); - status = cli_full_connection(&cli, NULL, server_name, NULL, 0, "IPC$", "IPC", @@ -129,7 +127,7 @@ static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx, status = rpccli_wkssvc_NetrJoinDomain2(pipe_cli, ctx, server_name, domain_name, account_ou, Account, - &encrypted_password, + encrypted_password, join_flags, &werr); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); @@ -277,13 +275,11 @@ static WERROR NetUnjoinDomainRemote(struct libnetapi_ctx *ctx, { struct cli_state *cli = NULL; struct rpc_pipe_client *pipe_cli = NULL; - struct wkssvc_PasswordBuffer encrypted_password; + struct wkssvc_PasswordBuffer *encrypted_password = NULL; NTSTATUS status; WERROR werr; unsigned int old_timeout = 0; - ZERO_STRUCT(encrypted_password); - status = cli_full_connection(&cli, NULL, server_name, NULL, 0, "IPC$", "IPC", @@ -316,7 +312,7 @@ static WERROR NetUnjoinDomainRemote(struct libnetapi_ctx *ctx, status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, ctx, server_name, account, - &encrypted_password, + encrypted_password, unjoin_flags, &werr); if (!NT_STATUS_IS_OK(status)) { diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c index 9e37d1d6cf..d7f6f604f7 100644 --- a/source3/libsmb/smbencrypt.c +++ b/source3/libsmb/smbencrypt.c @@ -704,16 +704,22 @@ char *decrypt_trustdom_secret(const char *pass, DATA_BLOB *data_in) void encode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx, const char *pwd, DATA_BLOB *session_key, - struct wkssvc_PasswordBuffer *pwd_buf) + struct wkssvc_PasswordBuffer **pwd_buf) { uint8_t buffer[516]; struct MD5Context ctx; - - DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16); - + struct wkssvc_PasswordBuffer *my_pwd_buf = NULL; + DATA_BLOB confounded_session_key; int confounder_len = 8; uint8_t confounder[8]; + my_pwd_buf = talloc_zero(mem_ctx, struct wkssvc_PasswordBuffer); + if (!my_pwd_buf) { + return; + } + + confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16); + encode_pw_buffer(buffer, pwd, STR_UNICODE); generate_random_buffer((uint8_t *)confounder, confounder_len); @@ -725,10 +731,12 @@ void encode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx, SamOEMhashBlob(buffer, 516, &confounded_session_key); - memcpy(&pwd_buf->data[0], confounder, confounder_len); - memcpy(&pwd_buf->data[8], buffer, 516); + memcpy(&my_pwd_buf->data[0], confounder, confounder_len); + memcpy(&my_pwd_buf->data[8], buffer, 516); data_blob_free(&confounded_session_key); + + *pwd_buf = my_pwd_buf; } WERROR decode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx, -- cgit From a8d2664fec3867cc40894531615a9a2d8036fa25 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 4 Jan 2008 23:27:14 +0100 Subject: allocate share_mode_str only when needed (This used to be commit a98693bfa7bfe72ffa164d21b3e9636e268708aa) --- source3/locking/locking.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index dab21e53b3..270c6d2261 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -608,7 +608,10 @@ static bool parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) for (i = 0; i < lck->num_share_modes; i++) { struct share_mode_entry *entry_p = &lck->share_modes[i]; - char *str = share_mode_str(NULL, i, entry_p); + char *str = NULL; + if (DEBUGLEVEL >= 10) { + str = share_mode_str(NULL, i, entry_p); + } DEBUG(10,("parse_share_modes: %s\n", str ? str : "")); if (!process_exists(entry_p->pid)) { -- cgit From 9394916e49d124461299af8d3e13e97d2c935d14 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 14:43:43 -0800 Subject: We dont' modify the smb header for crypto anymore. Jeremy. (This used to be commit f5b6b6dac66b4ecc113985a7e7db1855b324c465) --- source3/smbd/trans2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 1e421a70b6..4e2cceca36 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -7067,7 +7067,7 @@ static void handle_trans2(connection_struct *conn, struct smb_request *req, SSVAL(req->inbuf,smb_flg2,req->flags2); } - if (conn->encrypt_level == Required && SVAL(req->inbuf,4) != 0x45FF ) { + if (conn->encrypt_level == Required && !req->encrypted) { if (state->call != TRANSACT2_QFSINFO && state->call != TRANSACT2_SETFSINFO) { DEBUG(0,("handle_trans2: encryption required " -- cgit From 058ba641f3d6def3dc5f97fa4522caa1c1c505f9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 14:56:56 -0800 Subject: Fix idle client reading keepalive. Jeremy. (This used to be commit 4ce0bf785635371e2923217b1e0b7f30986c25bb) --- source3/client/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/client/client.c b/source3/client/client.c index fbcfa531ed..d10e632979 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4333,7 +4333,7 @@ static void readline_callback(void) session keepalives and then drop them here. */ if (FD_ISSET(cli->fd,&fds)) { - if (!receive_smb_raw(cli->fd,cli->inbuf,0,0,&cli->smb_rw_error)) { + if (receive_smb_raw(cli->fd,cli->inbuf,0,0,&cli->smb_rw_error) == -1) { DEBUG(0, ("Read from server failed, maybe it closed the " "connection\n")); return; -- cgit From 29562987c393ef7e908aa02ee7ba00a83f3db520 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 15:37:24 -0800 Subject: Now conn is part of smb_request, we don't need it as an extra parameter. This cleans up quite a few places we were passing it around without needing it. Jeremy. (This used to be commit 8f36def18e9f980e8db522e1de41e80cfd5f466e) --- source3/smbd/ipc.c | 6 +- source3/smbd/message.c | 8 +-- source3/smbd/negprot.c | 2 +- source3/smbd/nttrans.c | 14 +++-- source3/smbd/process.c | 4 +- source3/smbd/reply.c | 147 ++++++++++++++++++++++++++++------------------- source3/smbd/sesssetup.c | 40 ++++++------- source3/smbd/trans2.c | 10 ++-- 8 files changed, 131 insertions(+), 100 deletions(-) diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index a89f5cbbfe..68a13d692f 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -489,8 +489,9 @@ static void handle_trans(connection_struct *conn, struct smb_request *req, Reply to a SMBtrans. ****************************************************************************/ -void reply_trans(connection_struct *conn, struct smb_request *req) +void reply_trans(struct smb_request *req) { + connection_struct *conn = req->conn; unsigned int dsoff; unsigned int dscnt; unsigned int psoff; @@ -669,8 +670,9 @@ void reply_trans(connection_struct *conn, struct smb_request *req) Reply to a secondary SMBtrans. ****************************************************************************/ -void reply_transs(connection_struct *conn, struct smb_request *req) +void reply_transs(struct smb_request *req) { + connection_struct *conn = req->conn; unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp; struct trans_state *state; int size; diff --git a/source3/smbd/message.c b/source3/smbd/message.c index d0b524da0e..a870f03df9 100644 --- a/source3/smbd/message.c +++ b/source3/smbd/message.c @@ -137,7 +137,7 @@ static void msg_deliver(struct msg_state *state) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_sends(connection_struct *conn, struct smb_request *req) +void reply_sends(struct smb_request *req) { struct msg_state *state; int len; @@ -190,7 +190,7 @@ void reply_sends(connection_struct *conn, struct smb_request *req) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_sendstrt(connection_struct *conn, struct smb_request *req) +void reply_sendstrt(struct smb_request *req) { char *p; @@ -234,7 +234,7 @@ void reply_sendstrt(connection_struct *conn, struct smb_request *req) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_sendtxt(connection_struct *conn, struct smb_request *req) +void reply_sendtxt(struct smb_request *req) { int len; char *msg; @@ -287,7 +287,7 @@ void reply_sendtxt(connection_struct *conn, struct smb_request *req) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_sendend(connection_struct *conn, struct smb_request *req) +void reply_sendend(struct smb_request *req) { START_PROFILE(SMBsendend); diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 02f752fd67..9f56949eeb 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -505,7 +505,7 @@ static const struct { conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_negprot(connection_struct *conn, struct smb_request *req) +void reply_negprot(struct smb_request *req) { size_t size = smb_len(req->inbuf) + 4; int choice= -1; diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 8ac0217dcd..a51f3afd82 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -413,8 +413,9 @@ static void do_ntcreate_pipe_open(connection_struct *conn, Reply to an NT create and X call. ****************************************************************************/ -void reply_ntcreate_and_X(connection_struct *conn, struct smb_request *req) +void reply_ntcreate_and_X(struct smb_request *req) { + connection_struct *conn = req->conn; char *fname = NULL; uint32 flags; uint32 access_mask; @@ -1093,7 +1094,7 @@ static void call_nt_transact_create(connection_struct *conn, conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_ntcancel(connection_struct *conn, struct smb_request *req) +void reply_ntcancel(struct smb_request *req) { /* * Go through and cancel any pending change notifies. @@ -1255,8 +1256,9 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx, Reply to a NT rename request. ****************************************************************************/ -void reply_ntrename(connection_struct *conn, struct smb_request *req) +void reply_ntrename(struct smb_request *req) { + connection_struct *conn = req->conn; char *oldname = NULL; char *newname = NULL; char *p; @@ -2578,8 +2580,9 @@ static void handle_nttrans(connection_struct *conn, Reply to a SMBNTtrans. ****************************************************************************/ -void reply_nttrans(connection_struct *conn, struct smb_request *req) +void reply_nttrans(struct smb_request *req) { + connection_struct *conn = req->conn; uint32 pscnt; uint32 psoff; uint32 dscnt; @@ -2769,8 +2772,9 @@ void reply_nttrans(connection_struct *conn, struct smb_request *req) Reply to a SMBnttranss ****************************************************************************/ -void reply_nttranss(connection_struct *conn, struct smb_request *req) +void reply_nttranss(struct smb_request *req) { + connection_struct *conn = req->conn; unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp; struct trans_state *state; diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 32d1d058e3..fe32d57ff7 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1045,7 +1045,7 @@ force write permissions on print services. */ static const struct smb_message_struct { const char *name; - void (*fn_new)(connection_struct *conn, struct smb_request *req); + void (*fn_new)(struct smb_request *req); int flags; } smb_messages[256] = { @@ -1525,7 +1525,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in return conn; } - smb_messages[type].fn_new(conn, req); + smb_messages[type].fn_new(req); return req->conn; } diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index b6efccdb15..d5e683ca3c 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -479,8 +479,9 @@ void reply_special(char *inbuf) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_tcon(connection_struct *conn, struct smb_request *req) +void reply_tcon(struct smb_request *req) { + connection_struct *conn = req->conn; const char *service; char *service_buf = NULL; char *password = NULL; @@ -550,8 +551,9 @@ void reply_tcon(connection_struct *conn, struct smb_request *req) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_tcon_and_X(connection_struct *conn, struct smb_request *req) +void reply_tcon_and_X(struct smb_request *req) { + connection_struct *conn = req->conn; char *service = NULL; DATA_BLOB password; TALLOC_CTX *ctx = talloc_tos(); @@ -580,6 +582,7 @@ void reply_tcon_and_X(connection_struct *conn, struct smb_request *req) if ((tcon_flags & 0x1) && conn) { close_cnum(conn,req->vuid); req->conn = NULL; + conn = NULL; } if ((passlen > MAX_PASS_LEN) || (passlen >= smb_buflen(req->inbuf))) { @@ -734,17 +737,6 @@ void reply_tcon_and_X(connection_struct *conn, struct smb_request *req) Reply to an unknown type. ****************************************************************************/ -int reply_unknown(char *inbuf,char *outbuf) -{ - int type; - type = CVAL(inbuf,smb_com); - - DEBUG(0,("unknown command type (%s): type=%d (0x%X)\n", - smb_fn_name(type), type, type)); - - return(ERROR_DOS(ERRSRV,ERRunknownsmb)); -} - void reply_unknown_new(struct smb_request *req, uint8 type) { DEBUG(0, ("unknown command type (%s): type=%d (0x%X)\n", @@ -758,8 +750,9 @@ void reply_unknown_new(struct smb_request *req, uint8 type) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_ioctl(connection_struct *conn, struct smb_request *req) +void reply_ioctl(struct smb_request *req) { + connection_struct *conn = req->conn; uint16 device; uint16 function; uint32 ioctl_code; @@ -847,8 +840,9 @@ static NTSTATUS map_checkpath_error(const char *inbuf, NTSTATUS status) Reply to a checkpath. ****************************************************************************/ -void reply_checkpath(connection_struct *conn, struct smb_request *req) +void reply_checkpath(struct smb_request *req) { + connection_struct *conn = req->conn; char *name = NULL; SMB_STRUCT_STAT sbuf; NTSTATUS status; @@ -941,8 +935,9 @@ void reply_checkpath(connection_struct *conn, struct smb_request *req) Reply to a getatr. ****************************************************************************/ -void reply_getatr(connection_struct *conn, struct smb_request *req) +void reply_getatr(struct smb_request *req) { + connection_struct *conn = req->conn; char *fname = NULL; SMB_STRUCT_STAT sbuf; int mode=0; @@ -1042,8 +1037,9 @@ void reply_getatr(connection_struct *conn, struct smb_request *req) Reply to a setatr. ****************************************************************************/ -void reply_setatr(connection_struct *conn, struct smb_request *req) +void reply_setatr(struct smb_request *req) { + connection_struct *conn = req->conn; char *fname = NULL; int mode; time_t mtime; @@ -1142,8 +1138,9 @@ void reply_setatr(connection_struct *conn, struct smb_request *req) Reply to a dskattr. ****************************************************************************/ -void reply_dskattr(connection_struct *conn, struct smb_request *req) +void reply_dskattr(struct smb_request *req) { + connection_struct *conn = req->conn; SMB_BIG_UINT dfree,dsize,bsize; START_PROFILE(SMBdskattr); @@ -1194,8 +1191,9 @@ void reply_dskattr(connection_struct *conn, struct smb_request *req) Can be called from SMBsearch, SMBffirst or SMBfunique. ****************************************************************************/ -void reply_search(connection_struct *conn, struct smb_request *req) +void reply_search(struct smb_request *req) { + connection_struct *conn = req->conn; char *mask = NULL; char *directory = NULL; char *fname = NULL; @@ -1496,7 +1494,7 @@ void reply_search(connection_struct *conn, struct smb_request *req) Reply to a fclose (stop directory search). ****************************************************************************/ -void reply_fclose(connection_struct *conn, struct smb_request *req) +void reply_fclose(struct smb_request *req) { int status_len; char status[21]; @@ -1560,8 +1558,9 @@ void reply_fclose(connection_struct *conn, struct smb_request *req) Reply to an open. ****************************************************************************/ -void reply_open(connection_struct *conn, struct smb_request *req) +void reply_open(struct smb_request *req) { + connection_struct *conn = req->conn; char *fname = NULL; uint32 fattr=0; SMB_OFF_T size = 0; @@ -1676,8 +1675,9 @@ void reply_open(connection_struct *conn, struct smb_request *req) Reply to an open and X. ****************************************************************************/ -void reply_open_and_X(connection_struct *conn, struct smb_request *req) +void reply_open_and_X(struct smb_request *req) { + connection_struct *conn = req->conn; char *fname = NULL; uint16 open_flags; int deny_mode; @@ -1864,10 +1864,9 @@ void reply_open_and_X(connection_struct *conn, struct smb_request *req) /**************************************************************************** Reply to a SMBulogoffX. - conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_ulogoffX(connection_struct *conn, struct smb_request *req) +void reply_ulogoffX(struct smb_request *req) { user_struct *vuser; @@ -1900,8 +1899,9 @@ void reply_ulogoffX(connection_struct *conn, struct smb_request *req) Reply to a mknew or a create. ****************************************************************************/ -void reply_mknew(connection_struct *conn, struct smb_request *req) +void reply_mknew(struct smb_request *req) { + connection_struct *conn = req->conn; char *fname = NULL; int com; uint32 fattr = 0; @@ -2009,8 +2009,9 @@ void reply_mknew(connection_struct *conn, struct smb_request *req) Reply to a create temporary file. ****************************************************************************/ -void reply_ctemp(connection_struct *conn, struct smb_request *req) +void reply_ctemp(struct smb_request *req) { + connection_struct *conn = req->conn; char *fname = NULL; uint32 fattr; files_struct *fsp; @@ -2475,8 +2476,9 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, Reply to a unlink ****************************************************************************/ -void reply_unlink(connection_struct *conn, struct smb_request *req) +void reply_unlink(struct smb_request *req) { + connection_struct *conn = req->conn; char *name = NULL; uint32 dirtype; NTSTATUS status; @@ -2717,8 +2719,9 @@ normal_readbraw: Reply to a readbraw (core+ protocol). ****************************************************************************/ -void reply_readbraw(connection_struct *conn, struct smb_request *req) +void reply_readbraw(struct smb_request *req) { + connection_struct *conn = req->conn; ssize_t maxcount,mincount; size_t nread = 0; SMB_OFF_T startpos; @@ -2867,8 +2870,9 @@ void reply_readbraw(connection_struct *conn, struct smb_request *req) Reply to a lockread (core+ protocol). ****************************************************************************/ -void reply_lockread(connection_struct *conn, struct smb_request *req) +void reply_lockread(struct smb_request *req) { + connection_struct *conn = req->conn; ssize_t nread = -1; char *data; SMB_OFF_T startpos; @@ -2976,8 +2980,9 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n", Reply to a read. ****************************************************************************/ -void reply_read(connection_struct *conn, struct smb_request *req) +void reply_read(struct smb_request *req) { + connection_struct *conn = req->conn; size_t numtoread; ssize_t nread = 0; char *data; @@ -3221,8 +3226,9 @@ normal_read: Reply to a read and X. ****************************************************************************/ -void reply_read_and_X(connection_struct *conn, struct smb_request *req) +void reply_read_and_X(struct smb_request *req) { + connection_struct *conn = req->conn; files_struct *fsp; SMB_OFF_T startpos; size_t smb_maxcnt; @@ -3350,8 +3356,9 @@ void error_to_writebrawerr(struct smb_request *req) Reply to a writebraw (core+ or LANMAN1.0 protocol). ****************************************************************************/ -void reply_writebraw(connection_struct *conn, struct smb_request *req) +void reply_writebraw(struct smb_request *req) { + connection_struct *conn = req->conn; int outsize = 0; char *buf = NULL; ssize_t nwritten=0; @@ -3579,8 +3586,9 @@ void reply_writebraw(connection_struct *conn, struct smb_request *req) Reply to a writeunlock (core+). ****************************************************************************/ -void reply_writeunlock(connection_struct *conn, struct smb_request *req) +void reply_writeunlock(struct smb_request *req) { + connection_struct *conn = req->conn; ssize_t nwritten = -1; size_t numtowrite; SMB_OFF_T startpos; @@ -3678,8 +3686,9 @@ void reply_writeunlock(connection_struct *conn, struct smb_request *req) Reply to a write. ****************************************************************************/ -void reply_write(connection_struct *conn, struct smb_request *req) +void reply_write(struct smb_request *req) { + connection_struct *conn = req->conn; size_t numtowrite; ssize_t nwritten = -1; SMB_OFF_T startpos; @@ -3866,8 +3875,9 @@ bool is_valid_writeX_buffer(const uint8_t *inbuf) Reply to a write and X. ****************************************************************************/ -void reply_write_and_X(connection_struct *conn, struct smb_request *req) +void reply_write_and_X(struct smb_request *req) { + connection_struct *conn = req->conn; files_struct *fsp; SMB_OFF_T startpos; size_t numtowrite; @@ -4034,8 +4044,9 @@ void reply_write_and_X(connection_struct *conn, struct smb_request *req) Reply to a lseek. ****************************************************************************/ -void reply_lseek(connection_struct *conn, struct smb_request *req) +void reply_lseek(struct smb_request *req) { + connection_struct *conn = req->conn; SMB_OFF_T startpos; SMB_OFF_T res= -1; int mode,umode; @@ -4121,8 +4132,9 @@ void reply_lseek(connection_struct *conn, struct smb_request *req) Reply to a flush. ****************************************************************************/ -void reply_flush(connection_struct *conn, struct smb_request *req) +void reply_flush(struct smb_request *req) { + connection_struct *conn = req->conn; uint16 fnum; files_struct *fsp; @@ -4165,7 +4177,7 @@ void reply_flush(connection_struct *conn, struct smb_request *req) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_exit(connection_struct *conn, struct smb_request *req) +void reply_exit(struct smb_request *req) { START_PROFILE(SMBexit); @@ -4183,8 +4195,9 @@ void reply_exit(connection_struct *conn, struct smb_request *req) Reply to a close - has to deal with closing a directory opened by NT SMB's. ****************************************************************************/ -void reply_close(connection_struct *conn, struct smb_request *req) +void reply_close(struct smb_request *req) { + connection_struct *conn = req->conn; NTSTATUS status = NT_STATUS_OK; files_struct *fsp = NULL; START_PROFILE(SMBclose); @@ -4261,8 +4274,9 @@ void reply_close(connection_struct *conn, struct smb_request *req) Reply to a writeclose (Core+ protocol). ****************************************************************************/ -void reply_writeclose(connection_struct *conn, struct smb_request *req) +void reply_writeclose(struct smb_request *req) { + connection_struct *conn = req->conn; size_t numtowrite; ssize_t nwritten = -1; NTSTATUS close_status = NT_STATUS_OK; @@ -4350,8 +4364,9 @@ void reply_writeclose(connection_struct *conn, struct smb_request *req) Reply to a lock. ****************************************************************************/ -void reply_lock(connection_struct *conn, struct smb_request *req) +void reply_lock(struct smb_request *req) { + connection_struct *conn = req->conn; SMB_BIG_UINT count,offset; NTSTATUS status; files_struct *fsp; @@ -4409,8 +4424,9 @@ void reply_lock(connection_struct *conn, struct smb_request *req) Reply to a unlock. ****************************************************************************/ -void reply_unlock(connection_struct *conn, struct smb_request *req) +void reply_unlock(struct smb_request *req) { + connection_struct *conn = req->conn; SMB_BIG_UINT count,offset; NTSTATUS status; files_struct *fsp; @@ -4463,8 +4479,9 @@ void reply_unlock(connection_struct *conn, struct smb_request *req) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_tdis(connection_struct *conn, struct smb_request *req) +void reply_tdis(struct smb_request *req) { + connection_struct *conn = req->conn; START_PROFILE(SMBtdis); if (!conn) { @@ -4489,8 +4506,9 @@ void reply_tdis(connection_struct *conn, struct smb_request *req) conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -void reply_echo(connection_struct *conn, struct smb_request *req) +void reply_echo(struct smb_request *req) { + connection_struct *conn = req->conn; int smb_reverb; int seq_num; unsigned int data_len = smb_buflen(req->inbuf); @@ -4548,8 +4566,9 @@ void reply_echo(connection_struct *conn, struct smb_request *req) Reply to a printopen. ****************************************************************************/ -void reply_printopen(connection_struct *conn, struct smb_request *req) +void reply_printopen(struct smb_request *req) { + connection_struct *conn = req->conn; files_struct *fsp; NTSTATUS status; @@ -4590,8 +4609,9 @@ void reply_printopen(connection_struct *conn, struct smb_request *req) Reply to a printclose. ****************************************************************************/ -void reply_printclose(connection_struct *conn, struct smb_request *req) +void reply_printclose(struct smb_request *req) { + connection_struct *conn = req->conn; files_struct *fsp; NTSTATUS status; @@ -4635,8 +4655,9 @@ void reply_printclose(connection_struct *conn, struct smb_request *req) Reply to a printqueue. ****************************************************************************/ -void reply_printqueue(connection_struct *conn, struct smb_request *req) +void reply_printqueue(struct smb_request *req) { + connection_struct *conn = req->conn; int max_count; int start_index; @@ -4727,8 +4748,9 @@ void reply_printqueue(connection_struct *conn, struct smb_request *req) Reply to a printwrite. ****************************************************************************/ -void reply_printwrite(connection_struct *conn, struct smb_request *req) +void reply_printwrite(struct smb_request *req) { + connection_struct *conn = req->conn; int numtowrite; char *data; files_struct *fsp; @@ -4786,8 +4808,9 @@ void reply_printwrite(connection_struct *conn, struct smb_request *req) Reply to a mkdir. ****************************************************************************/ -void reply_mkdir(connection_struct *conn, struct smb_request *req) +void reply_mkdir(struct smb_request *req) { + connection_struct *conn = req->conn; char *directory = NULL; NTSTATUS status; SMB_STRUCT_STAT sbuf; @@ -5054,8 +5077,9 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx, Reply to a rmdir. ****************************************************************************/ -void reply_rmdir(connection_struct *conn, struct smb_request *req) +void reply_rmdir(struct smb_request *req) { + connection_struct *conn = req->conn; char *directory = NULL; SMB_STRUCT_STAT sbuf; NTSTATUS status; @@ -5838,8 +5862,9 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, Reply to a mv. ****************************************************************************/ -void reply_mv(connection_struct *conn, struct smb_request *req) +void reply_mv(struct smb_request *req) { + connection_struct *conn = req->conn; char *name = NULL; char *newname = NULL; char *p; @@ -6069,8 +6094,9 @@ NTSTATUS copy_file(TALLOC_CTX *ctx, Reply to a file copy. ****************************************************************************/ -void reply_copy(connection_struct *conn, struct smb_request *req) +void reply_copy(struct smb_request *req) { + connection_struct *conn = req->conn; char *name = NULL; char *newname = NULL; char *directory = NULL; @@ -6532,8 +6558,9 @@ SMB_BIG_UINT get_lock_offset( char *data, int data_offset, bool large_file_forma Reply to a lockingX request. ****************************************************************************/ -void reply_lockingX(connection_struct *conn, struct smb_request *req) +void reply_lockingX(struct smb_request *req) { + connection_struct *conn = req->conn; files_struct *fsp; unsigned char locktype; unsigned char oplocklevel; @@ -6890,7 +6917,7 @@ void reply_lockingX(connection_struct *conn, struct smb_request *req) please contact vl@samba.org ****************************************************************************/ -void reply_readbmpx(connection_struct *conn, struct smb_request *req) +void reply_readbmpx(struct smb_request *req) { START_PROFILE(SMBreadBmpx); reply_doserror(req, ERRSRV, ERRuseSTD); @@ -6904,7 +6931,7 @@ void reply_readbmpx(connection_struct *conn, struct smb_request *req) please contact vl@samba.org ****************************************************************************/ -void reply_readbs(connection_struct *conn, struct smb_request *req) +void reply_readbs(struct smb_request *req) { START_PROFILE(SMBreadBs); reply_doserror(req, ERRSRV, ERRuseSTD); @@ -6916,8 +6943,9 @@ void reply_readbs(connection_struct *conn, struct smb_request *req) Reply to a SMBsetattrE. ****************************************************************************/ -void reply_setattrE(connection_struct *conn, struct smb_request *req) +void reply_setattrE(struct smb_request *req) { + connection_struct *conn = req->conn; struct timespec ts[2]; files_struct *fsp; @@ -6994,7 +7022,7 @@ void reply_setattrE(connection_struct *conn, struct smb_request *req) please contact vl@samba.org ****************************************************************************/ -void reply_writebmpx(connection_struct *conn, struct smb_request *req) +void reply_writebmpx(struct smb_request *req) { START_PROFILE(SMBwriteBmpx); reply_doserror(req, ERRSRV, ERRuseSTD); @@ -7008,7 +7036,7 @@ void reply_writebmpx(connection_struct *conn, struct smb_request *req) please contact vl@samba.org ****************************************************************************/ -void reply_writebs(connection_struct *conn, struct smb_request *req) +void reply_writebs(struct smb_request *req) { START_PROFILE(SMBwriteBs); reply_doserror(req, ERRSRV, ERRuseSTD); @@ -7020,8 +7048,9 @@ void reply_writebs(connection_struct *conn, struct smb_request *req) Reply to a SMBgetattrE. ****************************************************************************/ -void reply_getattrE(connection_struct *conn, struct smb_request *req) +void reply_getattrE(struct smb_request *req) { + connection_struct *conn = req->conn; SMB_STRUCT_STAT sbuf; int mode; files_struct *fsp; diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index e44a540554..167682ede2 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -118,8 +118,7 @@ static void sessionsetup_start_signing_engine( Send a security blob via a session setup reply. ****************************************************************************/ -static void reply_sesssetup_blob(connection_struct *conn, - struct smb_request *req, +static void reply_sesssetup_blob(struct smb_request *req, DATA_BLOB blob, NTSTATUS nt_status) { @@ -247,8 +246,7 @@ static bool make_krb5_skew_error(DATA_BLOB *pblob_out) Reply to a session setup spnego negotiate packet for kerberos. ****************************************************************************/ -static void reply_spnego_kerberos(connection_struct *conn, - struct smb_request *req, +static void reply_spnego_kerberos(struct smb_request *req, DATA_BLOB *secblob, uint16 vuid, bool *p_invalidate_vuid) @@ -605,7 +603,7 @@ static void reply_spnego_kerberos(connection_struct *conn, } response = spnego_gen_auth_response(&ap_rep_wrapped, ret, OID_KERBEROS5_OLD); - reply_sesssetup_blob(conn, req, response, ret); + reply_sesssetup_blob(req, response, ret); data_blob_free(&ap_rep); data_blob_free(&ap_rep_wrapped); @@ -623,8 +621,7 @@ static void reply_spnego_kerberos(connection_struct *conn, leg of the NTLM auth steps. ***************************************************************************/ -static void reply_spnego_ntlmssp(connection_struct *conn, - struct smb_request *req, +static void reply_spnego_ntlmssp(struct smb_request *req, uint16 vuid, AUTH_NTLMSSP_STATE **auth_ntlmssp_state, DATA_BLOB *ntlmssp_blob, NTSTATUS nt_status, @@ -693,7 +690,7 @@ static void reply_spnego_ntlmssp(connection_struct *conn, response = *ntlmssp_blob; } - reply_sesssetup_blob(conn, req, response, nt_status); + reply_sesssetup_blob(req, response, nt_status); if (wrap) { data_blob_free(&response); } @@ -756,8 +753,7 @@ NTSTATUS parse_spnego_mechanisms(DATA_BLOB blob_in, DATA_BLOB *pblob_out, Reply to a session setup spnego negotiate packet. ****************************************************************************/ -static void reply_spnego_negotiate(connection_struct *conn, - struct smb_request *req, +static void reply_spnego_negotiate(struct smb_request *req, uint16 vuid, DATA_BLOB blob1, AUTH_NTLMSSP_STATE **auth_ntlmssp_state) @@ -783,7 +779,7 @@ static void reply_spnego_negotiate(connection_struct *conn, if ( got_kerberos_mechanism && ((lp_security()==SEC_ADS) || lp_use_kerberos_keytab()) ) { bool destroy_vuid = True; - reply_spnego_kerberos(conn, req, &secblob, vuid, + reply_spnego_kerberos(req, &secblob, vuid, &destroy_vuid); data_blob_free(&secblob); if (destroy_vuid) { @@ -811,7 +807,7 @@ static void reply_spnego_negotiate(connection_struct *conn, data_blob_free(&secblob); - reply_spnego_ntlmssp(conn, req, vuid, auth_ntlmssp_state, + reply_spnego_ntlmssp(req, vuid, auth_ntlmssp_state, &chal, status, True); data_blob_free(&chal); @@ -824,8 +820,7 @@ static void reply_spnego_negotiate(connection_struct *conn, Reply to a session setup spnego auth packet. ****************************************************************************/ -static void reply_spnego_auth(connection_struct *conn, - struct smb_request *req, +static void reply_spnego_auth(struct smb_request *req, uint16 vuid, DATA_BLOB blob1, AUTH_NTLMSSP_STATE **auth_ntlmssp_state) @@ -860,7 +855,7 @@ static void reply_spnego_auth(connection_struct *conn, if ( got_krb5_mechanism && ((lp_security()==SEC_ADS) || lp_use_kerberos_keytab()) ) { bool destroy_vuid = True; - reply_spnego_kerberos(conn, req, &secblob, + reply_spnego_kerberos(req, &secblob, vuid, &destroy_vuid); data_blob_free(&secblob); data_blob_free(&auth); @@ -892,7 +887,7 @@ static void reply_spnego_auth(connection_struct *conn, data_blob_free(&auth); - reply_spnego_ntlmssp(conn, req, vuid, + reply_spnego_ntlmssp(req, vuid, auth_ntlmssp_state, &auth_reply, status, True); @@ -1104,8 +1099,7 @@ static NTSTATUS check_spnego_blob_complete(uint16 smbpid, uint16 vuid, conn POINTER CAN BE NULL HERE ! ****************************************************************************/ -static void reply_sesssetup_and_X_spnego(connection_struct *conn, - struct smb_request *req) +static void reply_sesssetup_and_X_spnego(struct smb_request *req) { uint8 *p; DATA_BLOB blob1; @@ -1225,7 +1219,7 @@ static void reply_sesssetup_and_X_spnego(connection_struct *conn, /* its a negTokenTarg packet */ - reply_spnego_negotiate(conn, req, vuid, blob1, + reply_spnego_negotiate(req, vuid, blob1, &vuser->auth_ntlmssp_state); data_blob_free(&blob1); return; @@ -1235,7 +1229,7 @@ static void reply_sesssetup_and_X_spnego(connection_struct *conn, /* its a auth packet */ - reply_spnego_auth(conn, req, vuid, blob1, + reply_spnego_auth(req, vuid, blob1, &vuser->auth_ntlmssp_state); data_blob_free(&blob1); return; @@ -1260,7 +1254,7 @@ static void reply_sesssetup_and_X_spnego(connection_struct *conn, data_blob_free(&blob1); - reply_spnego_ntlmssp(conn, req, vuid, + reply_spnego_ntlmssp(req, vuid, &vuser->auth_ntlmssp_state, &chal, status, False); data_blob_free(&chal); @@ -1326,7 +1320,7 @@ static void setup_new_vc_session(void) Reply to a session setup command. ****************************************************************************/ -void reply_sesssetup_and_X(connection_struct *conn, struct smb_request *req) +void reply_sesssetup_and_X(struct smb_request *req) { int sess_vuid; int smb_bufsize; @@ -1377,7 +1371,7 @@ void reply_sesssetup_and_X(connection_struct *conn, struct smb_request *req) setup_new_vc_session(); } - reply_sesssetup_and_X_spnego(conn, req); + reply_sesssetup_and_X_spnego(req); END_PROFILE(SMBsesssetupX); return; } diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 4e2cceca36..c3b5f9fa2f 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -7001,7 +7001,7 @@ static void call_trans2ioctl(connection_struct *conn, Reply to a SMBfindclose (stop trans2 directory search). ****************************************************************************/ -void reply_findclose(connection_struct *conn, struct smb_request *req) +void reply_findclose(struct smb_request *req) { int dptr_num; @@ -7031,7 +7031,7 @@ void reply_findclose(connection_struct *conn, struct smb_request *req) Reply to a SMBfindnclose (stop FINDNOTIFYFIRST directory search). ****************************************************************************/ -void reply_findnclose(connection_struct *conn, struct smb_request *req) +void reply_findnclose(struct smb_request *req) { int dptr_num; @@ -7225,8 +7225,9 @@ static void handle_trans2(connection_struct *conn, struct smb_request *req, Reply to a SMBtrans2. ****************************************************************************/ -void reply_trans2(connection_struct *conn, struct smb_request *req) +void reply_trans2(struct smb_request *req) { + connection_struct *conn = req->conn; unsigned int dsoff; unsigned int dscnt; unsigned int psoff; @@ -7414,8 +7415,9 @@ void reply_trans2(connection_struct *conn, struct smb_request *req) Reply to a SMBtranss2 ****************************************************************************/ -void reply_transs2(connection_struct *conn, struct smb_request *req) +void reply_transs2(struct smb_request *req) { + connection_struct *conn = req->conn; unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp; struct trans_state *state; int size; -- cgit From 71a24317fe30176b22306eb87a6a2969f37e4030 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 16:09:24 -0800 Subject: Added -e option to smbtorture to test encrypted versions of the tests. Jeremy. (This used to be commit e85b346f3d73f50d6dea19ffb6cca1180345e687) --- source3/torture/torture.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 082949e0af..05b41413b4 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -37,6 +37,7 @@ static const char *client_txt = "client_oplocks.txt"; static bool use_kerberos; static fstring multishare_conn_fname; static bool use_multishare_conn = False; +static bool do_encrypt; bool torture_showall = False; @@ -95,6 +96,57 @@ void *shm_setup(int size) return ret; } +/******************************************************************** + Ensure a connection is encrypted. +********************************************************************/ + +static bool force_cli_encryption(struct cli_state *c, + const char *sharename) +{ + uint16 major, minor; + uint32 caplow, caphigh; + NTSTATUS status; + + if (!SERVER_HAS_UNIX_CIFS(c)) { + d_printf("Encryption required and " + "server that doesn't support " + "UNIX extensions - failing connect\n"); + return false; + } + + if (!cli_unix_extensions_version(c, &major, &minor, &caplow, &caphigh)) { + d_printf("Encryption required and " + "can't get UNIX CIFS extensions " + "version from server.\n"); + return false; + } + + if (!(caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)) { + d_printf("Encryption required and " + "share %s doesn't support " + "encryption.\n", sharename); + return false; + } + + if (c->use_kerberos) { + status = cli_gss_smb_encryption_start(c); + } else { + status = cli_raw_ntlm_smb_encryption_start(c, + username, + password, + workgroup); + } + + if (!NT_STATUS_IS_OK(status)) { + d_printf("Encryption required and " + "setup failed with error %s.\n", + nt_errstr(status)); + return false; + } + + return true; +} + static struct cli_state *open_nbt_connection(void) { @@ -235,6 +287,10 @@ static bool torture_open_connection_share(struct cli_state **c, if (use_level_II_oplocks) (*c)->use_level_II_oplocks = True; (*c)->timeout = 120000; /* set a really long timeout (2 minutes) */ + if (do_encrypt) { + return force_cli_encryption(*c, + sharename); + } return True; } @@ -5425,7 +5481,7 @@ static void usage(void) fstrcpy(workgroup, lp_workgroup()); - while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:m:Ld:Ac:ks:b:")) != EOF) { + while ((opt = getopt(argc, argv, "p:hW:U:n:N:O:o:m:Ld:Aec:ks:b:")) != EOF) { switch (opt) { case 'p': port_to_use = atoi(optarg); @@ -5463,6 +5519,9 @@ static void usage(void) case 'c': client_txt = optarg; break; + case 'e': + do_encrypt = true; + break; case 'k': #ifdef HAVE_KRB5 use_kerberos = True; -- cgit From 95fa10d596199c1449ee17b5199c93702c017a6f Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 16:09:48 -0800 Subject: Added -e tests for S3 smbtorture. Jeremy. (This used to be commit deeeae3ee96f7207a49e1edaa876410b77c33458) --- source3/script/tests/test_smbtorture_s3.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/script/tests/test_smbtorture_s3.sh b/source3/script/tests/test_smbtorture_s3.sh index f662eacd3e..e655381160 100755 --- a/source3/script/tests/test_smbtorture_s3.sh +++ b/source3/script/tests/test_smbtorture_s3.sh @@ -43,6 +43,8 @@ for t in $tests; do start="" name="$t" testit "$name" $VALGRIND $BINDIR/smbtorture $ADDARGS $unc -U"$username"%"$password" $t || failed=`expr $failed + 1` + echo "testing encrypted connection" + testit "$name" $VALGRIND $BINDIR/smbtorture $ADDARGS $unc -U"$username"%"$password" -e $t || failed=`expr $failed + 1` done testok $0 $failed -- cgit From c513ff3675bd38bf3e879ea862e82c7181538961 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 16:58:23 -0800 Subject: Better way of testing enc. Jeremy. (This used to be commit c5800235018330f0c1bbe307cd733597ac9b6686) --- source3/script/tests/test_smbclient_s3.sh | 8 +++++--- source3/script/tests/test_smbtorture_s3.sh | 4 +--- source3/script/tests/tests_all.sh | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index fdade5a617..8bf9cd1ec4 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -2,7 +2,7 @@ # this runs the file serving tests that are expected to pass with samba3 -if [ $# != 2 ]; then +if [ $# -lt 2 ]; then cat <&1 | \ + $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I SERVER_IP $ADDARGS 2>&1 | \ grep $prompt if [ $? = 0 ] ; then @@ -49,7 +51,7 @@ EOF CLI_FORCE_INTERACTIVE=yes \ $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP \ - < $tmpfile 2>/dev/null | \ + $ADDARGS < $tmpfile 2>/dev/null | \ grep $prompt if [ $? = 0 ] ; then diff --git a/source3/script/tests/test_smbtorture_s3.sh b/source3/script/tests/test_smbtorture_s3.sh index e655381160..acb641b9fb 100755 --- a/source3/script/tests/test_smbtorture_s3.sh +++ b/source3/script/tests/test_smbtorture_s3.sh @@ -42,9 +42,7 @@ for t in $tests; do fi start="" name="$t" - testit "$name" $VALGRIND $BINDIR/smbtorture $ADDARGS $unc -U"$username"%"$password" $t || failed=`expr $failed + 1` - echo "testing encrypted connection" - testit "$name" $VALGRIND $BINDIR/smbtorture $ADDARGS $unc -U"$username"%"$password" -e $t || failed=`expr $failed + 1` + testit "$name" $VALGRIND $BINDIR/smbtorture $unc -U"$username"%"$password" $ADDARGS $t || failed=`expr $failed + 1` done testok $0 $failed diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index 109e9c2920..c9fd748296 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -1,7 +1,11 @@ $SCRIPTDIR/test_local_s3.sh || failed=`expr $failed + $?` $SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" || failed=`expr $failed + $?` +echo testing encrypted +$SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" -e || failed=`expr $failed + $?` $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP || failed=`expr $failed + $?` +echo testing encrypted +$SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP -e || failed=`expr $failed + $?` $SCRIPTDIR/test_wbinfo_s3.sh $WORKGROUP $SERVER $USERNAME $PASSWORD || failed=`expr $failed + $?` LD_LIBRARY_PATH="$SAMBA4SHAREDDIR:$LD_LIBRARY_PATH" -- cgit From 3d40b197b0312967c8d22af73f18414a9fe053bb Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 17:15:04 -0800 Subject: Add missing patch to allow smbcacls to do krb5 auth, bug #5175 from Tom Maher . Jeremy. (This used to be commit 54ee718957b768a06e41857b96f0b5e18b3ca6a4) --- source3/utils/smbcacls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 958f8e255e..ef4254ead2 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -840,7 +840,7 @@ static struct cli_state *connect_one(const char *server, const char *share) get_cmdline_auth_info_username(), lp_workgroup(), get_cmdline_auth_info_password(), - 0, + get_cmdline_auth_info_use_kerberos() ? CLI_FULL_CONNECTION_USE_KERBEROS : 0, get_cmdline_auth_info_signing_state(), NULL))) { return c; -- cgit From ceba96c9151e211355186cf7ffea7318394c0365 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 19:09:46 -0800 Subject: Try and fix the buildfarm. There's a scripting error and I'm hoping this is it... Jeremy. (This used to be commit 0356f0efc4a18230ce7a9c0a17dc98c4242ad38d) --- source3/script/tests/test_smbclient_s3.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index 8bf9cd1ec4..c10aed0ee6 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -12,7 +12,7 @@ fi SERVER="$1" SERVER_IP="$2" SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient} $CONFIGURATION" -shift 3 +shift 2 ADDARGS="$*" incdir=`dirname $0` -- cgit From 4a95b17fd8739f3c82a17ac9cd65c0d84a0e9d63 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 19:12:29 -0800 Subject: Try and fix scripting errors. Jeremy (This used to be commit c84f2234fe0068a69fefa3c3ec219d4a95479b0c) --- source3/script/tests/tests_all.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index c9fd748296..e9a88ce125 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -1,11 +1,11 @@ $SCRIPTDIR/test_local_s3.sh || failed=`expr $failed + $?` $SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" || failed=`expr $failed + $?` -echo testing encrypted -$SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" -e || failed=`expr $failed + $?` +echo "Desting encrypted" +$SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" "-e" || failed=`expr $failed + $?` $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP || failed=`expr $failed + $?` -echo testing encrypted -$SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP -e || failed=`expr $failed + $?` +echo "Testing encrypted" +$SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP "-e" || failed=`expr $failed + $?` $SCRIPTDIR/test_wbinfo_s3.sh $WORKGROUP $SERVER $USERNAME $PASSWORD || failed=`expr $failed + $?` LD_LIBRARY_PATH="$SAMBA4SHAREDDIR:$LD_LIBRARY_PATH" -- cgit From e86fd65dcdcbff1e5fe6c3f87bd0fb44b63fa233 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 19:34:43 -0800 Subject: "Desting" -> "Testing" Jeremy. (This used to be commit c3f3ec5cd5f9ffe8d08356dfd22b1cb6943829ad) --- source3/script/tests/tests_all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index e9a88ce125..2edc025017 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -1,7 +1,7 @@ $SCRIPTDIR/test_local_s3.sh || failed=`expr $failed + $?` $SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" || failed=`expr $failed + $?` -echo "Desting encrypted" +echo "Testing encrypted" $SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" "-e" || failed=`expr $failed + $?` $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP || failed=`expr $failed + $?` echo "Testing encrypted" -- cgit From d5bd2e7000592b8256b837415c40e20f319fb07b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 22:56:06 -0800 Subject: Can't use logical operations on boolean values. Jeremy. (This used to be commit 34cd9b5b51a4209b4d970eb90bf1db0eb24a60bb) --- source3/smbd/sesssetup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index 167682ede2..bc1d26faca 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -537,7 +537,9 @@ static void reply_spnego_kerberos(struct smb_request *req, } } - server_info->was_mapped |= username_was_mapped; + if (username_was_mapped) { + server_info->was_mapped = username_was_mapped; + } /* we need to build the token for the user. make_server_info_guest() already does this */ -- cgit From c6a2292724036340f766d774e64d6738d702478d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 23:17:38 -0800 Subject: Using a bool with a logical operation. IBM checker caught. Jeremy. (This used to be commit 7f9fe7da1e25bcc730f4c4226bf77f6d39b5ace4) --- source3/smbd/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e3fae02b83..f178102fdd 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1405,7 +1405,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, } #endif /* O_SYNC */ - if (posix_open & (access_mask & FILE_APPEND_DATA)) { + if (posix_open && (access_mask & FILE_APPEND_DATA)) { flags2 |= O_APPEND; } -- cgit From 99e349b35da5ea5df0889a8eccc0c9774ecc24e9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 23:24:15 -0800 Subject: More logical operations on booleans. IBM checker. Jeremy. (This used to be commit e289a0c8592f9e5c58100ddcde2577b452725b88) --- source3/auth/auth_domain.c | 4 +++- source3/auth/auth_winbind.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c index b2c87174fd..1de9869f90 100644 --- a/source3/auth/auth_domain.c +++ b/source3/auth/auth_domain.c @@ -270,7 +270,9 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx, &info3); if (NT_STATUS_IS_OK(nt_status)) { - (*server_info)->was_mapped |= user_info->was_mapped; + if (user_info->was_mapped) { + (*server_info)->was_mapped = user_info->was_mapped; + } if ( ! (*server_info)->guest) { /* if a real user check pam account restrictions */ diff --git a/source3/auth/auth_winbind.c b/source3/auth/auth_winbind.c index 959c550524..b24aa3a75b 100644 --- a/source3/auth/auth_winbind.c +++ b/source3/auth/auth_winbind.c @@ -134,7 +134,9 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context, } if (NT_STATUS_IS_OK(nt_status)) { - (*server_info)->was_mapped |= user_info->was_mapped; + if (user_info->was_mapped) { + (*server_info)->was_mapped = user_info->was_mapped; + } } } } else if (NT_STATUS_IS_OK(nt_status)) { -- cgit From 4881ed00ca1d0ab156863c6821db670c70f5d0ea Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2008 23:26:47 -0800 Subject: More logical operation on bool. Jeremy. (This used to be commit 7e8e91aeb3795d26ae8591665981bc42d8b6122f) --- source3/nmbd/nmbd_elections.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c index bafe87c044..b50d215b91 100644 --- a/source3/nmbd/nmbd_elections.c +++ b/source3/nmbd/nmbd_elections.c @@ -336,7 +336,9 @@ bool check_elections(void) for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { struct work_record *work; for (work = subrec->workgrouplist; work; work = work->next) { - run_any_election |= work->RunningElection; + if (work->RunningElection) { + run_any_election = work->RunningElection; + } /* * Start an election if we have any chance of winning. -- cgit From 9baa97a46ebb92a5968ceba0fb5c2de51e6fa8f0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 00:23:35 -0800 Subject: Add general '-e' option to enable smb encryption on tools. Jeremy. (This used to be commit 757653966fc1384159bd2d57c5670cd8af0cae96) --- source3/client/smbspool.c | 21 ++++++++++++++- source3/include/popt_common.h | 1 + source3/lib/popt_common.c | 6 +++++ source3/lib/util.c | 14 +++++++++- source3/libsmb/clidfs.c | 58 ++++++++++++++++----------------------- source3/libsmb/clifsinfo.c | 33 +++++++++++++++++++++++ source3/rpcclient/rpcclient.c | 12 +++++++++ source3/utils/net.c | 63 +++++++++++++++++++++++++++++++++++++------ source3/utils/net_help.c | 1 + source3/utils/smbcacls.c | 37 ++++++++++++++++--------- 10 files changed, 189 insertions(+), 57 deletions(-) diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c index 4270eb4272..e7df22c2bc 100644 --- a/source3/client/smbspool.c +++ b/source3/client/smbspool.c @@ -47,7 +47,9 @@ static struct cli_state *smb_complete_connection(const char *, const char *,int static struct cli_state *smb_connect(const char *, const char *, int, const char *, const char *, const char *, const char *); static int smb_print(struct cli_state *, char *, FILE *); static char * uri_unescape_alloc(const char *); - +#if 0 +static bool smb_encrypt; +#endif /* * 'main()' - Main entry for SMB backend. @@ -468,6 +470,23 @@ static struct cli_state return NULL; } +#if 0 + /* Need to work out how to specify this on the URL. */ + if (smb_encrypt) + { + if (!cli_cm_force_encryption(cli, + username, + password, + workgroup, + share)) + { + fprintf(stderr, "ERROR: encryption setup failed\n"); + cli_shutdown(cli); + return NULL; + } + } +#endif + return cli; } diff --git a/source3/include/popt_common.h b/source3/include/popt_common.h index 1d3cc57acd..9e5503f270 100644 --- a/source3/include/popt_common.h +++ b/source3/include/popt_common.h @@ -49,6 +49,7 @@ struct user_auth_info { bool got_pass; bool use_kerberos; int signing_state; + bool smb_encrypt; }; #endif /* _POPT_COMMON_H */ diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index b3a84a6f7c..5a9d39d181 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -414,6 +414,7 @@ static void get_credentials_file(const char *file) * -N,--no-pass * -S,--signing * -P --machine-pass + * -e --encrypt */ @@ -532,6 +533,10 @@ static void popt_common_credentials_callback(poptContext con, case 'N': set_cmdline_auth_info_password(""); break; + case 'e': + set_cmdline_auth_info_smb_encrypt(); + break; + } } @@ -543,5 +548,6 @@ struct poptOption popt_common_credentials[] = { { "authentication-file", 'A', POPT_ARG_STRING, NULL, 'A', "Get the credentials from a file", "FILE" }, { "signing", 'S', POPT_ARG_STRING, NULL, 'S', "Set the client signing state", "on|off|required" }, {"machine-pass", 'P', POPT_ARG_NONE, NULL, 'P', "Use stored machine account password" }, + {"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" }, POPT_TABLEEND }; diff --git a/source3/lib/util.c b/source3/lib/util.c index 7f8a297fac..81b9fc817b 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -289,7 +289,8 @@ static struct user_auth_info cmdline_auth_info = { NULL, /* password */ false, /* got_pass */ false, /* use_kerberos */ - Undefined /* signing state */ + Undefined, /* signing state */ + false /* smb_encrypt */ }; const char *get_cmdline_auth_info_username(void) @@ -362,11 +363,22 @@ void set_cmdline_auth_info_use_krb5_ticket(void) cmdline_auth_info.got_pass = true; } +/* This should only be used by lib/popt_common.c JRA */ +bool set_cmdline_auth_info_smb_encrypt(void) +{ + cmdline_auth_info.smb_encrypt = true; +} + bool get_cmdline_auth_info_got_pass(void) { return cmdline_auth_info.got_pass; } +bool get_cmdline_auth_info_smb_encrypt(void) +{ + return cmdline_auth_info.smb_encrypt; +} + bool get_cmdline_auth_info_copy(struct user_auth_info *info) { *info = cmdline_auth_info; diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 7800d10e8b..77419b4a1a 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -72,54 +72,36 @@ static bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, Ensure a connection is encrypted. ********************************************************************/ -static bool force_cli_encryption(struct cli_state *c, +NTSTATUS cli_cm_force_encryption(struct cli_state *c, const char *username, const char *password, const char *domain, const char *sharename) { - uint16 major, minor; - uint32 caplow, caphigh; - NTSTATUS status; + NTSTATUS status = cli_force_encryption(c, + username, + password, + domain); - if (!SERVER_HAS_UNIX_CIFS(c)) { + if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_SUPPORTED)) { d_printf("Encryption required and " "server that doesn't support " "UNIX extensions - failing connect\n"); - return false; - } - - if (!cli_unix_extensions_version(c, &major, &minor, &caplow, &caphigh)) { + } else if (NT_STATUS_EQUAL(status,NT_STATUS_UNKNOWN_REVISION)) { d_printf("Encryption required and " "can't get UNIX CIFS extensions " "version from server.\n"); - return false; - } - - if (!(caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)) { + } else if (NT_STATUS_EQUAL(status,NT_STATUS_UNSUPPORTED_COMPRESSION)) { d_printf("Encryption required and " "share %s doesn't support " "encryption.\n", sharename); - return false; - } - - if (c->use_kerberos) { - status = cli_gss_smb_encryption_start(c); - } else { - status = cli_raw_ntlm_smb_encryption_start(c, - username, - password, - domain); - } - - if (!NT_STATUS_IS_OK(status)) { + } else if (!NT_STATUS_IS_OK(status)) { d_printf("Encryption required and " "setup failed with error %s.\n", nt_errstr(status)); - return false; } - return true; + return status; } /******************************************************************** @@ -281,13 +263,16 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx, return NULL; } - if (force_encrypt && !force_cli_encryption(c, + if (force_encrypt) { + status = cli_cm_force_encryption(c, username, password, lp_workgroup(), - sharename)) { - cli_shutdown(c); - return NULL; + sharename); + if (!NT_STATUS_IS_OK(status)) { + cli_shutdown(c); + return NULL; + } } DEBUG(4,(" tconx ok\n")); @@ -1035,12 +1020,15 @@ static bool cli_check_msdfs_proxy(TALLOC_CTX *ctx, return false; } - if (force_encrypt && !force_cli_encryption(cli, + if (force_encrypt) { + NTSTATUS status = cli_cm_force_encryption(cli, username, password, lp_workgroup(), - "IPC$")) { - return false; + "IPC$"); + if (!NT_STATUS_IS_OK(status)) { + return false; + } } res = cli_dfs_get_referral(ctx, cli, fullpath, &refs, &num_refs, &consumed); diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c index 107613c618..fb923378ab 100644 --- a/source3/libsmb/clifsinfo.c +++ b/source3/libsmb/clifsinfo.c @@ -634,3 +634,36 @@ NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli) return NT_STATUS_NOT_SUPPORTED; } #endif + +/******************************************************************** + Ensure a connection is encrypted. +********************************************************************/ + +NTSTATUS cli_force_encryption(struct cli_state *c, + const char *username, + const char *password, + const char *domain) +{ + uint16 major, minor; + uint32 caplow, caphigh; + + if (!SERVER_HAS_UNIX_CIFS(c)) { + return NT_STATUS_NOT_SUPPORTED; + } + + if (!cli_unix_extensions_version(c, &major, &minor, &caplow, &caphigh)) { + return NT_STATUS_UNKNOWN_REVISION; + } + + if (!(caplow & CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP)) { + return NT_STATUS_UNSUPPORTED_COMPRESSION; + } + + if (c->use_kerberos) { + return cli_gss_smb_encryption_start(c); + } + return cli_raw_ntlm_smb_encryption_start(c, + username, + password, + domain); +} diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 6f6e1e6474..dd8b911bb8 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -850,6 +850,18 @@ out_free: goto done; } + if (get_cmdline_auth_info_smb_encrypt()) { + nt_status = cli_cm_force_encryption(cli, + get_cmdline_auth_info_username(), + get_cmdline_auth_info_password(), + lp_workgroup(), + "IPC$"); + if (!NT_STATUS_IS_OK(nt_status)) { + result = 1; + goto done; + } + } + #if 0 /* COMMENT OUT FOR TESTING */ memset(cmdline_auth_info.password,'X',sizeof(cmdline_auth_info.password)); #endif diff --git a/source3/utils/net.c b/source3/utils/net.c index bf70d08d8b..59316091ba 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -88,6 +88,7 @@ int opt_testmode = False; int opt_have_ip = False; struct sockaddr_storage opt_dest_ip; +bool smb_encrypt; extern bool AllowDebugChange; @@ -178,9 +179,7 @@ NTSTATUS connect_to_service(struct cli_state **c, service_name, service_type, opt_user_name, opt_workgroup, opt_password, 0, Undefined, NULL); - if (NT_STATUS_IS_OK(nt_status)) { - return nt_status; - } else { + if (!NT_STATUS_IS_OK(nt_status)) { d_fprintf(stderr, "Could not connect to server %s\n", server_name); /* Display a nicer message depending on the result */ @@ -196,9 +195,41 @@ NTSTATUS connect_to_service(struct cli_state **c, if (NT_STATUS_V(nt_status) == NT_STATUS_V(NT_STATUS_ACCOUNT_DISABLED)) d_fprintf(stderr, "The account was disabled.\n"); - return nt_status; } + + if (smb_encrypt) { + nt_status = cli_force_encryption(*c, + opt_user_name, + opt_password, + opt_workgroup, + service_name); + + if (NT_STATUS_EQUAL(nt_status,NT_STATUS_NOT_SUPPORTED)) { + d_printf("Encryption required and " + "server that doesn't support " + "UNIX extensions - failing connect\n"); + } else if (NT_STATUS_EQUAL(nt_status,NT_STATUS_UNKNOWN_REVISION)) { + d_printf("Encryption required and " + "can't get UNIX CIFS extensions " + "version from server.\n"); + } else if (NT_STATUS_EQUAL(nt_status,NT_STATUS_UNSUPPORTED_COMPRESSION)) { + d_printf("Encryption required and " + "share %s doesn't support " + "encryption.\n", service_name); + } else if (!NT_STATUS_IS_OK(nt_status)) { + d_printf("Encryption required and " + "setup failed with error %s.\n", + nt_errstr(nt_status)); + } + + if (!NT_STATUS_IS_OK(nt_status)) { + cli_shutdown(*c); + *c = NULL; + } + } + + return nt_status; } /**************************************************************************** @@ -287,12 +318,24 @@ NTSTATUS connect_to_ipc_krb5(struct cli_state **c, SAFE_FREE(user_and_realm); - if (NT_STATUS_IS_OK(nt_status)) { - return nt_status; - } else { + if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(1,("Cannot connect to server using kerberos. Error was %s\n", nt_errstr(nt_status))); return nt_status; } + + if (smb_encrypt) { + nt_status = cli_cm_force_encryption(*c, + user_and_realm, + opt_password, + opt_workgroup, + "IPC$"); + if (!NT_STATUS_IS_OK(nt_status)) { + cli_shutdown(*c); + *c = NULL; + } + } + + return nt_status; } /** @@ -988,6 +1031,7 @@ static struct functable net_func[] = { {"port", 'p', POPT_ARG_INT, &opt_port}, {"myname", 'n', POPT_ARG_STRING, &opt_requester_name}, {"server", 'S', POPT_ARG_STRING, &opt_host}, + {"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" }, {"container", 'c', POPT_ARG_STRING, &opt_container}, {"comment", 'C', POPT_ARG_STRING, &opt_comment}, {"maxusers", 'M', POPT_ARG_INT, &opt_maxusers}, @@ -1010,7 +1054,7 @@ static struct functable net_func[] = { {"acls", 0, POPT_ARG_NONE, &opt_acls}, {"attrs", 0, POPT_ARG_NONE, &opt_attrs}, {"timestamps", 0, POPT_ARG_NONE, &opt_timestamps}, - {"exclude", 'e', POPT_ARG_STRING, &opt_exclude}, + {"exclude", 'X', POPT_ARG_STRING, &opt_exclude}, {"destination", 0, POPT_ARG_STRING, &opt_destination}, {"tallocreport", 0, POPT_ARG_NONE, &do_talloc_report}, @@ -1037,6 +1081,9 @@ static struct functable net_func[] = { net_help(argc, argv); exit(0); break; + case 'e': + smb_encrypt=true; + break; case 'I': if (!interpret_string_addr(&opt_dest_ip, poptGetOptArg(pc), 0)) { diff --git a/source3/utils/net_help.c b/source3/utils/net_help.c index 2cb601f917..908be0512a 100644 --- a/source3/utils/net_help.c +++ b/source3/utils/net_help.c @@ -48,6 +48,7 @@ int net_common_flags_usage(int argc, const char **argv) d_printf("\t-l or --long\t\t\tDisplay full information\n"); d_printf("\t-V or --version\t\t\tPrint samba version information\n"); d_printf("\t-P or --machine-pass\t\tAuthenticate as machine account\n"); + d_printf("\t-e or --encrypt\t\tEncrypt SMB transport (UNIX extended servers only)\n"); return -1; } diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index ef4254ead2..134f561760 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -822,7 +822,7 @@ static int cacl_set(struct cli_state *cli, char *filename, *******************************************************/ static struct cli_state *connect_one(const char *server, const char *share) { - struct cli_state *c; + struct cli_state *c = NULL; struct sockaddr_storage ss; NTSTATUS nt_status; zero_addr(&ss); @@ -834,20 +834,33 @@ static struct cli_state *connect_one(const char *server, const char *share) } } - if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname(), server, - &ss, 0, - share, "?????", - get_cmdline_auth_info_username(), - 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))) { - return c; - } else { + nt_status = cli_full_connection(&c, global_myname(), server, + &ss, 0, + share, "?????", + get_cmdline_auth_info_username(), + 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); + 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()) { + nt_status = cli_cm_force_encryption(c, + get_cmdline_auth_info_username(), + get_cmdline_auth_info_password(), + lp_workgroup(), + share); + if (!NT_STATUS_IS_OK(nt_status)) { + cli_shutdown(c); + c = NULL; + } + } + + return c; } /**************************************************************************** -- cgit From 160fefc71a1c0d5cc596b2291ac6e54c4d7c4c6d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 00:41:48 -0800 Subject: Fix args to cli_force_encryption. Jeremy. (This used to be commit 7b0826aeec284fb129dc1101a5eae2ca96c7cfb6) --- source3/utils/net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/utils/net.c b/source3/utils/net.c index 59316091ba..586ea2fdb6 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -202,8 +202,7 @@ NTSTATUS connect_to_service(struct cli_state **c, nt_status = cli_force_encryption(*c, opt_user_name, opt_password, - opt_workgroup, - service_name); + opt_workgroup); if (NT_STATUS_EQUAL(nt_status,NT_STATUS_NOT_SUPPORTED)) { d_printf("Encryption required and " -- cgit From 722d288d211de98d3fc55a9ce4521296d7fb6f77 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 00:46:04 -0800 Subject: Use the common -e option not the custom one. Jeremy. (This used to be commit ef1bbcdfb98da185c07005dd7810039f99f0685f) --- source3/client/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/client/client.c b/source3/client/client.c index a5e4a3863a..46f056021e 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4598,7 +4598,6 @@ static int do_message_op(void) { "port", 'p', POPT_ARG_INT, &port, 'p', "Port to connect to", "PORT" }, { "grepable", 'g', POPT_ARG_NONE, NULL, 'g', "Produce grepable output" }, { "browse", 'B', POPT_ARG_NONE, NULL, 'B', "Browse SMB servers using DNS" }, - { "encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" }, POPT_COMMON_SAMBA POPT_COMMON_CONNECTION POPT_COMMON_CREDENTIALS @@ -4834,6 +4833,7 @@ static int do_message_op(void) calling_name = talloc_strdup(frame, global_myname() ); } + smb_encrypt = get_cmdline_auth_info_smb_encrypt(); init_names(); if(new_name_resolve_order) -- cgit From a41972e8012d5028ff19721a869a3c2322c48158 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 00:50:03 -0800 Subject: Fix -e for smbcquotas. Jeremy. (This used to be commit f97b1247c1053f47aef64be95ab9b3c3d8702c8a) --- source3/utils/smbcquotas.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c index e6aa5e86cf..508a2dc8ca 100644 --- a/source3/utils/smbcquotas.c +++ b/source3/utils/smbcquotas.c @@ -380,20 +380,33 @@ static struct cli_state *connect_one(const char *share) } } - if (NT_STATUS_IS_OK(nt_status = cli_full_connection(&c, global_myname(), server, - &ss, 0, - share, "?????", - get_cmdline_auth_info_username(), - lp_workgroup(), - get_cmdline_auth_info_password(), - 0, - get_cmdline_auth_info_signing_state(), - NULL))) { - return c; - } else { + nt_status = cli_full_connection(&c, global_myname(), server, + &ss, 0, + share, "?????", + get_cmdline_auth_info_username(), + lp_workgroup(), + get_cmdline_auth_info_password(), + 0, + get_cmdline_auth_info_signing_state(), + 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()) { + nt_status = cli_cm_force_encryption(c, + get_cmdline_auth_info_username(), + get_cmdline_auth_info_password(), + lp_workgroup(), + share); + if (!NT_STATUS_IS_OK(nt_status)) { + cli_shutdown(c); + return NULL; + } + } + + return c; } /**************************************************************************** -- cgit From 1be3fcbf2f897b559bf72b72d54aa40805abd819 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 00:51:18 -0800 Subject: Add the options smb_encrypt_level to set the requested encrypt level and smb_encrypt_on to query it. Jeremy. (This used to be commit 07d47996f9535731ccdc1792c405c8bee1a082ae) --- source3/include/libsmb_internal.h | 7 +++ source3/libsmb/libsmbclient.c | 98 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index 19a3edc9bf..dbc115429b 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -106,6 +106,13 @@ struct smbc_internal_data { * and retrieved with smbc_option_set() and smbc_option_get(). */ void * _user_data; + + /* + * Should we attempt UNIX smb encryption ? + * Set to 0 if we should never attempt, set to 1 if + * encryption requested, set to 2 if encryption required. + */ + int _smb_encryption_level; }; diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 2ff2830256..da8f1e332b 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -6,6 +6,7 @@ Copyright (C) John Terpstra 2000 Copyright (C) Tom Jansen (Ninja ISD) 2002 Copyright (C) Derrell Lipman 2003, 2004 + Copyright (C) Jeremy Allison 2007, 2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -739,6 +740,12 @@ smbc_server(SMBCCTX *context, password, strlen(password)+1); } + /* + * We don't need to renegotiate encryption + * here as the encryption context is not per + * tid. + */ + if (! cli_send_tconX(srv->cli, share, "?????", password, strlen(password)+1)) { @@ -903,6 +910,30 @@ smbc_server(SMBCCTX *context, DEBUG(4,(" tconx ok\n")); + if (context->internal->_smb_encryption_level) { + /* Attempt UNIX smb encryption. */ + if (!NT_STATUS_IS_OK(cli_force_encryption(c, + username_used, + password, + workgroup))) { + + /* + * context->internal->_smb_encryption_level == 1 + * means don't fail if encryption can't be negotiated, + * == 2 means fail if encryption can't be negotiated. + */ + + DEBUG(4,(" SMB encrypt failed\n")); + + if (context->internal->_smb_encryption_level == 2) { + cli_shutdown(c); + errno = EPERM; + return NULL; + } + } + DEBUG(4,(" SMB encrypt ok\n")); + } + /* * Ok, we have got a nice connection * Let's allocate a server structure. @@ -1019,6 +1050,30 @@ smbc_attr_server(SMBCCTX *context, return NULL; } + if (context->internal->_smb_encryption_level) { + /* Attempt UNIX smb encryption. */ + if (!NT_STATUS_IS_OK(cli_force_encryption(ipc_cli, + username, + password, + workgroup))) { + + /* + * context->internal->_smb_encryption_level == 1 + * means don't fail if encryption can't be negotiated, + * == 2 means fail if encryption can't be negotiated. + */ + + DEBUG(4,(" SMB encrypt failed on IPC$\n")); + + if (context->internal->_smb_encryption_level == 2) { + cli_shutdown(ipc_cli); + errno = EPERM; + return NULL; + } + } + DEBUG(4,(" SMB encrypt ok on IPC$\n")); + } + ipc_srv = SMB_MALLOC_P(SMBCSRV); if (!ipc_srv) { errno = ENOMEM; @@ -6724,6 +6779,7 @@ smbc_option_set(SMBCCTX *context, bool b; smbc_get_auth_data_with_context_fn auth_fn; void *v; + const char *s; } option_value; va_start(ap, option_name); @@ -6772,6 +6828,19 @@ smbc_option_set(SMBCCTX *context, */ option_value.v = va_arg(ap, void *); context->internal->_user_data = option_value.v; + } else if (strcmp(option_name, "smb_encrypt_level") == 0) { + /* + * Save an encoded value for encryption level. + * 0 = off, 1 = attempt, 2 = required. + */ + option_value.s = va_arg(ap, const char *); + if (strcmp(option_value.s, "none") == 0) { + context->internal->_smb_encryption_level = 0; + } else if (strcmp(option_value.s, "request") == 0) { + context->internal->_smb_encryption_level = 1; + } else if (strcmp(option_value.s, "require") == 0) { + context->internal->_smb_encryption_level = 2; + } } va_end(ap); @@ -6821,6 +6890,35 @@ smbc_option_get(SMBCCTX *context, * with smbc_option_get() */ return context->internal->_user_data; + } else if (strcmp(option_name, "smb_encrypt_level") == 0) { + /* + * Return the current smb encrypt negotiate option as a string. + */ + switch (context->internal->_smb_encryption_level) { + case 0: + return (void *) "none"; + case 1: + return (void *) "request"; + case 2: + return (void *) "require"; + } + } else if (strcmp(option_name, "smb_encrypt_on") == 0) { + /* + * Return the current smb encrypt status option as a bool. + * false = off, true = on. We don't know what server is + * being requested, so we only return true if all servers + * are using an encrypted connection. + */ + SMBCSRV *s; + unsigned int num_servers = 0; + + for (s = context->internal->_servers; s; s = s->next) { + num_servers++; + if (s->cli->trans_enc_state == NULL) { + return (void *)false; + } + } + return (void *) (bool) (num_servers > 0); } return NULL; -- cgit From af2a75ba61b754f30430df9b271e99d05c2cd1b2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 00:51:50 -0800 Subject: Add -e to smbget. Jeremy. (This used to be commit 0475bdcf44d21bbdefb57f15d403c91c44d8d90a) --- source3/utils/smbget.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source3/utils/smbget.c b/source3/utils/smbget.c index ac662e6ace..63b7f48626 100644 --- a/source3/utils/smbget.c +++ b/source3/utils/smbget.c @@ -521,9 +521,11 @@ int main(int argc, const char **argv) int c = 0; const char *file = NULL; char *rcfile = NULL; + bool smb_encrypt = false; TALLOC_CTX *frame = talloc_stackframe(); struct poptOption long_options[] = { {"guest", 'a', POPT_ARG_NONE, NULL, 'a', "Work as user guest" }, + {"encrypt", 'e', POPT_ARG_NONE, NULL, 'e', "Encrypt SMB transport (UNIX extended servers only)" }, {"resume", 'r', POPT_ARG_NONE, &_resume, 0, "Automatically resume aborted files" }, {"recursive", 'R', POPT_ARG_NONE, &_recursive, 0, "Recursively download files" }, {"username", 'u', POPT_ARG_STRING, &username, 'u', "Username to use" }, @@ -568,6 +570,9 @@ int main(int argc, const char **argv) case 'a': username = ""; password = ""; break; + case 'e': + smb_encrypt = true; + break; } } @@ -586,6 +591,13 @@ int main(int argc, const char **argv) return 1; } + if (smb_encrypt) { + SMBCCTX *smb_ctx = smbc_set_context(NULL); + smbc_option_set(smb_ctx, + CONST_DISCARD(char *, "smb_encrypt_level"), + "require"); + } + columns = get_num_cols(); total_start_time = time(NULL); -- cgit From 3d7a8a9fa14625279bcce03654465a88afe6db86 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 01:16:09 -0800 Subject: Fix missing return - should be void. Jeremy. (This used to be commit 45ae90b77e53cd0cdf50939528dac4d2ca39b5c5) --- source3/lib/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/util.c b/source3/lib/util.c index 81b9fc817b..c69a1450a0 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -364,7 +364,7 @@ void set_cmdline_auth_info_use_krb5_ticket(void) } /* This should only be used by lib/popt_common.c JRA */ -bool set_cmdline_auth_info_smb_encrypt(void) +void set_cmdline_auth_info_smb_encrypt(void) { cmdline_auth_info.smb_encrypt = true; } -- cgit From 4a413e4bd177402a1697cffac43d35e94cc55102 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 5 Jan 2008 01:17:33 -0800 Subject: Fix %d / size_t printf arg missmatch. Jeremy. (This used to be commit 3e3205309b75edf7d29633525adfdceb5f8856eb) --- source3/smbd/blocking.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 41963166f7..4e0d5289f8 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -238,9 +238,9 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck, set_lock_msg = True; } - DEBUG(3,("push_blocking_lock_request: lock request length=%d blocked with " + DEBUG(3,("push_blocking_lock_request: lock request length=%u blocked with " "expiry time (%u sec. %u usec) (+%d msec) for fnum = %d, name = %s\n", - length, (unsigned int)blr->expire_time.tv_sec, + (unsigned int)length, (unsigned int)blr->expire_time.tv_sec, (unsigned int)blr->expire_time.tv_usec, lock_timeout, blr->fsp->fnum, blr->fsp->fsp_name )); -- cgit From 3ba8fbef29aabfcd78e1170fcbfcf7bc943af6f9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 5 Jan 2008 23:09:25 +0100 Subject: selftest: Use platform-specific equivalents of LD_LIBRARY_PATH for Samba4's smbtorture. (This used to be commit 64ff1dad8664f14030c7d78c252d946216798a88) --- source3/Makefile.in | 7 +- source3/configure.in | 2 + source3/lib/replace/libreplace_ld.m4 | 167 ++++++++++++++++++++++++++++++++--- 3 files changed, 161 insertions(+), 15 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 53f7bf3dc4..ec28b3bb22 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -21,6 +21,7 @@ smbtorture4_path=@smbtorture4_path@ LIBS=@LIBS@ CC=@CC@ SHLD=@SHLD@ +LIB_PATH_VAR=@LIB_PATH_VAR@ ## Dynamic shared libraries build settings DSO_EXPORTS_CMD=-Wl,--version-script,$(srcdir)/exports/`basename $@ | sed 's/@SHLIBEXT@$$/syms/'` @@ -2145,16 +2146,18 @@ test_pam_modules: pam_modules || exit 1; \ done + ## ## Targets for 'make test' ## test: all torture timelimit @echo Running Test suite - @PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix}/st all "${smbtorture4_path}" + @$(LIB_PATH_VAR)=`dirname ${smbtorture4_path}`/shared PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix}/st all "${smbtorture4_path}" valgrindtest: all torture timelimit @echo Running Test suite with valgrind - @NMBD_VALGRIND="xterm -n nmbd -e valgrind -q --db-attach=yes --num-callers=30" \ + @$(LIB_PATH_VAR)=`dirname ${smbtorture4_path}`/shared \ + NMBD_VALGRIND="xterm -n nmbd -e valgrind -q --db-attach=yes --num-callers=30" \ WINBINDD_VALGRIND="xterm -n winbindd -e valgrind -q --db-attach=yes --num-callers=30" \ SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \ VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/st/valgrind.log" \ diff --git a/source3/configure.in b/source3/configure.in index 1906d74505..0036133230 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -2037,6 +2037,8 @@ AC_MSG_RESULT([$PICFLAG]) AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension]) +AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR + ################ AC_CACHE_CHECK([for long long],samba_cv_have_longlong,[ diff --git a/source3/lib/replace/libreplace_ld.m4 b/source3/lib/replace/libreplace_ld.m4 index fd85ef9fc4..cb8e21434e 100644 --- a/source3/lib/replace/libreplace_ld.m4 +++ b/source3/lib/replace/libreplace_ld.m4 @@ -1,3 +1,23 @@ +# +# This offers a nice overview how to build shared libraries on all platforms +# http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html +# + +AC_DEFUN([AC_LIBREPLACE_STLD], +[ + AC_PATH_PROG(PROG_AR, ar) + + STLD=${PROG_AR} + + AC_SUBST(STLD) +]) + +AC_DEFUN([AC_LIBREPLACE_STLD_FLAGS], +[ + STLD_FLAGS="-rcs" + AC_SUBST(STLD_FLAGS) +]) + AC_DEFUN([AC_LD_EXPORT_DYNAMIC], [ saved_LDFLAGS="$LDFLAGS" @@ -67,48 +87,102 @@ case "$host_os" in PICFLAG="-KPIC" ;; *darwin*) + PICFLAG="-fno-common" ;; esac AC_SUBST(PICFLAG) ]) -AC_DEFUN([AC_LD_SHLDFLAGS], +AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_LINKER], +[ + LD_SHLIB_LINKER="${CC}" + + case "$host_os" in + *irix*) + LD_SHLIB_LINKER="${PROG_LD}" + ;; + esac + + AC_SUBST(LD_SHLIB_LINKER) +]) + +AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_FLAGS], [ - SHLD_FLAGS="-shared" + LD_SHLIB_FLAGS="-shared" case "$host_os" in *linux*) - SHLD_FLAGS="-shared -Wl,-Bsymbolic" + LD_SHLIB_FLAGS="-shared -Wl,-Bsymbolic" ;; *solaris*) - SHLD_FLAGS="-G" + LD_SHLIB_FLAGS="-G" if test "${GCC}" = "no"; then ## ${CFLAGS} added for building 64-bit shared ## libs using Sun's Compiler - SHLD_FLAGS="-G \${CFLAGS}" + LD_SHLIB_FLAGS="-G \${CFLAGS}" fi ;; *sunos*) - SHLD_FLAGS="-G" + LD_SHLIB_FLAGS="-G" ;; *irix*) - SHLD_FLAGS="-shared" + LD_SHLIB_FLAGS="-shared" ;; *aix*) - SHLD_FLAGS="-Wl,-G,-bexpall,-bbigtoc" + LD_SHLIB_FLAGS="-Wl,-G,-bexpall,-bbigtoc" ;; *hpux*) if test "${GCC}" = "yes"; then - SHLD_FLAGS="-shared" + LD_SHLIB_FLAGS="-shared" else - SHLD_FLAGS="-b" + LD_SHLIB_FLAGS="-b" fi ;; + *osf*) + LD_SHLIB_FLAGS="-shared" + ;; *darwin*) - SHLD_FLAGS="-dynamiclib" + LD_SHLIB_FLAGS="-dynamiclib -Wl,-search_paths_first" ;; esac + AC_SUBST(LD_SHLIB_FLAGS) +]) + +AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_DISALLOW_UNDEF_FLAG], +[ + LD_SHLIB_DISALLOW_UNDEF_FLAG="" + + # + # TODO: enforce error not only warnings + # + # NOTE: -Wl,--no-allow-shlib-undefined isn't what we want... + # as it bails out on broken system libraries + # + case "$host_os" in + *osf*) + LD_SHLIB_DISALLOW_UNDEF_FLAG="-warning_unresolved" + ;; + *darwin*) + LD_SHLIB_DISALLOW_UNDEF_FLAG="-undefined error" + ;; + esac + + AC_SUBST(LD_SHLIB_DISALLOW_UNDEF_FLAG) +]) + +AC_DEFUN([AC_LIBREPLACE_SHLD], +[ + AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_LINKER]) + SHLD="$LD_SHLIB_LINKER" + AC_SUBST(SHLD) +]) + +AC_DEFUN([AC_LIBREPLACE_SHLD_FLAGS], +[ + AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_FLAGS]) + AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_DISALLOW_UNDEF_FLAG]) + SHLD_FLAGS="$LD_SHLIB_FLAGS $LD_SHLIB_DISALLOW_UNDEF_FLAG" AC_SUBST(SHLD_FLAGS) ]) @@ -157,7 +231,7 @@ AC_DEFUN([AC_LD_SONAMEFLAG], SONAMEFLAG="-Wl,-soname," ;; *hpux*) - SONAMEFLAG="-Wl,+h " + SONAMEFLAG="-Wl,+h," ;; *osf*) SONAMEFLAG="-Wl,-soname," @@ -166,7 +240,74 @@ AC_DEFUN([AC_LD_SONAMEFLAG], SONAMEFLAG="-Wl,-soname," ;; *darwin*) - SONAMEFLAG="-install_name " + SONAMEFLAG="#" + ;; + *aix*) + # Not supported + SONAMEFLAG="#" ;; esac ]) + +AC_DEFUN([AC_LIBREPLACE_MDLD], +[ + AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_LINKER]) + MDLD="$LD_SHLIB_LINKER" + AC_SUBST(MDLD) +]) + +AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG], +[ + LD_ALLOW_SHLIB_UNDEF_FLAG="" + + case "$host_os" in + *linux*) + LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,--allow-shlib-undefined" + ;; + *osf*) + LD_SHLIB_ALLOW_UNDEF_FLAG="-expect_unresolved '*'" + ;; + *darwin*) + LD_SHLIB_ALLOW_UNDEF_FLAG="-undefined dynamic_lookup" + ;; + esac + + AC_SUBST(LD_SHLIB_ALLOW_UNDEF_FLAG) +]) + +AC_DEFUN([AC_LIBREPLACE_MDLD_FLAGS], +[ + AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_FLAGS]) + AC_REQUIRE([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG]) + MDLD_FLAGS="$LD_SHLIB_FLAGS $LD_SHLIB_ALLOW_UNDEF_FLAG" + AC_SUBST(MDLD_FLAGS) +]) + +AC_DEFUN([AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR], +[ + case "$host_os" in + *linux*) + LIB_PATH_VAR=LD_LIBRARY_PATH + ;; + *solaris*) + LIB_PATH_VAR=LD_LIBRARY_PATH + ;; + *hpux*) + LIB_PATH_VAR=SHLIB_PATH + ;; + *osf*) + LIB_PATH_VAR=LD_LIBRARY_PATH + ;; + *aix*) + LIB_PATH_VAR=LIB_PATH + ;; + *irix*) + LIB_PATH_VAR=LD_LIBRARY_PATH + ;; + *darwin*) + LIB_PATH_VAR=DYLD_LIBRARY_PATH + ;; + esac + + AC_SUBST(LIB_PATH_VAR) +]) -- cgit From 1f46aac357b986405215ea7cbf9a1c971a2482d0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 6 Jan 2008 01:12:56 +0100 Subject: Use metze's approach. (This used to be commit 126cc075995ffaeb65317627acae05c1b96cebd0) --- source3/Makefile.in | 4 ++-- source3/script/tests/tests_all.sh | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 2214292854..b10425b934 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -2161,11 +2161,11 @@ test_pam_modules: pam_modules ## test: all torture timelimit @echo Running Test suite - @$(LIB_PATH_VAR)=`dirname ${smbtorture4_path}`/shared PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix}/st all "${smbtorture4_path}" + @LIB_PATH_VAR=$(LIB_PATH_VAR) PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix}/st all "${smbtorture4_path}" valgrindtest: all torture timelimit @echo Running Test suite with valgrind - @$(LIB_PATH_VAR)=`dirname ${smbtorture4_path}`/shared \ + @LIB_PATH_VAR=$(LIB_PATH_VAR) \ NMBD_VALGRIND="xterm -n nmbd -e valgrind -q --db-attach=yes --num-callers=30" \ WINBINDD_VALGRIND="xterm -n winbindd -e valgrind -q --db-attach=yes --num-callers=30" \ SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \ diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index 2edc025017..3871b33944 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -1,4 +1,3 @@ - $SCRIPTDIR/test_local_s3.sh || failed=`expr $failed + $?` $SCRIPTDIR/test_smbtorture_s3.sh //$SERVER_IP/tmp $USERNAME $PASSWORD "" || failed=`expr $failed + $?` echo "Testing encrypted" @@ -8,9 +7,8 @@ echo "Testing encrypted" $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP "-e" || failed=`expr $failed + $?` $SCRIPTDIR/test_wbinfo_s3.sh $WORKGROUP $SERVER $USERNAME $PASSWORD || failed=`expr $failed + $?` -LD_LIBRARY_PATH="$SAMBA4SHAREDDIR:$LD_LIBRARY_PATH" -echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" -export LD_LIBRARY_PATH +eval "$LIB_PATH_VAR="\$SAMBA4SHAREDDIR:\$LIB_PATH_VAR"; export $LIB_PATH_VAR" +echo "$LIB_PATH_VAR=$LD_LIBRARY_PATH" SMBTORTURE4VERSION=`$SMBTORTURE4 --version` if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then echo "Running Tests with Samba4's smbtorture" @@ -19,3 +17,4 @@ if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then else echo "Skip Tests with Samba4's smbtorture" fi + -- cgit From 8dbeca6e9d06d573adebe8d9c5114b24d8782e43 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 6 Jan 2008 15:12:24 +0100 Subject: Review feedback from metze. (This used to be commit 015cf6b6adfa87ff7c5bb1cec9f98237bad075e1) --- source3/script/tests/tests_all.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index 3871b33944..259e28e6e7 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -7,8 +7,8 @@ echo "Testing encrypted" $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP "-e" || failed=`expr $failed + $?` $SCRIPTDIR/test_wbinfo_s3.sh $WORKGROUP $SERVER $USERNAME $PASSWORD || failed=`expr $failed + $?` -eval "$LIB_PATH_VAR="\$SAMBA4SHAREDDIR:\$LIB_PATH_VAR"; export $LIB_PATH_VAR" -echo "$LIB_PATH_VAR=$LD_LIBRARY_PATH" +eval "$LIB_PATH_VAR="\$SAMBA4SHAREDDIR:\$$LIB_PATH_VAR"; export $LIB_PATH_VAR" +eval echo "$LIB_PATH_VAR=\$$LIB_PATH_VAR" SMBTORTURE4VERSION=`$SMBTORTURE4 --version` if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then echo "Running Tests with Samba4's smbtorture" @@ -17,4 +17,3 @@ if [ -n "$SMBTORTURE4" -a -n "$SMBTORTURE4VERSION" ];then else echo "Skip Tests with Samba4's smbtorture" fi - -- cgit From ac8659232b07bf61a88069f963beb535a296fa52 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 6 Jan 2008 22:50:38 +0100 Subject: Remove vlp.o in make clean. Michael (This used to be commit 020ed731b17ac00dd490f210f108eae249fb27ad) --- source3/Makefile.in | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/Makefile.in b/source3/Makefile.in index 2267be4680..3e02b894f9 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1992,6 +1992,7 @@ clean: delheaders -rm -f $(PRECOMPILED_HEADER) -rm -f core */*~ *~ \ */*.o */*/*.o */*/*/*.o \ + ../testsuite/*/*.o \ */*.@SHLIBEXT@ */*/*.@SHLIBEXT@ */*/*/*.@SHLIBEXT@ \ $(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(ROOT_SBIN_PROGS) \ $(MODULES) $(TORTURE_PROGS) $(LIBSMBCLIENT) $(LIBADDNS) \ -- cgit From ee24c629a68e13764f78064121a6aea3d0e9240c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 5 Jan 2008 02:16:15 +0100 Subject: Remove superfluous fd parameter from SMB_VFS_FGET_NT_ACL(). Michael (This used to be commit c0c7c1223da29c68359dac64a340c1c710d5f3d2) --- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_afsacl.c | 2 +- source3/modules/vfs_aixacl2.c | 2 +- source3/modules/vfs_default.c | 2 +- source3/modules/vfs_full_audit.c | 7 +++---- source3/modules/vfs_gpfs.c | 2 +- source3/modules/vfs_zfsacl.c | 2 +- source3/smbd/dir.c | 4 ++-- source3/smbd/nttrans.c | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 5a3ec58b7a..83dff133cf 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -77,6 +77,7 @@ /* Leave at 22 - not yet released. Change get_nt_acl to return NTSTATUS - vl */ /* Leave at 22 - not yet released. Change get_nt_acl to *not* take a * files_struct. - obnox.*/ +/* Leave at 22 - not yet released. Remove parameter fd from fget_nt_acl. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -310,7 +311,7 @@ struct vfs_ops { /* NT ACL operations. */ NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, + struct files_struct *fsp, uint32 security_info, struct security_descriptor **ppdesc); NTSTATUS (*get_nt_acl)(struct vfs_handle_struct *handle, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index c31d6cfc67..4c06cc23b6 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -84,7 +84,7 @@ #define SMB_VFS_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops.file_id_create((conn)->vfs.handles.file_id_create, (dev), (inode))) /* NT ACL operations. */ -#define SMB_VFS_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc))) +#define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) #define SMB_VFS_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs.ops.get_nt_acl((conn)->vfs.handles.get_nt_acl, (name), (security_info), (ppdesc))) #define SMB_VFS_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) #define SMB_VFS_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs.ops.set_nt_acl((fsp)->conn->vfs.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) @@ -203,7 +203,7 @@ #define SMB_VFS_OPAQUE_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops_opaque.file_id_create((conn)->vfs_opaque.handles.file_id_create, (dev), (inode))) /* NT ACL operations. */ -#define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc))) +#define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) #define SMB_VFS_OPAQUE_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs_opaque.ops.get_nt_acl((conn)->vfs_opaque.handles.get_nt_acl, (name), (security_info), (ppdesc))) #define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) #define SMB_VFS_OPAQUE_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.set_nt_acl((fsp)->conn->vfs_opaque.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) @@ -323,7 +323,7 @@ #define SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode) ((handle)->vfs_next.ops.file_id_create((handle)->vfs_next.handles.file_id_create, (dev), (inode))) /* NT ACL operations. */ -#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc))) +#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) #define SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc) ((handle)->vfs_next.ops.get_nt_acl((handle)->vfs_next.handles.get_nt_acl, (name), (security_info), (ppdesc))) #define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) #define SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd) ((handle)->vfs_next.ops.set_nt_acl((handle)->vfs_next.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index a14a117229..cdfac3eece 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -993,7 +993,7 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle, struct files_struct *fsp, - int fd, uint32 security_info, + uint32 security_info, struct security_descriptor **ppdesc) { struct afs_acl acl; diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index d28efa55c6..9ea8414f79 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -159,7 +159,7 @@ static bool aixjfs2_get_nfs4_acl(const char *name, } static NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle, - files_struct *fsp, int fd, uint32 security_info, + files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) { SMB4ACL_T *pacl = NULL; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 17b183600a..b31bc19815 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -944,7 +944,7 @@ static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle, S } static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle, - files_struct *fsp, int fd, + files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) { NTSTATUS result; diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index f6b6e85837..8f90e0de87 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -191,7 +191,7 @@ static int smb_full_audit_chflags(vfs_handle_struct *handle, static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode); static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 security_info, + uint32 security_info, SEC_DESC **ppdesc); static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info, @@ -1525,13 +1525,12 @@ static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *ha } static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 security_info, + uint32 security_info, SEC_DESC **ppdesc) { NTSTATUS result; - result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, - ppdesc); + result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc); do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 24ca3d5e42..21e5a6bcfa 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -227,7 +227,7 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl) } static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle, - files_struct *fsp, int fd, uint32 security_info, + files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) { SMB4ACL_T *pacl = NULL; diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 060d64cffb..6bf8352efd 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -174,7 +174,7 @@ static NTSTATUS zfs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle, struct files_struct *fsp, - int fd, uint32 security_info, + uint32 security_info, struct security_descriptor **ppdesc) { SMB4ACL_T *pacl; diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index ccf91fe57d..ab6e12f20f 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -948,7 +948,7 @@ static bool user_can_read_file(connection_struct *conn, char *name, SMB_STRUCT_S } /* Get NT ACL -allocated in main loop talloc context. No free needed here. */ - status = SMB_VFS_FGET_NT_ACL(fsp, fsp->fh->fd, + status = SMB_VFS_FGET_NT_ACL(fsp, (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION), &psd); close_file(fsp, NORMAL_CLOSE); @@ -1007,7 +1007,7 @@ static bool user_can_write_file(connection_struct *conn, char *name, SMB_STRUCT_ } /* Get NT ACL -allocated in main loop talloc context. No free needed here. */ - status = SMB_VFS_FGET_NT_ACL(fsp, fsp->fh->fd, + status = SMB_VFS_FGET_NT_ACL(fsp, (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION), &psd); close_file(fsp, NORMAL_CLOSE); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index a51f3afd82..e7f9f0d36c 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -1643,7 +1643,7 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, } else { if (fsp->fh->fd != -1) { status = SMB_VFS_FGET_NT_ACL( - fsp, fsp->fh->fd, security_info_wanted, &psd); + fsp, security_info_wanted, &psd); } else { status = SMB_VFS_GET_NT_ACL( -- cgit From b55171c1d7ae7d8f3218086fe14cc258065f9a41 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 6 Jan 2008 18:03:33 +0100 Subject: Wrap lines for readability. Michael (This used to be commit 8fce247bcf7fb27a31a7b8103377681d692d35aa) --- source3/include/vfs.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 83dff133cf..2f90c018bf 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -318,8 +318,16 @@ struct vfs_ops { const char *name, uint32 security_info, struct security_descriptor **ppdesc); - NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor *psd); - NTSTATUS (*set_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor *psd); + NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle, + struct files_struct *fsp, + int fd, + uint32 security_info_sent, + struct security_descriptor *psd); + NTSTATUS (*set_nt_acl)(struct vfs_handle_struct *handle, + struct files_struct *fsp, + const char *name, + uint32 security_info_sent, + struct security_descriptor *psd); /* POSIX ACL operations. */ -- cgit From 05352cf2cb7f9710444d340f3f14ac6917fb0416 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 6 Jan 2008 18:48:02 +0100 Subject: Remove superfluous parameter fd from SMB_VFS_FSET_NT_ACL(). Michael (This used to be commit 4f2d139a186048f08180378a877b69d2f80ad51f) --- source3/include/vfs.h | 2 +- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_afsacl.c | 2 +- source3/modules/vfs_aixacl2.c | 2 +- source3/modules/vfs_default.c | 2 +- source3/modules/vfs_full_audit.c | 7 +++---- source3/modules/vfs_gpfs.c | 2 +- source3/modules/vfs_zfsacl.c | 2 +- source3/smbd/nttrans.c | 3 +-- source3/smbd/open.c | 3 +-- 10 files changed, 14 insertions(+), 17 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 2f90c018bf..038da297ab 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -78,6 +78,7 @@ /* Leave at 22 - not yet released. Change get_nt_acl to *not* take a * files_struct. - obnox.*/ /* Leave at 22 - not yet released. Remove parameter fd from fget_nt_acl. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from gset_nt_acl. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -320,7 +321,6 @@ struct vfs_ops { struct security_descriptor **ppdesc); NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, - int fd, uint32 security_info_sent, struct security_descriptor *psd); NTSTATUS (*set_nt_acl)(struct vfs_handle_struct *handle, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 4c06cc23b6..45c5353657 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -86,7 +86,7 @@ /* NT ACL operations. */ #define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) #define SMB_VFS_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs.ops.get_nt_acl((conn)->vfs.handles.get_nt_acl, (name), (security_info), (ppdesc))) -#define SMB_VFS_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) +#define SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (security_info_sent), (psd))) #define SMB_VFS_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs.ops.set_nt_acl((fsp)->conn->vfs.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) /* POSIX ACL operations. */ @@ -205,7 +205,7 @@ /* NT ACL operations. */ #define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) #define SMB_VFS_OPAQUE_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs_opaque.ops.get_nt_acl((conn)->vfs_opaque.handles.get_nt_acl, (name), (security_info), (ppdesc))) -#define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, fd, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) +#define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (security_info_sent), (psd))) #define SMB_VFS_OPAQUE_SET_NT_ACL(fsp, name, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.set_nt_acl((fsp)->conn->vfs_opaque.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) /* POSIX ACL operations. */ @@ -325,7 +325,7 @@ /* NT ACL operations. */ #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) #define SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc) ((handle)->vfs_next.ops.get_nt_acl((handle)->vfs_next.handles.get_nt_acl, (name), (security_info), (ppdesc))) -#define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (fd), (security_info_sent), (psd))) +#define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (security_info_sent), (psd))) #define SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent, psd) ((handle)->vfs_next.ops.set_nt_acl((handle)->vfs_next.handles.set_nt_acl, (fsp), (name), (security_info_sent), (psd))) /* POSIX ACL operations. */ diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index cdfac3eece..90c6a589a1 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -1039,7 +1039,7 @@ static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle, NTSTATUS afsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 security_info_sent, + uint32 security_info_sent, SEC_DESC *psd) { return afs_set_nt_acl(handle, fsp, security_info_sent, psd); diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index 9ea8414f79..d63886d68e 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -399,7 +399,7 @@ static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_inf return result; } -NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd) +NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) { return aixjfs2_set_nt_acl_common(fsp, security_info_sent, psd); } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index b31bc19815..3251c56061 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -967,7 +967,7 @@ static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle, return result; } -static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd) +static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) { NTSTATUS result; diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 8f90e0de87..bdbd84ab4f 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -197,7 +197,7 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle, files_struc const char *name, uint32 security_info, SEC_DESC **ppdesc); static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 security_info_sent, + uint32 security_info_sent, SEC_DESC *psd); static NTSTATUS smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, const char *name, uint32 security_info_sent, @@ -1555,13 +1555,12 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle, } static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 security_info_sent, + uint32 security_info_sent, SEC_DESC *psd) { NTSTATUS result; - result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, - psd); + result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd); do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 21e5a6bcfa..0f7dc81ae6 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -363,7 +363,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_i return result; } -static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info_sent, SEC_DESC *psd) +static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) { return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd); } diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c index 6bf8352efd..ce2e28771f 100644 --- a/source3/modules/vfs_zfsacl.c +++ b/source3/modules/vfs_zfsacl.c @@ -206,7 +206,7 @@ static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle, static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 security_info_sent, + uint32 security_info_sent, SEC_DESC *psd) { return zfs_set_nt_acl(handle, fsp, security_info_sent, psd); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index e7f9f0d36c..ae64c06215 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -769,8 +769,7 @@ static NTSTATUS set_sd(files_struct *fsp, uint8 *data, uint32 sd_len, } if (fsp->fh->fd != -1) { - status = SMB_VFS_FSET_NT_ACL(fsp, fsp->fh->fd, - security_info_sent, psd); + status = SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd); } else { status = SMB_VFS_SET_NT_ACL(fsp, fsp->fsp_name, diff --git a/source3/smbd/open.c b/source3/smbd/open.c index f178102fdd..23d0223446 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2621,8 +2621,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn, fsp->access_mask = FILE_GENERIC_ALL; - status = SMB_VFS_FSET_NT_ACL( - fsp, fsp->fh->fd, sec_info_sent, sd); + status = SMB_VFS_FSET_NT_ACL(fsp, sec_info_sent, sd); fsp->access_mask = saved_access_mask; -- cgit From ca275e254985727c50b1b988c958a3743a7bc8ce Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 00:14:19 +0100 Subject: Remove unneeded parameter fd from SMB_VFS_PREAD(). Michael (This used to be commit 73e28806ce87d829ea7c38ed3440020845bb13bf) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_cacheprime.c | 5 ++--- source3/modules/vfs_default.c | 16 ++++++++-------- source3/modules/vfs_full_audit.c | 6 +++--- source3/modules/vfs_readahead.c | 11 +++++------ source3/smbd/fileio.c | 4 ++-- source3/smbd/vfs.c | 2 +- 10 files changed, 30 insertions(+), 31 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index fd4b206185..aeca932132 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -135,9 +135,9 @@ static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, v return vfswrap_read(NULL, fsp, fd, data, n); } -static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset) +static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) { - return vfswrap_pread(NULL, fsp, fd, data, n, offset); + return vfswrap_pread(NULL, fsp, data, n, offset); } static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 2512f4d6db..c6d7d5c36e 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -129,9 +129,9 @@ static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, v return SMB_VFS_NEXT_READ(handle, fsp, fd, data, n); } -static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset) +static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) { - return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset); + return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); } static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 038da297ab..88cf59c028 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -79,6 +79,7 @@ * files_struct. - obnox.*/ /* Leave at 22 - not yet released. Remove parameter fd from fget_nt_acl. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from gset_nt_acl. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from pread. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -269,7 +270,7 @@ struct vfs_ops { int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode); int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n); - ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset); + ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n); ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset); SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 45c5353657..6ee1b7c66d 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -49,7 +49,7 @@ #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp), (fd))) #define SMB_VFS_READ(fsp, fd, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (fd), (data), (n))) -#define SMB_VFS_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (fd), (data), (n), (off))) #define SMB_VFS_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (fd), (offset), (whence))) @@ -168,7 +168,7 @@ #define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp), (fd))) #define SMB_VFS_OPAQUE_READ(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (fd), (data), (n))) -#define SMB_VFS_OPAQUE_PREAD(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_OPAQUE_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_OPAQUE_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (fd), (data), (n), (off))) #define SMB_VFS_OPAQUE_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (fd), (offset), (whence))) @@ -288,7 +288,7 @@ #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp), (fd))) #define SMB_VFS_NEXT_READ(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (fd), (data), (n))) -#define SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (fd), (data), (n), (off))) #define SMB_VFS_NEXT_LSEEK(handle, fsp, fd, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (fd), (offset), (whence))) diff --git a/source3/modules/vfs_cacheprime.c b/source3/modules/vfs_cacheprime.c index 9574087d9d..6eb74e66ed 100644 --- a/source3/modules/vfs_cacheprime.c +++ b/source3/modules/vfs_cacheprime.c @@ -160,16 +160,15 @@ static ssize_t cprime_read( static ssize_t cprime_pread( vfs_handle_struct * handle, files_struct * fsp, - int fd, void * data, size_t count, SMB_OFF_T offset) { if (g_readbuf) { - prime_cache(handle, fsp, fd, offset, count); + prime_cache(handle, fsp, fsp->fh->fd, offset, count); } - return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset); + return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset); } static vfs_op_tuple cprime_ops [] = diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 3251c56061..4f9d90abde 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -218,19 +218,19 @@ static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, int fd return result; } -static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, +static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) { ssize_t result; #if defined(HAVE_PREAD) || defined(HAVE_PREAD64) START_PROFILE_BYTES(syscall_pread, n); - result = sys_pread(fd, data, n, offset); + result = sys_pread(fsp->fh->fd, data, n, offset); END_PROFILE(syscall_pread); if (result == -1 && errno == ESPIPE) { /* Maintain the fiction that pipes can be seeked (sought?) on. */ - result = SMB_VFS_READ(fsp, fd, data, n); + result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); fsp->fh->pos = 0; } @@ -238,23 +238,23 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, int f SMB_OFF_T curr; int lerrno; - curr = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR); + curr = SMB_VFS_LSEEK(fsp, fsp->fh->fd, 0, SEEK_CUR); if (curr == -1 && errno == ESPIPE) { /* Maintain the fiction that pipes can be seeked (sought?) on. */ - result = SMB_VFS_READ(fsp, fd, data, n); + result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); fsp->fh->pos = 0; return result; } - if (SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET) == -1) { + if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, offset, SEEK_SET) == -1) { return -1; } errno = 0; - result = SMB_VFS_READ(fsp, fd, data, n); + result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); lerrno = errno; - SMB_VFS_LSEEK(fsp, fd, curr, SEEK_SET); + SMB_VFS_LSEEK(fsp, fsp->fh->fd, curr, SEEK_SET); errno = lerrno; #endif /* HAVE_PREAD */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index bdbd84ab4f..7acca905a0 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -115,7 +115,7 @@ static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, in static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n); static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp, - int fd, void *data, size_t n, SMB_OFF_T offset); + void *data, size_t n, SMB_OFF_T offset); static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n); static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp, @@ -1100,11 +1100,11 @@ static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp, } static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp, - int fd, void *data, size_t n, SMB_OFF_T offset) + void *data, size_t n, SMB_OFF_T offset) { ssize_t result; - result = SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset); + result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_readahead.c b/source3/modules/vfs_readahead.c index 8fdd6168fe..b3642d558f 100644 --- a/source3/modules/vfs_readahead.c +++ b/source3/modules/vfs_readahead.c @@ -80,7 +80,6 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle, static ssize_t readahead_pread(vfs_handle_struct *handle, files_struct *fsp, - int fd, void *data, size_t count, SMB_OFF_T offset) @@ -89,16 +88,16 @@ static ssize_t readahead_pread(vfs_handle_struct *handle, if ( offset % rhd->off_bound == 0) { #if defined(HAVE_LINUX_READAHEAD) - int err = readahead(fd, offset, (size_t)rhd->len); + int err = readahead(fsp->fh->fd, offset, (size_t)rhd->len); DEBUG(10,("readahead_pread: readahead on fd %u, offset %llu, len %u returned %d\n", - (unsigned int)fd, + (unsigned int)fsp->fh->fd, (unsigned long long)offset, (unsigned int)rhd->len, err )); #elif defined(HAVE_POSIX_FADVISE) - int err = posix_fadvise(fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED); + int err = posix_fadvise(fsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED); DEBUG(10,("readahead_pread: posix_fadvise on fd %u, offset %llu, len %u returned %d\n", - (unsigned int)fd, + (unsigned int)fsp->fh->fd, (unsigned long long)offset, (unsigned int)rhd->len, err )); @@ -109,7 +108,7 @@ static ssize_t readahead_pread(vfs_handle_struct *handle, } #endif } - return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset); + return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset); } /******************************************************************* diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 8037510d80..a648326f89 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -77,7 +77,7 @@ ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n) #ifdef DMF_FIX int numretries = 3; tryagain: - readret = SMB_VFS_PREAD(fsp,fsp->fh->fd,data,n,pos); + readret = SMB_VFS_PREAD(fsp,data,n,pos); if (readret == -1) { if ((errno == EAGAIN) && numretries) { @@ -89,7 +89,7 @@ tryagain: return -1; } #else /* NO DMF fix. */ - readret = SMB_VFS_PREAD(fsp,fsp->fh->fd,data,n,pos); + readret = SMB_VFS_PREAD(fsp,data,n,pos); if (readret == -1) { return -1; diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index ed0406211d..bc272914c7 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -411,7 +411,7 @@ ssize_t vfs_pread_data(files_struct *fsp, char *buf, while (total < byte_count) { - ssize_t ret = SMB_VFS_PREAD(fsp, fsp->fh->fd, buf + total, + ssize_t ret = SMB_VFS_PREAD(fsp, buf + total, byte_count - total, offset + total); if (ret == 0) return total; -- cgit From 3f4699f5a3f3c7a2ad11119c266e5a018d71b0fe Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 00:21:12 +0100 Subject: Adapt fset_nt_acl() and fget_nt_acl() in examples/VFS/ to vfs prototype change. Michael (This used to be commit d9d6775878f8b3425665c6a45a5ef9cb92932cf8) --- examples/VFS/skel_opaque.c | 6 +++--- examples/VFS/skel_transparent.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index aeca932132..21b39c1d95 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -301,7 +301,7 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle, } static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 security_info, SEC_DESC **ppdesc) + uint32 security_info, SEC_DESC **ppdesc) { errno = ENOSYS; return 0; @@ -314,8 +314,8 @@ static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, return 0; } -static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int - fd, uint32 security_info_sent, SEC_DESC *psd) +static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, + uint32 security_info_sent, SEC_DESC *psd) { errno = ENOSYS; return NT_STATUS_NOT_IMPLEMENTED; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index c6d7d5c36e..76ef7e0f2b 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -290,9 +290,9 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle, } static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 security_info, SEC_DESC **ppdesc) + uint32 security_info, SEC_DESC **ppdesc) { - return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc); + return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc); } static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, @@ -302,9 +302,9 @@ static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, } static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 security_info_sent, SEC_DESC *psd) + uint32 security_info_sent, SEC_DESC *psd) { - return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent, psd); + return SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd); } static NTSTATUS skel_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, -- cgit From 18699d003b1d4460ffb36db61860e6c31acbf1cb Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 26 Nov 2007 11:44:30 +0100 Subject: Prevent winbindd from segfaulting due to corrupted cache tdb. If we try to flush the caches and due to a corrupted tdb we and have no tdb context close the tdb and validate it. Initialize the cache afterwards again. (This used to be commit d0c0f91fb9f3438a18c6f47ed894f525beb75cbf) --- source3/winbindd/winbindd.c | 18 +++++++++++++++++- source3/winbindd/winbindd_cache.c | 22 +++++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 07cf22618e..dfad50bf96 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -121,7 +121,23 @@ static void flush_caches(void) otherwise cached access denied errors due to restrict anonymous hang around until the sequence number changes. */ - wcache_invalidate_cache(); + if (wcache_invalidate_cache() < 0) { + DEBUG(0, ("invalidating the cache failed; revalidate the cache\n")); + /* Close the cache to be able to valdite the cache */ + close_winbindd_cache(); + /* + * Ensure all cache and idmap caches are consistent + * before we initialize the cache again. + */ + if (winbindd_validate_cache() < 0) { + DEBUG(0, ("corrupted tdb found, trying to restore backup\n")); + } + + /* Initialize cache again. */ + if (!initialize_winbindd_cache()) { + exit(1); + } + } } /* Handle the signal by unlinking socket and exiting */ diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index f63c7a5b2f..62a68aa8aa 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -2261,7 +2261,7 @@ void wcache_invalidate_samlogon(struct winbindd_domain *domain, netsamlogon_clear_cached_user(cache->tdb, info3); } -void wcache_invalidate_cache(void) +int wcache_invalidate_cache(void) { struct winbindd_domain *domain; @@ -2270,9 +2270,15 @@ void wcache_invalidate_cache(void) DEBUG(10, ("wcache_invalidate_cache: invalidating cache " "entries for %s\n", domain->name)); - if (cache) - tdb_traverse(cache->tdb, traverse_fn, NULL); + if (cache) { + if (cache->tdb) { + tdb_traverse(cache->tdb, traverse_fn, NULL); + } else { + return -1; + } + } } + return 0; } bool init_wcache(void) @@ -2354,6 +2360,16 @@ bool initialize_winbindd_cache(void) return True; } +void close_winbindd_cache() +{ + if (!wcache) + return; + if (wcache->tdb) { + tdb_close(wcache->tdb); + wcache->tdb = NULL; + } +} + void cache_store_response(pid_t pid, struct winbindd_response *response) { fstring key_str; -- cgit From c4d3f1b0f5345086e18cb4740e7a0c4fa222089a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 10:41:09 +0100 Subject: Add some braces to if statement. Michael (This used to be commit 66fc1db1d19d11792d9506b06ad914d88b7e0663) --- source3/winbindd/winbindd_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 62a68aa8aa..9602a128a6 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -2362,8 +2362,9 @@ bool initialize_winbindd_cache(void) void close_winbindd_cache() { - if (!wcache) + if (!wcache) { return; + } if (wcache->tdb) { tdb_close(wcache->tdb); wcache->tdb = NULL; -- cgit From 696cf4d3c013f99d034c19c6762bf71c7c1ee8a6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 10:59:14 +0100 Subject: Make wcache_invalidate_cache() return bool, not int. Michael (This used to be commit dba24ceae78ffc49200b647838b6bf3657275add) --- source3/winbindd/winbindd.c | 2 +- source3/winbindd/winbindd_cache.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index dfad50bf96..8ebae3f16d 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -121,7 +121,7 @@ static void flush_caches(void) otherwise cached access denied errors due to restrict anonymous hang around until the sequence number changes. */ - if (wcache_invalidate_cache() < 0) { + if (!wcache_invalidate_cache()) { DEBUG(0, ("invalidating the cache failed; revalidate the cache\n")); /* Close the cache to be able to valdite the cache */ close_winbindd_cache(); diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 9602a128a6..19becab1a6 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -2261,7 +2261,7 @@ void wcache_invalidate_samlogon(struct winbindd_domain *domain, netsamlogon_clear_cached_user(cache->tdb, info3); } -int wcache_invalidate_cache(void) +bool wcache_invalidate_cache(void) { struct winbindd_domain *domain; @@ -2274,11 +2274,11 @@ int wcache_invalidate_cache(void) if (cache->tdb) { tdb_traverse(cache->tdb, traverse_fn, NULL); } else { - return -1; + return false; } } } - return 0; + return true; } bool init_wcache(void) -- cgit From 0818d41697e839741b642efb8377f43686c33b7b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 11:19:27 +0100 Subject: Fix a comment. Michael (This used to be commit 62d6d4fff2edcce04e793d2a2f877cb3f4fedbdb) --- source3/winbindd/winbindd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 8ebae3f16d..5e9900d1d6 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -130,7 +130,8 @@ static void flush_caches(void) * before we initialize the cache again. */ if (winbindd_validate_cache() < 0) { - DEBUG(0, ("corrupted tdb found, trying to restore backup\n")); + DEBUG(0, ("winbindd cache tdb corrupt and no backup " + "could be restore.\n")); } /* Initialize cache again. */ -- cgit From d82702c21881120726065240af6db0fac3c4fef6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 11:27:54 +0100 Subject: Use the proper boolean constants. Michael (This used to be commit 6f673b7f10c145d88e6a6d3072b5f8cd98837304) --- source3/winbindd/winbindd_cache.c | 186 +++++++++++++++++++------------------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 19becab1a6..fc71868517 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -62,7 +62,7 @@ static bool is_non_centry_key(TDB_DATA kbuf) int i; if (kbuf.dptr == NULL || kbuf.dsize == 0) { - return False; + return false; } for (i = 0; non_centry_keys[i] != NULL; i++) { size_t namelen = strlen(non_centry_keys[i]); @@ -70,10 +70,10 @@ static bool is_non_centry_key(TDB_DATA kbuf) continue; } if (strncmp(non_centry_keys[i], (const char *)kbuf.dptr, namelen) == 0) { - return True; + return true; } } - return False; + return false; } /* Global online/offline state - False when online. winbindd starts up online @@ -210,9 +210,9 @@ static bool centry_check_bytes(struct cache_entry *centry, size_t nbytes) DEBUG(0,("centry corruption? needed %u bytes, have %d\n", (unsigned int)nbytes, centry->len - centry->ofs)); - return False; + return false; } - return True; + return true; } /* @@ -348,9 +348,9 @@ static bool centry_sid(struct cache_entry *centry, TALLOC_CTX *mem_ctx, DOM_SID char *sid_string; sid_string = centry_string(centry, mem_ctx); if ((sid_string == NULL) || (!string_to_sid(sid, sid_string))) { - return False; + return false; } - return True; + return true; } @@ -372,7 +372,7 @@ static bool wcache_server_down(struct winbindd_domain *domain) bool ret; if (!wcache->tdb) - return False; + return false; ret = (domain->sequence_number == DOM_SEQUENCE_NONE); @@ -454,7 +454,7 @@ static NTSTATUS store_cache_seqnum( struct winbindd_domain *domain ) } /* - refresh the domain sequence number. If force is True + refresh the domain sequence number. If force is true then always refresh it, no matter how recently we fetched it */ @@ -538,7 +538,7 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s if (lp_winbind_offline_logon() && global_winbindd_offline_state) { DEBUG(10,("centry_expired: Key %s for domain %s valid as winbindd is globally offline.\n", keystr, domain->name )); - return False; + return false; } /* when the domain is offline return the cached entry. @@ -547,7 +547,7 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s if (!domain->online) { DEBUG(10,("centry_expired: Key %s for domain %s valid as domain is offline.\n", keystr, domain->name )); - return False; + return false; } /* if the server is OK and our cache entry came from when it was down then @@ -556,7 +556,7 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s (centry->sequence_number == DOM_SEQUENCE_NONE)) { DEBUG(10,("centry_expired: Key %s for domain %s invalid sequence.\n", keystr, domain->name )); - return True; + return true; } /* if the server is down or the cache entry is not older than the @@ -565,14 +565,14 @@ static bool centry_expired(struct winbindd_domain *domain, const char *keystr, s centry->sequence_number == domain->sequence_number) { DEBUG(10,("centry_expired: Key %s for domain %s is good.\n", keystr, domain->name )); - return False; + return false; } DEBUG(10,("centry_expired: Key %s for domain %s expired\n", keystr, domain->name )); /* it's expired */ - return True; + return true; } static struct cache_entry *wcache_fetch_raw(char *kstr) @@ -625,7 +625,7 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache, return NULL; } - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); va_start(ap, format); smb_xvasprintf(&kstr, format, ap); @@ -1189,7 +1189,7 @@ do_query: (retry++ < 5)); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); centry = centry_start(domain, status); if (!centry) goto skip_save; @@ -1280,7 +1280,7 @@ do_query: status = domain->backend->enum_dom_groups(domain, mem_ctx, num_entries, info); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); centry = centry_start(domain, status); if (!centry) goto skip_save; @@ -1364,7 +1364,7 @@ do_query: status = domain->backend->enum_local_groups(domain, mem_ctx, num_entries, info); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); centry = centry_start(domain, status); if (!centry) goto skip_save; @@ -1437,7 +1437,7 @@ do_query: domain_name, name, sid, type); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); if (domain->online && (NT_STATUS_IS_OK(status) || NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED))) { @@ -1510,7 +1510,7 @@ do_query: status = domain->backend->sid_to_name(domain, mem_ctx, sid, domain_name, name, type); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); wcache_save_sid_to_name(domain, status, sid, *domain_name, *name, *type); /* We can't save the name to sid mapping here, as with sid history a @@ -1554,7 +1554,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, goto error; } - have_mapped = have_unmapped = False; + have_mapped = have_unmapped = false; for (i=0; istatus)) { char *dom; - have_mapped = True; + have_mapped = true; (*types)[i] = (enum lsa_SidType)centry_uint32(centry); dom = centry_string(centry, mem_ctx); @@ -1590,7 +1590,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, (*names)[i] = centry_string(centry, *names); } else if (NT_STATUS_EQUAL(centry->status, NT_STATUS_NONE_MAPPED)) { - have_unmapped = True; + have_unmapped = true; } else { /* something's definitely wrong */ @@ -1647,7 +1647,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, return result; } - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); for (i=0; ibackend->query_user(domain, mem_ctx, user_sid, info); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); wcache_save_user(domain, status, info); return status; @@ -1819,7 +1819,7 @@ do_query: goto skip_save; /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); centry = centry_start(domain, status); if (!centry) goto skip_save; @@ -1912,7 +1912,7 @@ static NTSTATUS lookup_useraliases(struct winbindd_domain *domain, num_aliases, alias_rids); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); centry = centry_start(domain, status); if (!centry) goto skip_save; @@ -1993,7 +1993,7 @@ do_query: sid_mem, names, name_types); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); centry = centry_start(domain, status); if (!centry) goto skip_save; @@ -2013,7 +2013,7 @@ skip_save: /* find the sequence number for a domain */ static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq) { - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); *seq = domain->sequence_number; @@ -2104,7 +2104,7 @@ do_query: the main parent and always to make the query. --jerry */ /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); centry = centry_start(domain, status); if (!centry) @@ -2170,7 +2170,7 @@ do_query: status = domain->backend->lockout_policy(domain, mem_ctx, policy); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); wcache_save_lockout_policy(domain, status, policy); return status; @@ -2221,7 +2221,7 @@ do_query: status = domain->backend->password_policy(domain, mem_ctx, policy); /* and save it */ - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); wcache_save_password_policy(domain, status, policy); return status; @@ -2289,7 +2289,7 @@ bool init_wcache(void) } if (wcache->tdb != NULL) - return True; + return true; /* when working offline we must not clear the cache on restart */ wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), @@ -2299,10 +2299,10 @@ bool init_wcache(void) if (wcache->tdb == NULL) { DEBUG(0,("Failed to open winbindd_cache.tdb!\n")); - return False; + return false; } - return True; + return true; } /************************************************************************ @@ -2313,18 +2313,18 @@ bool init_wcache(void) bool initialize_winbindd_cache(void) { - bool cache_bad = True; + bool cache_bad = true; uint32 vers; if (!init_wcache()) { DEBUG(0,("initialize_winbindd_cache: init_wcache failed.\n")); - return False; + return false; } /* Check version number. */ if (tdb_fetch_uint32(wcache->tdb, WINBINDD_CACHE_VERSION_KEYSTR, &vers) && vers == WINBINDD_CACHE_VERSION) { - cache_bad = False; + cache_bad = false; } if (cache_bad) { @@ -2339,25 +2339,25 @@ bool initialize_winbindd_cache(void) DEBUG(0,("initialize_winbindd_cache: unlink %s failed %s ", lock_path("winbindd_cache.tdb"), strerror(errno) )); - return False; + return false; } if (!init_wcache()) { DEBUG(0,("initialize_winbindd_cache: re-initialization " "init_wcache failed.\n")); - return False; + return false; } /* Write the version. */ if (!tdb_store_uint32(wcache->tdb, WINBINDD_CACHE_VERSION_KEYSTR, WINBINDD_CACHE_VERSION)) { DEBUG(0,("initialize_winbindd_cache: version number store failed %s\n", tdb_errorstr(wcache->tdb) )); - return False; + return false; } } tdb_close(wcache->tdb); wcache->tdb = NULL; - return True; + return true; } void close_winbindd_cache() @@ -2417,7 +2417,7 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response) fstring key_str; if (!init_wcache()) - return False; + return false; DEBUG(10, ("Retrieving response for pid %d\n", pid)); @@ -2425,17 +2425,17 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response) data = tdb_fetch(wcache->tdb, string_tdb_data(key_str)); if (data.dptr == NULL) - return False; + return false; if (data.dsize != sizeof(*response)) - return False; + return false; memcpy(response, data.dptr, data.dsize); SAFE_FREE(data.dptr); if (response->length == sizeof(*response)) { response->extra_data.data = NULL; - return True; + return true; } /* There's extra data */ @@ -2448,19 +2448,19 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response) if (data.dptr == NULL) { DEBUG(0, ("Did not find extra data\n")); - return False; + return false; } if (data.dsize != (response->length - sizeof(*response))) { DEBUG(0, ("Invalid extra data length: %d\n", (int)data.dsize)); SAFE_FREE(data.dptr); - return False; + return false; } dump_data(11, (uint8 *)data.dptr, data.dsize); response->extra_data.data = data.dptr; - return True; + return true; } void cache_cleanup_response(pid_t pid) @@ -2492,19 +2492,19 @@ bool lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, domain = find_lookup_domain_from_sid(sid); if (domain == NULL) { - return False; + return false; } cache = get_cache(domain); if (cache->tdb == NULL) { - return False; + return false; } centry = wcache_fetch(cache, domain, "SN/%s", sid_to_fstring(tmp, sid)); if (centry == NULL) { - return False; + return false; } if (NT_STATUS_IS_OK(centry->status)) { @@ -2533,13 +2533,13 @@ bool lookup_cached_name(TALLOC_CTX *mem_ctx, domain = find_lookup_domain_from_name(domain_name); if (domain == NULL) { - return False; + return false; } cache = get_cache(domain); if (cache->tdb == NULL) { - return False; + return false; } fstrcpy(uname, name); @@ -2549,12 +2549,12 @@ bool lookup_cached_name(TALLOC_CTX *mem_ctx, offline so the cache won't expire the entry */ original_online_state = domain->online; - domain->online = False; + domain->online = false; centry = wcache_fetch(cache, domain, "NS/%s/%s", domain_name, uname); domain->online = original_online_state; if (centry == NULL) { - return False; + return false; } if (NT_STATUS_IS_OK(centry->status)) { @@ -2572,7 +2572,7 @@ void cache_name2sid(struct winbindd_domain *domain, const char *domain_name, const char *name, enum lsa_SidType type, const DOM_SID *sid) { - refresh_sequence_number(domain, False); + refresh_sequence_number(domain, false); wcache_save_name_to_sid(domain, NT_STATUS_OK, domain_name, name, sid, type); } @@ -2786,17 +2786,17 @@ bool set_global_winbindd_state_offline(void) if (wcache == NULL || wcache->tdb == NULL) { DEBUG(10,("set_global_winbindd_state_offline: wcache not open yet.\n")); - return False; + return false; } if (!lp_winbind_offline_logon()) { DEBUG(10,("set_global_winbindd_state_offline: rejecting.\n")); - return False; + return false; } if (global_winbindd_offline_state) { /* Already offline. */ - return True; + return true; } data = tdb_fetch_bystring( wcache->tdb, "WINBINDD_OFFLINE" ); @@ -2804,12 +2804,12 @@ bool set_global_winbindd_state_offline(void) if (!data.dptr || data.dsize != 4) { DEBUG(10,("set_global_winbindd_state_offline: offline state not set.\n")); SAFE_FREE(data.dptr); - return False; + return false; } else { DEBUG(10,("set_global_winbindd_state_offline: offline state set.\n")); - global_winbindd_offline_state = True; + global_winbindd_offline_state = true; SAFE_FREE(data.dptr); - return True; + return true; } } @@ -2826,7 +2826,7 @@ void set_global_winbindd_state_online(void) /* Already online. */ return; } - global_winbindd_offline_state = False; + global_winbindd_offline_state = false; if (!wcache->tdb) { return; @@ -2863,8 +2863,8 @@ static struct cache_entry *create_centry_validate(const char *kstr, TDB_DATA dat /* huh? corrupt cache? */ DEBUG(0,("create_centry_validate: Corrupt cache for key %s (len < 8) ?\n", kstr)); centry_free(centry); - state->bad_entry = True; - state->success = False; + state->bad_entry = true; + state->success = false; return NULL; } @@ -2879,7 +2879,7 @@ static int validate_seqnum(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbu if (dbuf.dsize != 8) { DEBUG(0,("validate_seqnum: Corrupt cache for key %s (len %u != 8) ?\n", keystr, (unsigned int)dbuf.dsize )); - state->bad_entry = True; + state->bad_entry = true; return 1; } return 0; @@ -3174,8 +3174,8 @@ static int validate_dr(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf, if (dbuf.dsize == 0) { DEBUG(0,("validate_dr: Corrupt cache for key %s (len == 0) ?\n", keystr)); - state->bad_entry = True; - state->success = False; + state->bad_entry = true; + state->success = false; return 1; } @@ -3190,8 +3190,8 @@ static int validate_de(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf, if (dbuf.dsize == 0) { DEBUG(0,("validate_de: Corrupt cache for key %s (len == 0) ?\n", keystr)); - state->bad_entry = True; - state->success = False; + state->bad_entry = true; + state->success = false; return 1; } @@ -3234,8 +3234,8 @@ static int validate_trustdomcache(TALLOC_CTX *mem_ctx, const char *keystr, if (dbuf.dsize == 0) { DEBUG(0, ("validate_trustdomcache: Corrupt cache for " "key %s (len ==0) ?\n", keystr)); - state->bad_entry = True; - state->success = False; + state->bad_entry = true; + state->success = false; return 1; } @@ -3250,8 +3250,8 @@ static int validate_offline(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA db if (dbuf.dsize != 4) { DEBUG(0,("validate_offline: Corrupt cache for key %s (len %u != 4) ?\n", keystr, (unsigned int)dbuf.dsize )); - state->bad_entry = True; - state->success = False; + state->bad_entry = true; + state->success = false; return 1; } DEBUG(10,("validate_offline: %s ok\n", keystr)); @@ -3265,8 +3265,8 @@ static int validate_cache_version(TALLOC_CTX *mem_ctx, const char *keystr, TDB_D DEBUG(0, ("validate_cache_version: Corrupt cache for " "key %s (len %u != 4) ?\n", keystr, (unsigned int)dbuf.dsize)); - state->bad_entry = True; - state->success = False; + state->bad_entry = true; + state->success = false; return 1; } @@ -3355,8 +3355,8 @@ static int cache_traverse_validate_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_D dump_data(0, (uint8 *)kbuf.dptr, kbuf.dsize); DEBUG(0,("data :\n")); dump_data(0, (uint8 *)dbuf.dptr, dbuf.dsize); - v_state->unknown_key = True; - v_state->success = False; + v_state->unknown_key = true; + v_state->success = false; return 1; /* terminate. */ } @@ -3450,7 +3450,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom, struct winbindd_tdc_domain *list = NULL; size_t idx; int i; - bool set_only = False; + bool set_only = false; /* don't allow duplicates */ @@ -3462,7 +3462,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom, DEBUG(10,("add_wbdomain_to_tdc_array: Found existing record for %s\n", new_dom->name)); idx = i; - set_only = True; + set_only = true; break; } @@ -3483,7 +3483,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom, } if ( !list ) - return False; + return false; list[idx].domain_name = talloc_strdup( list, new_dom->name ); list[idx].dns_name = talloc_strdup( list, new_dom->alt_name ); @@ -3505,7 +3505,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom, *num_domains = idx + 1; } - return True; + return true; } /********************************************************************* @@ -3661,7 +3661,7 @@ static bool wcache_tdc_store_list( struct winbindd_tdc_domain *domains, size_t n int ret; if ( !key.dptr ) - return False; + return false; /* See if we were asked to delete the cache entry */ @@ -3698,23 +3698,23 @@ bool wcache_tdc_fetch_list( struct winbindd_tdc_domain **domains, size_t *num_do *num_domains = 0; if ( !key.dptr ) - return False; + return false; data = tdb_fetch( wcache->tdb, key ); SAFE_FREE( key.dptr ); if ( !data.dptr ) - return False; + return false; *num_domains = unpack_tdc_domains( data.dptr, data.dsize, domains ); SAFE_FREE( data.dptr ); if ( !*domains ) - return False; + return false; - return True; + return true; } /********************************************************************* @@ -3724,7 +3724,7 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain ) { struct winbindd_tdc_domain *dom_list = NULL; size_t num_domains = 0; - bool ret = False; + bool ret = false; DEBUG(10,("wcache_tdc_add_domain: Adding domain %s (%s), SID %s, " "flags = 0x%x, attributes = 0x%x, type = 0x%x\n", @@ -3735,7 +3735,7 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain ) domain->domain_type)); if ( !init_wcache() ) { - return False; + return false; } /* fetch the list */ @@ -3756,7 +3756,7 @@ bool wcache_tdc_add_domain( struct winbindd_domain *domain ) /* Success */ - ret = True; + ret = true; done: TALLOC_FREE( dom_list ); @@ -3776,7 +3776,7 @@ struct winbindd_tdc_domain * wcache_tdc_fetch_domain( TALLOC_CTX *ctx, const cha DEBUG(10,("wcache_tdc_fetch_domain: Searching for domain %s\n", name)); if ( !init_wcache() ) { - return False; + return false; } /* fetch the list */ @@ -3909,7 +3909,7 @@ do_query: /* the cache backend methods are exposed via this structure */ struct winbindd_methods cache_methods = { - True, + true, query_user_list, enum_dom_groups, enum_local_groups, -- cgit From 6345220151c4b09380b0b461f51309c043052916 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 4 Jan 2008 23:11:53 +0100 Subject: Only create machine account in libnetjoin when requested to. Guenther (This used to be commit bc025a3860483e8cdbd0f61579689c9edadd3af0) --- source3/libnet/libnet_join.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 95b643ffa6..36d5c0a889 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -138,17 +138,21 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, strlower_m(acct_name); const_acct_name = acct_name; - status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol, - acct_name, ACB_WSTRUST, - 0xe005000b, &user_pol, &user_rid); - if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { - if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) { - goto done; + if (r->in.join_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE) { + status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, + &domain_pol, + acct_name, ACB_WSTRUST, + 0xe005000b, &user_pol, + &user_rid); + if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { + if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) { + goto done; + } } - } - if (NT_STATUS_IS_OK(status)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + if (NT_STATUS_IS_OK(status)) { + rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + } } status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx, -- cgit From e6c3ac59c5adb433d6269cae7141e575da7fdc8d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 12:19:56 +0100 Subject: Failure while unjoining a domain is non-critical. Just continue joining to the workgroup in that case. Guenther (This used to be commit bf9ce2a928e3136d3bfe368f75d5b99273c5b04f) --- source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index d12e66bb26..1e1681ba37 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -449,14 +449,8 @@ static void callback_do_join(GtkWidget *widget, initial_workgroup_type, state->name_buffer_initial, err_str); - - g_signal_connect_swapped(dialog, "response", - G_CALLBACK(gtk_widget_destroy), - dialog); - - gtk_widget_show(dialog); - - return; + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); } } -- cgit From 68ec31427735e3d127544e52d4107d1e97eeeada Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 12:41:18 +0100 Subject: In gfree_debugsyms() free the format_bufr as well. Guenther (This used to be commit 48f09ca376f9fc7923309f3466e5d72f7c21a56f) --- source3/lib/debug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 9ea2dc151a..6c1bfea04f 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -199,6 +199,8 @@ void gfree_debugsyms(void) if ( DEBUGLEVEL_CLASS_ISSET != &debug_all_class_isset_hack ) SAFE_FREE( DEBUGLEVEL_CLASS_ISSET ); + + SAFE_FREE(format_bufr); } /**************************************************************************** -- cgit From c0d33508ff6b7c3b90e672d20246b1c9e359cf80 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 12:42:16 +0100 Subject: Add secrets_shutdown(). Guenther (This used to be commit dd3fbd93b6e5fe8b5e3a3727a64a38d5ae46fcbf) --- source3/passdb/secrets.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 8e0afe7c32..330ffbc853 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -94,6 +94,19 @@ bool secrets_init(void) return True; } +/* + * close secrets.tdb + */ +void secrets_shutdown(void) +{ + if (!tdb) { + return; + } + + tdb_close(tdb); + tdb = NULL; +} + /* read a entry from the secrets database - the caller must free the result if size is non-null then the size of the entry is put in there */ -- cgit From be7df54c3912a2db024f19d789d385e99ed98917 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 12:44:25 +0100 Subject: Fix two memleaks in libnetapi. Guenther (This used to be commit d73bde99e8518607bb78b5625ce5fb1991d8e402) --- source3/lib/netapi/netapi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 032798d0f9..9c418f254c 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -1,7 +1,7 @@ /* * Unix SMB/CIFS implementation. * NetApi Support - * Copyright (C) Guenther Deschner 2007 + * Copyright (C) Guenther Deschner 2007-2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -90,6 +90,9 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) gfree_charcnv(); gfree_interfaces(); + gencache_shutdown(); + secrets_shutdown(); + TALLOC_FREE(ctx); TALLOC_FREE(frame); -- cgit From 02f67cfcfa09245e79ecbe41dfadd04f5418253a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 14:15:48 +0100 Subject: Add free_local_machine_name(). Guenther (This used to be commit f3ebb4f96bb0364dae9924e798652e759b63bb52) --- source3/lib/substitute.c | 5 +++++ source3/lib/util.c | 1 + 2 files changed, 6 insertions(+) diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 80feee9579..59b54c4dff 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -34,6 +34,11 @@ fstring remote_proto="UNKNOWN"; static char *local_machine; +void free_local_machine_name(void) +{ + SAFE_FREE(local_machine); +} + bool set_local_machine_name(const char *local_name, bool perm) { static bool already_perm = false; diff --git a/source3/lib/util.c b/source3/lib/util.c index c69a1450a0..25b2700ae3 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -183,6 +183,7 @@ void gfree_names(void) SAFE_FREE( smb_myworkgroup ); SAFE_FREE( smb_scope ); free_netbios_names_array(); + free_local_machine_name(); } void gfree_all( void ) -- cgit From cab9aa525dbbf4ba65acb43763298bfb30d4fca4 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 14:51:11 +0100 Subject: Fix build warning. Guenther (This used to be commit 73233a06d6f0f1346c48b465750af4b532cd7306) --- source3/winbindd/winbindd_cm.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 99e401d53f..a9155a5763 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -74,7 +74,7 @@ extern bool override_logfile; static NTSTATUS init_dc_connection_network(struct winbindd_domain *domain); static void set_dc_type_and_flags( struct winbindd_domain *domain ); -static bool get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain, +static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, struct dc_name_ip **dcs, int *num_dcs); /**************************************************************** @@ -560,7 +560,7 @@ static void cm_get_ipc_userpass(char **username, char **domain, char **password) } } -static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain, +static bool get_dc_name_via_netlogon(struct winbindd_domain *domain, fstring dcname, struct sockaddr_storage *dc_ss) { @@ -600,12 +600,12 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain, 35 seconds should do it. */ orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000); - + if (our_domain->active_directory) { struct DS_DOMAIN_CONTROLLER_INFO *domain_info = NULL; - - werr = rpccli_netlogon_dsr_getdcname(netlogon_pipe, - mem_ctx, + + werr = rpccli_netlogon_dsr_getdcname(netlogon_pipe, + mem_ctx, our_domain->dcname, domain->name, NULL, @@ -615,19 +615,21 @@ static bool get_dc_name_via_netlogon(const struct winbindd_domain *domain, if (W_ERROR_IS_OK(werr)) { fstrcpy(tmp, domain_info->domain_controller_name); if (strlen(domain->alt_name) == 0) { - fstrcpy(domain->alt_name, - CONST_DISCARD(char*, domain_info->domain_name)); + fstrcpy(domain->alt_name, + domain_info->domain_name); } if (strlen(domain->forest_name) == 0) { - fstrcpy(domain->forest_name, - CONST_DISCARD(char*, domain_info->dns_forest_name)); + fstrcpy(domain->forest_name, + domain_info->dns_forest_name); } - } + } } else { - - werr = rpccli_netlogon_getanydcname(netlogon_pipe, mem_ctx, + + werr = rpccli_netlogon_getanydcname(netlogon_pipe, + mem_ctx, our_domain->dcname, - domain->name, &tmp); + domain->name, + &tmp); } /* And restore our original timeout. */ @@ -1245,7 +1247,7 @@ static bool dcip_to_name(const struct winbindd_domain *domain, the dcs[] with results. *******************************************************************/ -static bool get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain, +static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, struct dc_name_ip **dcs, int *num_dcs) { fstring dcname; @@ -1348,7 +1350,7 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, const struct winbindd_domain *domain, } static bool find_new_dc(TALLOC_CTX *mem_ctx, - const struct winbindd_domain *domain, + struct winbindd_domain *domain, fstring dcname, struct sockaddr_storage *pss, int *fd) { struct dc_name_ip *dcs = NULL; -- cgit From a56b417809805f8872c1e3238cce5d006d6189e4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 09:23:04 +0100 Subject: Remove redundant parameter fd from SMB_VFS_PWRITE(). Michael (This used to be commit 8c4901a19ae2fd3ee085f9499f33aa7db016d182) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_commit.c | 3 +-- source3/modules/vfs_default.c | 14 +++++++------- source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/vfs.c | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 21b39c1d95..1fb9b8056e 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -145,9 +145,9 @@ static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, return vfswrap_write(NULL, fsp, fd, data, n); } -ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset) +ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) { - return vfswrap_pwrite(NULL, fsp, fd, data, n, offset); + return vfswrap_pwrite(NULL, fsp, data, n, offset); } static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 76ef7e0f2b..f702c93d80 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -139,9 +139,9 @@ static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, return SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n); } -static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset) +static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) { - return SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset); + return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); } static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 88cf59c028..6f3232cbf9 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -80,6 +80,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from fget_nt_acl. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from gset_nt_acl. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from pread. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from pwrite. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -272,7 +273,7 @@ struct vfs_ops { ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n); ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n); - ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset); + ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset); SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence); ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t count); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 6ee1b7c66d..74a45814bd 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -51,7 +51,7 @@ #define SMB_VFS_READ(fsp, fd, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (fd), (data), (n))) #define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (fd), (data), (n))) -#define SMB_VFS_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (fd), (offset), (whence))) #define SMB_VFS_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) #define SMB_VFS_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) @@ -170,7 +170,7 @@ #define SMB_VFS_OPAQUE_READ(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (fd), (data), (n))) #define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_OPAQUE_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (fd), (data), (n))) -#define SMB_VFS_OPAQUE_PWRITE(fsp, fd, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_OPAQUE_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_OPAQUE_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (fd), (offset), (whence))) #define SMB_VFS_OPAQUE_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) #define SMB_VFS_OPAQUE_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) @@ -290,7 +290,7 @@ #define SMB_VFS_NEXT_READ(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (fd), (data), (n))) #define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (fd), (data), (n))) -#define SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (fd), (data), (n), (off))) +#define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_NEXT_LSEEK(handle, fsp, fd, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (fd), (offset), (whence))) #define SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) #define SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c index d7d81924f1..e445c43181 100644 --- a/source3/modules/vfs_commit.c +++ b/source3/modules/vfs_commit.c @@ -248,14 +248,13 @@ static ssize_t commit_write( static ssize_t commit_pwrite( vfs_handle_struct * handle, files_struct * fsp, - int fd, void * data, size_t count, SMB_OFF_T offset) { ssize_t ret; - ret = SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, count, offset); + ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, count, offset); if (ret > 0) { if (commit(handle, fsp, offset, ret) == -1) { return -1; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 4f9d90abde..b4ce9346e2 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -272,38 +272,38 @@ static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, int f return result; } -static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, +static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) { ssize_t result; #if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64) START_PROFILE_BYTES(syscall_pwrite, n); - result = sys_pwrite(fd, data, n, offset); + result = sys_pwrite(fsp->fh->fd, data, n, offset); END_PROFILE(syscall_pwrite); if (result == -1 && errno == ESPIPE) { /* Maintain the fiction that pipes can be sought on. */ - result = SMB_VFS_WRITE(fsp, fd, data, n); + result = SMB_VFS_WRITE(fsp, fsp->fh->fd, data, n); } #else /* HAVE_PWRITE */ SMB_OFF_T curr; int lerrno; - curr = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR); + curr = SMB_VFS_LSEEK(fsp, fsp->fh->fd, 0, SEEK_CUR); if (curr == -1) { return -1; } - if (SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET) == -1) { + if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, offset, SEEK_SET) == -1) { return -1; } - result = SMB_VFS_WRITE(fsp, fd, data, n); + result = SMB_VFS_WRITE(fsp, fsp->fh->fd, data, n); lerrno = errno; - SMB_VFS_LSEEK(fsp, fd, curr, SEEK_SET); + SMB_VFS_LSEEK(fsp, fsp->fh->fd, curr, SEEK_SET); errno = lerrno; #endif /* HAVE_PWRITE */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 7acca905a0..c0bc40cc67 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -119,7 +119,7 @@ static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n); static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp, - int fd, const void *data, size_t n, + const void *data, size_t n, SMB_OFF_T offset); static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence); @@ -1124,12 +1124,12 @@ static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp } static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp, - int fd, const void *data, size_t n, + const void *data, size_t n, SMB_OFF_T offset) { ssize_t result; - result = SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset); + result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index bc272914c7..aa914797d1 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -485,8 +485,8 @@ ssize_t vfs_pwrite_data(struct smb_request *req, } while (total < N) { - ret = SMB_VFS_PWRITE(fsp, fsp->fh->fd, buffer + total, - N - total, offset + total); + ret = SMB_VFS_PWRITE(fsp, buffer + total, N - total, + offset + total); if (ret == -1) return -1; @@ -641,7 +641,7 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len) while (total < num_to_write) { size_t curr_write_size = MIN(SPARSE_BUF_WRITE_SIZE, (num_to_write - total)); - pwrite_ret = SMB_VFS_PWRITE(fsp, fsp->fh->fd, sparse_buf, curr_write_size, offset + total); + pwrite_ret = SMB_VFS_PWRITE(fsp, sparse_buf, curr_write_size, offset + total); if (pwrite_ret == -1) { DEBUG(10,("vfs_fill_sparse: SMB_VFS_PWRITE for file %s failed with error %s\n", fsp->fsp_name, strerror(errno) )); -- cgit From 6f657c873efa4779e762a8f9ede97e19da6fb7ec Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 10:15:08 +0100 Subject: Remove redundant parameter fd from SMB_VFS_LSEEK(). Michael (This used to be commit df929796f2698698d2875227bda8500589cca2df) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_default.c | 30 +++++++++++++++--------------- source3/modules/vfs_full_audit.c | 6 +++--- source3/printing/nt_printing.c | 8 ++++---- source3/smbd/reply.c | 6 +++--- source3/torture/cmd_vfs.c | 2 +- 9 files changed, 35 insertions(+), 34 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 1fb9b8056e..ea525bf2dd 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -150,9 +150,9 @@ ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, const v return vfswrap_pwrite(NULL, fsp, data, n, offset); } -static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) +static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence) { - return vfswrap_lseek(NULL, fsp, filedes, offset, whence); + return vfswrap_lseek(NULL, fsp, offset, whence); } static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index f702c93d80..8772718a74 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -144,9 +144,9 @@ static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const v return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); } -static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) +static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence) { - return SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence); + return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence); } static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 6f3232cbf9..279841e501 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -81,6 +81,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from gset_nt_acl. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from pread. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from pwrite. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -274,7 +275,7 @@ struct vfs_ops { ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n); ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset); - SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence); + SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence); ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t count); int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 74a45814bd..2a8d0354d8 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -52,7 +52,7 @@ #define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (data), (n), (off))) -#define SMB_VFS_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (fd), (offset), (whence))) +#define SMB_VFS_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (offset), (whence))) #define SMB_VFS_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) #define SMB_VFS_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) #define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new))) @@ -171,7 +171,7 @@ #define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_OPAQUE_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_OPAQUE_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (data), (n), (off))) -#define SMB_VFS_OPAQUE_LSEEK(fsp, fd, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (fd), (offset), (whence))) +#define SMB_VFS_OPAQUE_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (offset), (whence))) #define SMB_VFS_OPAQUE_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) #define SMB_VFS_OPAQUE_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) #define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new))) @@ -291,7 +291,7 @@ #define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (data), (n), (off))) -#define SMB_VFS_NEXT_LSEEK(handle, fsp, fd, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (fd), (offset), (whence))) +#define SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (offset), (whence))) #define SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) #define SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) #define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index b4ce9346e2..41162e67ca 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -238,7 +238,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void SMB_OFF_T curr; int lerrno; - curr = SMB_VFS_LSEEK(fsp, fsp->fh->fd, 0, SEEK_CUR); + curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); if (curr == -1 && errno == ESPIPE) { /* Maintain the fiction that pipes can be seeked (sought?) on. */ result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); @@ -246,7 +246,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void return result; } - if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, offset, SEEK_SET) == -1) { + if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) { return -1; } @@ -254,7 +254,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); lerrno = errno; - SMB_VFS_LSEEK(fsp, fsp->fh->fd, curr, SEEK_SET); + SMB_VFS_LSEEK(fsp, curr, SEEK_SET); errno = lerrno; #endif /* HAVE_PREAD */ @@ -291,19 +291,19 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons SMB_OFF_T curr; int lerrno; - curr = SMB_VFS_LSEEK(fsp, fsp->fh->fd, 0, SEEK_CUR); + curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); if (curr == -1) { return -1; } - if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, offset, SEEK_SET) == -1) { + if (SMB_VFS_LSEEK(fsp, offset, SEEK_SET) == -1) { return -1; } result = SMB_VFS_WRITE(fsp, fsp->fh->fd, data, n); lerrno = errno; - SMB_VFS_LSEEK(fsp, fsp->fh->fd, curr, SEEK_SET); + SMB_VFS_LSEEK(fsp, curr, SEEK_SET); errno = lerrno; #endif /* HAVE_PWRITE */ @@ -311,15 +311,15 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons return result; } -static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence) +static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence) { SMB_OFF_T result = 0; START_PROFILE(syscall_lseek); /* Cope with 'stat' file opens. */ - if (filedes != -1) - result = sys_lseek(filedes, offset, whence); + if (fsp->fh->fd != -1) + result = sys_lseek(fsp->fh->fd, offset, whence); /* * We want to maintain the fiction that we can seek @@ -677,7 +677,7 @@ static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const str static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T len) { SMB_STRUCT_STAT st; - SMB_OFF_T currpos = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR); + SMB_OFF_T currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); unsigned char zero_space[4096]; SMB_OFF_T space_to_write; @@ -702,7 +702,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs return sys_ftruncate(fd, len); /* Write out the real space on disk. */ - if (SMB_VFS_LSEEK(fsp, fd, st.st_size, SEEK_SET) != st.st_size) + if (SMB_VFS_LSEEK(fsp, st.st_size, SEEK_SET) != st.st_size) return -1; space_to_write = len - st.st_size; @@ -720,7 +720,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs } /* Seek to where we were */ - if (SMB_VFS_LSEEK(fsp, fd, currpos, SEEK_SET) != currpos) + if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos) return -1; return 0; @@ -754,7 +754,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot extend a file with ftruncate. Provide alternate implementation for this */ - currpos = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR); + currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); if (currpos == -1) { goto done; } @@ -784,14 +784,14 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f goto done; } - if (SMB_VFS_LSEEK(fsp, fd, len-1, SEEK_SET) != len -1) + if (SMB_VFS_LSEEK(fsp, len-1, SEEK_SET) != len -1) goto done; if (SMB_VFS_WRITE(fsp, fd, &c, 1)!=1) goto done; /* Seek to where we were */ - if (SMB_VFS_LSEEK(fsp, fd, currpos, SEEK_SET) != currpos) + if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos) goto done; result = 0; diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index c0bc40cc67..b03f6b53f4 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -122,7 +122,7 @@ static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fs const void *data, size_t n, SMB_OFF_T offset); static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp, - int filedes, SMB_OFF_T offset, int whence); + SMB_OFF_T offset, int whence); static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr, SMB_OFF_T offset, @@ -1137,11 +1137,11 @@ static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fs } static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp, - int filedes, SMB_OFF_T offset, int whence) + SMB_OFF_T offset, int whence) { ssize_t result; - result = SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence); + result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence); do_log(SMB_VFS_OP_LSEEK, (result != (ssize_t)-1), handle, "%s", fsp->fsp_name); diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index bae32e89f7..b661b6fd56 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1097,7 +1097,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32 } /* Skip OEM header (if any) and the DOS stub to start of Windows header */ - if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, SVAL(buf,DOS_HEADER_LFANEW_OFFSET), SEEK_SET) == (SMB_OFF_T)-1) { + if (SMB_VFS_LSEEK(fsp, SVAL(buf,DOS_HEADER_LFANEW_OFFSET), SEEK_SET) == (SMB_OFF_T)-1) { DEBUG(3,("get_file_version: File [%s] too short, errno = %d\n", fname, errno)); /* Assume this isn't an error... the file just looks sort of like a PE/NE file */ @@ -1118,7 +1118,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32 unsigned int section_table_bytes; /* Just skip over optional header to get to section table */ - if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, + if (SMB_VFS_LSEEK(fsp, SVAL(buf,PE_HEADER_OPTIONAL_HEADER_SIZE)-(NE_HEADER_SIZE-PE_HEADER_SIZE), SEEK_CUR) == (SMB_OFF_T)-1) { DEBUG(3,("get_file_version: File [%s] Windows optional header too short, errno = %d\n", @@ -1164,7 +1164,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32 } /* Seek to the start of the .rsrc section info */ - if (SMB_VFS_LSEEK(fsp, fsp->fh->fd, section_pos, SEEK_SET) == (SMB_OFF_T)-1) { + if (SMB_VFS_LSEEK(fsp, section_pos, SEEK_SET) == (SMB_OFF_T)-1) { DEBUG(3,("get_file_version: PE file [%s] too short for section info, errno = %d\n", fname, errno)); goto error_exit; @@ -1260,7 +1260,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32 * twice, as it is simpler to read the code. */ if (strcmp(&buf[i], VS_SIGNATURE) == 0) { /* Compute skip alignment to next long address */ - int skip = -(SMB_VFS_LSEEK(fsp, fsp->fh->fd, 0, SEEK_CUR) - (byte_count - i) + + int skip = -(SMB_VFS_LSEEK(fsp, 0, SEEK_CUR) - (byte_count - i) + sizeof(VS_SIGNATURE)) & 3; if (IVAL(buf,i+sizeof(VS_SIGNATURE)+skip) != 0xfeef04bd) continue; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index d5e683ca3c..910e3a27a6 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -4091,7 +4091,7 @@ void reply_lseek(struct smb_request *req) } if (umode == SEEK_END) { - if((res = SMB_VFS_LSEEK(fsp,fsp->fh->fd,startpos,umode)) == -1) { + if((res = SMB_VFS_LSEEK(fsp,startpos,umode)) == -1) { if(errno == EINVAL) { SMB_OFF_T current_pos = startpos; SMB_STRUCT_STAT sbuf; @@ -4105,7 +4105,7 @@ void reply_lseek(struct smb_request *req) current_pos += sbuf.st_size; if(current_pos < 0) - res = SMB_VFS_LSEEK(fsp,fsp->fh->fd,0,SEEK_SET); + res = SMB_VFS_LSEEK(fsp,0,SEEK_SET); } } @@ -6052,7 +6052,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx, } if ((ofun&3) == 1) { - if(SMB_VFS_LSEEK(fsp2,fsp2->fh->fd,0,SEEK_END) == -1) { + if(SMB_VFS_LSEEK(fsp2,0,SEEK_END) == -1) { DEBUG(0,("copy_file: error - vfs lseek returned error %s\n", strerror(errno) )); /* * Stop the copy from occurring. diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 02bee835b0..e595ac9f8b 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -440,7 +440,7 @@ static NTSTATUS cmd_lseek(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, default: whence = SEEK_END; } - pos = SMB_VFS_LSEEK(vfs->files[fd], fd, offset, whence); + pos = SMB_VFS_LSEEK(vfs->files[fd], offset, whence); if (pos == (SMB_OFF_T)-1) { printf("lseek: error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; -- cgit From 8dcce0d236b2102ca94fbcb7aa7126fe6733f2e7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 12:49:02 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FSYNC(). Michael (This used to be commit 8f83c9a7b245dbfef28195f9a7f33047a8ba95a0) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/fileio.c | 2 +- source3/torture/cmd_vfs.c | 2 +- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index ea525bf2dd..2ae24312b4 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -171,9 +171,9 @@ static int skel_rename(vfs_handle_struct *handle, const char *oldname, const ch return vfswrap_rename(NULL, oldname, newname); } -static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) +static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp) { - return vfswrap_fsync(NULL, fsp, fd); + return vfswrap_fsync(NULL, fsp); } static int skel_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 8772718a74..ea20312514 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -164,9 +164,9 @@ static int skel_rename(vfs_handle_struct *handle, const char *oldname, const ch return SMB_VFS_NEXT_RENAME(handle, oldname, newname); } -static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) +static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp) { - return SMB_VFS_NEXT_FSYNC(handle, fsp, fd); + return SMB_VFS_NEXT_FSYNC(handle, fsp); } static int skel_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 279841e501..4f4e30b614 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -82,6 +82,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from pread. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from pwrite. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -279,7 +280,7 @@ struct vfs_ops { ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t count); int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname); - int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); + int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp); int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf); int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf); int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 2a8d0354d8..9ff31e5112 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -56,7 +56,7 @@ #define SMB_VFS_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) #define SMB_VFS_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) #define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new))) -#define SMB_VFS_FSYNC(fsp, fd) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp), (fd))) +#define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp))) #define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf))) #define SMB_VFS_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp) ,(fd) ,(sbuf))) #define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf))) @@ -175,7 +175,7 @@ #define SMB_VFS_OPAQUE_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) #define SMB_VFS_OPAQUE_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) #define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new))) -#define SMB_VFS_OPAQUE_FSYNC(fsp, fd) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp), (fd))) +#define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp))) #define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf))) #define SMB_VFS_OPAQUE_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp) ,(fd) ,(sbuf))) #define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf))) @@ -295,7 +295,7 @@ #define SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) #define SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) #define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new))) -#define SMB_VFS_NEXT_FSYNC(handle, fsp, fd) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp), (fd))) +#define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp))) #define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf))) #define SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp) ,(fd) ,(sbuf))) #define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 41162e67ca..8aa1709647 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -467,13 +467,13 @@ static int vfswrap_rename(vfs_handle_struct *handle, const char *oldname, const return result; } -static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) +static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp) { #ifdef HAVE_FSYNC int result; START_PROFILE(syscall_fsync); - result = fsync(fd); + result = fsync(fsp->fh->fd); END_PROFILE(syscall_fsync); return result; #else diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index b03f6b53f4..396b2bbb68 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -133,7 +133,7 @@ static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd, size_t n); static int smb_full_audit_rename(vfs_handle_struct *handle, const char *oldname, const char *newname); -static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd); +static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp); static int smb_full_audit_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf); static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, @@ -1193,11 +1193,11 @@ static int smb_full_audit_rename(vfs_handle_struct *handle, return result; } -static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd) +static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp) { int result; - result = SMB_VFS_NEXT_FSYNC(handle, fsp, fd); + result = SMB_VFS_NEXT_FSYNC(handle, fsp); do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index a648326f89..5a4263739b 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -879,7 +879,7 @@ NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_throug if (ret == -1) { return map_nt_error_from_unix(errno); } - ret = SMB_VFS_FSYNC(fsp,fsp->fh->fd); + ret = SMB_VFS_FSYNC(fsp); if (ret == -1) { return map_nt_error_from_unix(errno); } diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index e595ac9f8b..17f4b9bfc0 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -479,7 +479,7 @@ static NTSTATUS cmd_fsync(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, } fd = atoi(argv[1]); - ret = SMB_VFS_FSYNC(vfs->files[fd], fd); + ret = SMB_VFS_FSYNC(vfs->files[fd]); if (ret == -1) { printf("fsync: error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; -- cgit From 87a684f7fcfa8d9fabc42e33981299d0b33eeeb7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 13:21:26 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FSTAT(). Michael (This used to be commit 0b86c420be94d295f6917a220b5d699f65b46711) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 4 +++- source3/include/vfs_macros.h | 6 +++--- source3/modules/nfs4_acls.c | 2 +- source3/modules/vfs_afsacl.c | 2 +- source3/modules/vfs_commit.c | 2 +- source3/modules/vfs_default.c | 8 ++++---- source3/modules/vfs_fake_perms.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/modules/vfs_gpfs.c | 2 +- source3/printing/nt_printing.c | 4 ++-- source3/printing/printfsp.c | 2 +- source3/smbd/fileio.c | 4 ++-- source3/smbd/open.c | 6 +++--- source3/smbd/posix_acls.c | 6 +++--- source3/smbd/reply.c | 8 ++++---- source3/smbd/trans2.c | 4 ++-- source3/smbd/vfs.c | 4 ++-- source3/torture/cmd_vfs.c | 2 +- 20 files changed, 43 insertions(+), 41 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 2ae24312b4..361cf207d3 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -181,9 +181,9 @@ static int skel_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_S return vfswrap_stat(NULL, fname, sbuf); } -static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) +static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) { - return vfswrap_fstat(NULL, fsp, fd, sbuf); + return vfswrap_fstat(NULL, fsp, sbuf); } static int skel_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index ea20312514..72ca6f2056 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -174,9 +174,9 @@ static int skel_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_S return SMB_VFS_NEXT_STAT(handle, fname, sbuf); } -static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) +static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) { - return SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf); + return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); } static int skel_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 4f4e30b614..f4422e4fa9 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -83,6 +83,8 @@ /* Leave at 22 - not yet released. Remove parameter fd from pwrite. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox */ + #define SMB_VFS_INTERFACE_VERSION 22 @@ -282,7 +284,7 @@ struct vfs_ops { int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname); int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp); int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf); - int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf); + int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf); int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); int (*unlink)(struct vfs_handle_struct *handle, const char *path); int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 9ff31e5112..693d464f10 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -58,7 +58,7 @@ #define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new))) #define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp))) #define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf))) -#define SMB_VFS_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp) ,(fd) ,(sbuf))) +#define SMB_VFS_FSTAT(fsp, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp), (sbuf))) #define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf))) #define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path))) #define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode))) @@ -177,7 +177,7 @@ #define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new))) #define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp))) #define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf))) -#define SMB_VFS_OPAQUE_FSTAT(fsp, fd, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp) ,(fd) ,(sbuf))) +#define SMB_VFS_OPAQUE_FSTAT(fsp, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp), (sbuf))) #define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf))) #define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path))) #define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode))) @@ -297,7 +297,7 @@ #define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new))) #define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp))) #define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf))) -#define SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp) ,(fd) ,(sbuf))) +#define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp), (sbuf))) #define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf))) #define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path))) #define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode))) diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index 6d2972d8ed..52d3983fff 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -185,7 +185,7 @@ static int smbacl4_fGetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf) if (fsp->is_directory || fsp->fh->fd == -1) { return smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, psbuf); } - if (SMB_VFS_FSTAT(fsp,fsp->fh->fd, psbuf) != 0) + if (SMB_VFS_FSTAT(fsp, psbuf) != 0) { DEBUG(8, ("SMB_VFS_FSTAT failed with error %s\n", strerror(errno))); diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index 90c6a589a1..e35bfabb8c 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -684,7 +684,7 @@ static size_t afs_fto_nt_acl(struct afs_acl *afs_acl, security_info, ppdesc); } - if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) { + if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) { return 0; } diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c index e445c43181..f79e68f49e 100644 --- a/source3/modules/vfs_commit.c +++ b/source3/modules/vfs_commit.c @@ -217,7 +217,7 @@ static int commit_open( /* EOF commit modes require us to know the initial file size. */ if (c && (c->on_eof != EOF_NONE)) { SMB_STRUCT_STAT st; - if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) { + if (SMB_VFS_FSTAT(fsp, &st) == -1) { return -1; } c->eof = st.st_size; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 8aa1709647..dd3f4ba2cd 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -491,12 +491,12 @@ static int vfswrap_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUC return result; } -static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) +static int vfswrap_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) { int result; START_PROFILE(syscall_fstat); - result = sys_fstat(fd, sbuf); + result = sys_fstat(fsp->fh->fd, sbuf); END_PROFILE(syscall_fstat); return result; } @@ -684,7 +684,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs if (currpos == -1) return -1; - if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) + if (SMB_VFS_FSTAT(fsp, &st) == -1) return -1; space_to_write = len - st.st_size; @@ -763,7 +763,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f size in which case the ftruncate above should have succeeded or shorter, in which case seek to len - 1 and write 1 byte of zero */ - if (SMB_VFS_FSTAT(fsp, fd, &st) == -1) { + if (SMB_VFS_FSTAT(fsp, &st) == -1) { goto done; } diff --git a/source3/modules/vfs_fake_perms.c b/source3/modules/vfs_fake_perms.c index 8157f05d52..ddad0008a7 100644 --- a/source3/modules/vfs_fake_perms.c +++ b/source3/modules/vfs_fake_perms.c @@ -46,11 +46,11 @@ static int fake_perms_stat(vfs_handle_struct *handle, const char *fname, SMB_STR return ret; } -static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) +static int fake_perms_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) { int ret = -1; - ret = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf); + ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); if (ret == 0) { if (S_ISDIR(sbuf->st_mode)) { sbuf->st_mode = S_IFDIR | S_IRWXU; diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 396b2bbb68..7464bf80b3 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -136,7 +136,7 @@ static int smb_full_audit_rename(vfs_handle_struct *handle, static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp); static int smb_full_audit_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf); -static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, +static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf); static int smb_full_audit_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); @@ -1216,12 +1216,12 @@ static int smb_full_audit_stat(vfs_handle_struct *handle, return result; } -static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, +static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) { int result; - result = SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf); + result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 0f7dc81ae6..500a6ee772 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -645,7 +645,7 @@ static int vfs_gpfs_chmod(vfs_handle_struct *handle, const char *path, mode_t mo static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) { SMB_STRUCT_STAT st; - if (SMB_VFS_NEXT_FSTAT(handle, fsp, fd, &st) != 0) { + if (SMB_VFS_NEXT_FSTAT(handle, fsp, &st) != 0) { return -1; } /* avoid chmod() if possible, to preserve acls */ diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index b661b6fd56..1a4a26ee6f 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1360,7 +1360,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr DEBUG(6,("file_version_is_newer: Version info not found [%s], use mod time\n", old_file)); use_version = false; - if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &st) == -1) { + if (SMB_VFS_FSTAT(fsp, &st) == -1) { goto error_exit; } old_create_time = st.st_mtime; @@ -1400,7 +1400,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr DEBUG(6,("file_version_is_newer: Version info not found [%s], use mod time\n", new_file)); use_version = false; - if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &st) == -1) { + if (SMB_VFS_FSTAT(fsp, &st) == -1) { goto error_exit; } new_create_time = st.st_mtime; diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c index 337fd4f74b..1fde16b802 100644 --- a/source3/printing/printfsp.c +++ b/source3/printing/printfsp.c @@ -83,7 +83,7 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname, fsp->is_directory = False; string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid)); fsp->wcp = NULL; - SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf); + SMB_VFS_FSTAT(fsp, &sbuf); fsp->mode = sbuf.st_mode; fsp->file_id = vfs_file_id_from_sbuf(conn, &sbuf); diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 5a4263739b..1258b73cad 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -229,7 +229,7 @@ ssize_t write_file(struct smb_request *req, SMB_STRUCT_STAT st; fsp->modified = True; - if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st) == 0) { + if (SMB_VFS_FSTAT(fsp, &st) == 0) { int dosmode = dos_mode(fsp->conn,fsp->fsp_name,&st); if ((lp_store_dos_attributes(SNUM(fsp->conn)) || MAP_ARCHIVE(fsp->conn)) && @@ -896,6 +896,6 @@ int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst) if (fsp->fh->fd == -1) { return SMB_VFS_STAT(fsp->conn, fsp->fsp_name, pst); } else { - return SMB_VFS_FSTAT(fsp,fsp->fh->fd, pst); + return SMB_VFS_FSTAT(fsp, pst); } } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 23d0223446..d870374835 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -342,7 +342,7 @@ static NTSTATUS open_file(files_struct *fsp, if (fsp->fh->fd == -1) { ret = SMB_VFS_STAT(conn, path, psbuf); } else { - ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf); + ret = SMB_VFS_FSTAT(fsp, psbuf); /* If we have an fd, this stat should succeed. */ if (ret == -1) { DEBUG(0,("Error doing fstat on open file %s " @@ -1790,7 +1790,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, * struct.. */ if ((SMB_VFS_FTRUNCATE(fsp,fsp->fh->fd,0) == -1) || - (SMB_VFS_FSTAT(fsp,fsp->fh->fd,psbuf)==-1)) { + (SMB_VFS_FSTAT(fsp, psbuf)==-1)) { status = map_nt_error_from_unix(errno); TALLOC_FREE(lck); fd_close(fsp); @@ -2675,7 +2675,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn, *psbuf = sbuf; } else { - SMB_VFS_FSTAT(fsp, fsp->fh->fd, psbuf); + SMB_VFS_FSTAT(fsp, psbuf); } } return NT_STATUS_OK; diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 2810b5e587..f11aa69e08 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -3080,7 +3080,7 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info, } /* Get the stat struct for the owner info. */ - if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) { + if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) { return map_nt_error_from_unix(errno); } @@ -3429,7 +3429,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0) return map_nt_error_from_unix(errno); } else { - if(SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) + if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) return map_nt_error_from_unix(errno); } @@ -3479,7 +3479,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) if(fsp->fh->fd == -1) ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf); else - ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf); + ret = SMB_VFS_FSTAT(fsp, &sbuf); if(ret != 0) return map_nt_error_from_unix(errno); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 910e3a27a6..27f380a627 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2835,7 +2835,7 @@ void reply_readbraw(struct smb_request *req) return; } - if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st) == 0) { + if (SMB_VFS_FSTAT(fsp, &st) == 0) { size = st.st_size; } @@ -3096,7 +3096,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req, SMB_STRUCT_STAT sbuf; ssize_t nread = -1; - if(SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf) == -1) { + if(SMB_VFS_FSTAT(fsp, &sbuf) == -1) { reply_unixerror(req, ERRDOS, ERRnoaccess); return; } @@ -4096,7 +4096,7 @@ void reply_lseek(struct smb_request *req) SMB_OFF_T current_pos = startpos; SMB_STRUCT_STAT sbuf; - if(SMB_VFS_FSTAT(fsp,fsp->fh->fd, &sbuf) == -1) { + if(SMB_VFS_FSTAT(fsp, &sbuf) == -1) { reply_unixerror(req, ERRDOS, ERRnoaccess); END_PROFILE(SMBlseek); @@ -5485,7 +5485,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, /* Ensure we have a valid stat struct for the source. */ if (fsp->fh->fd != -1) { - if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) == -1) { + if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) { return map_nt_error_from_unix(errno); } } else { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index c3b5f9fa2f..ab6706aec7 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3663,7 +3663,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn, return; } - if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&sbuf) != 0) { + if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) { DEBUG(3,("fstat of fnum %d failed (%s)\n", fsp->fnum, strerror(errno))); reply_unixerror(req, ERRDOS, ERRbadfid); return; @@ -6346,7 +6346,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn, return; } - if (SMB_VFS_FSTAT(fsp, fsp->fh->fd, &sbuf) != 0) { + if (SMB_VFS_FSTAT(fsp, &sbuf) != 0) { DEBUG(3,("call_trans2setfilepathinfo: fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno))); reply_unixerror(req, ERRDOS, ERRbadfid); return; diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index aa914797d1..c7edac7b7a 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -525,7 +525,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len) return -1; } - ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st); + ret = SMB_VFS_FSTAT(fsp, &st); if (ret == -1) return ret; @@ -612,7 +612,7 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len) ssize_t pwrite_ret; release_level_2_oplocks_on_change(fsp); - ret = SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st); + ret = SMB_VFS_FSTAT(fsp, &st); if (ret == -1) { return ret; } diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 17f4b9bfc0..7c8d070e06 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -572,7 +572,7 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, return NT_STATUS_OK; } - if (SMB_VFS_FSTAT(vfs->files[fd], fd, &st) == -1) { + if (SMB_VFS_FSTAT(vfs->files[fd], &st) == -1) { printf("fstat: error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; } -- cgit From e614dec27f33c932c6c29c806d567fd6015cd5e6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 13:44:37 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FCHMOD(). Michael (This used to be commit a54d5604da556d1250ca9948d4acc4a187a9fede) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_audit.c | 6 +++--- source3/modules/vfs_default.c | 6 +++--- source3/modules/vfs_extd_audit.c | 6 +++--- source3/modules/vfs_full_audit.c | 6 +++--- source3/modules/vfs_gpfs.c | 4 ++-- source3/smbd/dosmode.c | 2 +- source3/smbd/open.c | 2 +- source3/torture/cmd_vfs.c | 2 +- 12 files changed, 26 insertions(+), 25 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 361cf207d3..ac3ee6bd23 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -201,9 +201,9 @@ static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) return vfswrap_chmod(NULL, path, mode); } -static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { - return vfswrap_fchmod(NULL, fsp, fd, mode); + return vfswrap_fchmod(NULL, fsp, mode); } static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 72ca6f2056..0cae379445 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -194,9 +194,9 @@ static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) return SMB_VFS_NEXT_CHMOD(handle, path, mode); } -static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { - return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode); + return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); } static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index f4422e4fa9..95e863b690 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -84,6 +84,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fchmod. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -288,7 +289,7 @@ struct vfs_ops { int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); int (*unlink)(struct vfs_handle_struct *handle, const char *path); int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode); - int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode); + int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode); int (*chown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid); int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uid_t uid, gid_t gid); int (*lchown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 693d464f10..74fb802f39 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -62,7 +62,7 @@ #define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf))) #define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path))) #define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode))) -#define SMB_VFS_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (fd), (mode))) +#define SMB_VFS_FCHMOD(fsp, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (mode))) #define SMB_VFS_CHOWN(conn, path, uid, gid) ((conn)->vfs.ops.chown((conn)->vfs.handles.chown, (path), (uid), (gid))) #define SMB_VFS_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (fd), (uid), (gid))) #define SMB_VFS_LCHOWN(conn, path, uid, gid) ((conn)->vfs.ops.lchown((conn)->vfs.handles.lchown, (path), (uid), (gid))) @@ -181,7 +181,7 @@ #define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf))) #define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path))) #define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode))) -#define SMB_VFS_OPAQUE_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (fd), (mode))) +#define SMB_VFS_OPAQUE_FCHMOD(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (mode))) #define SMB_VFS_OPAQUE_CHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.chown((conn)->vfs_opaque.handles.chown, (path), (uid), (gid))) #define SMB_VFS_OPAQUE_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (fd), (uid), (gid))) #define SMB_VFS_OPAQUE_LCHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.lchown((conn)->vfs_opaque.handles.lchown, (path), (uid), (gid))) @@ -301,7 +301,7 @@ #define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf))) #define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path))) #define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode))) -#define SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (fd), (mode))) +#define SMB_VFS_NEXT_FCHMOD(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (mode))) #define SMB_VFS_NEXT_CHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.chown((handle)->vfs_next.handles.chown, (path), (uid), (gid))) #define SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (fd), (uid), (gid))) #define SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.lchown((handle)->vfs_next.handles.lchown, (path), (uid), (gid))) diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c index 91993a47d7..27e7f998ab 100644 --- a/source3/modules/vfs_audit.c +++ b/source3/modules/vfs_audit.c @@ -39,7 +39,7 @@ static int audit_rename(vfs_handle_struct *handle, const char *oldname, const ch static int audit_unlink(vfs_handle_struct *handle, const char *path); static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode); static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode); -static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode); +static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode); static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode); /* VFS operations */ @@ -268,11 +268,11 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m return result; } -static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; - result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode); + result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n", fsp->fsp_name, mode, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index dd3f4ba2cd..d296b5bd5b 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -549,7 +549,7 @@ static int vfswrap_chmod(vfs_handle_struct *handle, const char *path, mode_t mo return result; } -static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; @@ -563,7 +563,7 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, { int saved_errno = errno; /* We might get ENOSYS */ - if ((result = SMB_VFS_FCHMOD_ACL(fsp, fd, mode)) == 0) { + if ((result = SMB_VFS_FCHMOD_ACL(fsp, fsp->fh->fd, mode)) == 0) { END_PROFILE(syscall_fchmod); return result; } @@ -572,7 +572,7 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, } #if defined(HAVE_FCHMOD) - result = fchmod(fd, mode); + result = fchmod(fsp->fh->fd, mode); #else result = -1; errno = ENOSYS; diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c index 552c64016e..f9b03731e7 100644 --- a/source3/modules/vfs_extd_audit.c +++ b/source3/modules/vfs_extd_audit.c @@ -42,7 +42,7 @@ static int audit_rename(vfs_handle_struct *handle, const char *oldname, const ch static int audit_unlink(vfs_handle_struct *handle, const char *path); static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode); static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode); -static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode); +static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode); static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode); /* VFS operations */ @@ -310,11 +310,11 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m return result; } -static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; - result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode); + result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n", fsp->fsp_name, mode, diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 7464bf80b3..fee65ba53f 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -144,7 +144,7 @@ static int smb_full_audit_unlink(vfs_handle_struct *handle, const char *path); static int smb_full_audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode); -static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, +static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode); static int smb_full_audit_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid); @@ -1264,12 +1264,12 @@ static int smb_full_audit_chmod(vfs_handle_struct *handle, return result; } -static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, +static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; - result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode); + result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle, "%s|%o", fsp->fsp_name, mode); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 500a6ee772..832dcbfcad 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -642,7 +642,7 @@ static int vfs_gpfs_chmod(vfs_handle_struct *handle, const char *path, mode_t mo return SMB_VFS_NEXT_CHMOD(handle, path, mode); } -static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { SMB_STRUCT_STAT st; if (SMB_VFS_NEXT_FSTAT(handle, fsp, &st) != 0) { @@ -652,7 +652,7 @@ static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, if ((st.st_mode & ~S_IFMT) == mode) { return 0; } - return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode); + return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); } /* VFS operations structure */ diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index a96f80ee0e..d3813f9b41 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -538,7 +538,7 @@ int file_set_dosmode(connection_struct *conn, const char *fname, if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,st,&fsp))) return -1; become_root(); - ret = SMB_VFS_FCHMOD(fsp, fsp->fh->fd, unixmode); + ret = SMB_VFS_FCHMOD(fsp, unixmode); unbecome_root(); close_file_fchmod(fsp); if (!newfile) { diff --git a/source3/smbd/open.c b/source3/smbd/open.c index d870374835..c7b053d531 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1915,7 +1915,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, } if ((ret == -1) && - (SMB_VFS_FCHMOD(fsp, fsp->fh->fd, new_unx_mode) == -1)) + (SMB_VFS_FCHMOD(fsp, new_unx_mode) == -1)) DEBUG(5, ("open_file_ntcreate: failed to reset " "attributes of file %s to 0%o\n", fname, (unsigned int)new_unx_mode)); diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 7c8d070e06..1a042ba3b0 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -706,7 +706,7 @@ static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, return NT_STATUS_OK; } - if (SMB_VFS_FCHMOD(vfs->files[fd], fd, mode) == -1) { + if (SMB_VFS_FCHMOD(vfs->files[fd], mode) == -1) { printf("fchmod: error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; } -- cgit From 670909cb07e38a06bf5db12342b3b1189f0e1ab7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 14:26:00 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FCHOWN(). Michael (This used to be commit fbb193db3e0dc51cb000ae406a68bc547f31d9ab) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/open.c | 2 +- source3/smbd/posix_acls.c | 2 +- source3/torture/cmd_vfs.c | 2 +- 9 files changed, 17 insertions(+), 16 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index ac3ee6bd23..185694f6fa 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -211,9 +211,9 @@ static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, g return vfswrap_chown(NULL, path, uid, gid); } -static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid) +static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) { - return vfswrap_fchown(NULL, fsp, fd, uid, gid); + return vfswrap_fchown(NULL, fsp, uid, gid); } static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 0cae379445..d4af67db51 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -204,9 +204,9 @@ static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, g return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid); } -static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid) +static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) { - return SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid); + return SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid); } static int skel_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 95e863b690..88975302b2 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -85,6 +85,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fchmod. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fchown. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -291,7 +292,7 @@ struct vfs_ops { int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode); int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode); int (*chown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid); - int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uid_t uid, gid_t gid); + int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, uid_t uid, gid_t gid); int (*lchown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid); int (*chdir)(struct vfs_handle_struct *handle, const char *path); char *(*getwd)(struct vfs_handle_struct *handle, char *buf); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 74fb802f39..366481039e 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -64,7 +64,7 @@ #define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode))) #define SMB_VFS_FCHMOD(fsp, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (mode))) #define SMB_VFS_CHOWN(conn, path, uid, gid) ((conn)->vfs.ops.chown((conn)->vfs.handles.chown, (path), (uid), (gid))) -#define SMB_VFS_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (fd), (uid), (gid))) +#define SMB_VFS_FCHOWN(fsp, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (uid), (gid))) #define SMB_VFS_LCHOWN(conn, path, uid, gid) ((conn)->vfs.ops.lchown((conn)->vfs.handles.lchown, (path), (uid), (gid))) #define SMB_VFS_CHDIR(conn, path) ((conn)->vfs.ops.chdir((conn)->vfs.handles.chdir, (path))) #define SMB_VFS_GETWD(conn, buf) ((conn)->vfs.ops.getwd((conn)->vfs.handles.getwd, (buf))) @@ -183,7 +183,7 @@ #define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode))) #define SMB_VFS_OPAQUE_FCHMOD(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (mode))) #define SMB_VFS_OPAQUE_CHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.chown((conn)->vfs_opaque.handles.chown, (path), (uid), (gid))) -#define SMB_VFS_OPAQUE_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (fd), (uid), (gid))) +#define SMB_VFS_OPAQUE_FCHOWN(fsp, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (uid), (gid))) #define SMB_VFS_OPAQUE_LCHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.lchown((conn)->vfs_opaque.handles.lchown, (path), (uid), (gid))) #define SMB_VFS_OPAQUE_CHDIR(conn, path) ((conn)->vfs_opaque.ops.chdir((conn)->vfs_opaque.handles.chdir, (path))) #define SMB_VFS_OPAQUE_GETWD(conn, buf) ((conn)->vfs_opaque.ops.getwd((conn)->vfs_opaque.handles.getwd, (buf))) @@ -303,7 +303,7 @@ #define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode))) #define SMB_VFS_NEXT_FCHMOD(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (mode))) #define SMB_VFS_NEXT_CHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.chown((handle)->vfs_next.handles.chown, (path), (uid), (gid))) -#define SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (fd), (uid), (gid))) +#define SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (uid), (gid))) #define SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.lchown((handle)->vfs_next.handles.lchown, (path), (uid), (gid))) #define SMB_VFS_NEXT_CHDIR(handle, path) ((handle)->vfs_next.ops.chdir((handle)->vfs_next.handles.chdir, (path))) #define SMB_VFS_NEXT_GETWD(handle, buf) ((handle)->vfs_next.ops.getwd((handle)->vfs_next.handles.getwd, (buf))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index d296b5bd5b..f66f77cd47 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -592,13 +592,13 @@ static int vfswrap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, return result; } -static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid) +static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) { #ifdef HAVE_FCHOWN int result; START_PROFILE(syscall_fchown); - result = fchown(fd, uid, gid); + result = fchown(fsp->fh->fd, uid, gid); END_PROFILE(syscall_fchown); return result; #else diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index fee65ba53f..f7796adba0 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -148,7 +148,7 @@ static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode); static int smb_full_audit_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid); -static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, +static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid); static int smb_full_audit_lchown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid); @@ -1290,12 +1290,12 @@ static int smb_full_audit_chown(vfs_handle_struct *handle, return result; } -static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, +static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid) { int result; - result = SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid); + result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid); do_log(SMB_VFS_OP_FCHOWN, (result >= 0), handle, "%s|%ld|%ld", fsp->fsp_name, (long int)uid, (long int)gid); diff --git a/source3/smbd/open.c b/source3/smbd/open.c index c7b053d531..036e3e12a2 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -102,7 +102,7 @@ static void change_file_owner_to_parent(connection_struct *conn, } become_root(); - ret = SMB_VFS_FCHOWN(fsp, fsp->fh->fd, parent_st.st_uid, (gid_t)-1); + ret = SMB_VFS_FCHOWN(fsp, parent_st.st_uid, (gid_t)-1); unbecome_root(); if (ret == -1) { DEBUG(0,("change_file_owner_to_parent: failed to fchown " diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index f11aa69e08..1aa3001923 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -3194,7 +3194,7 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid) become_root(); /* Keep the current file gid the same. */ - ret = SMB_VFS_FCHOWN(fsp, fsp->fh->fd, uid, (gid_t)-1); + ret = SMB_VFS_FCHOWN(fsp, uid, (gid_t)-1); unbecome_root(); close_file_fchmod(fsp); diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 1a042ba3b0..3947c3dd3c 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -758,7 +758,7 @@ static NTSTATUS cmd_fchown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, printf("fchown: error=%d (invalid file descriptor)\n", EBADF); return NT_STATUS_OK; } - if (SMB_VFS_FCHOWN(vfs->files[fd], fd, uid, gid) == -1) { + if (SMB_VFS_FCHOWN(vfs->files[fd], uid, gid) == -1) { printf("fchown error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; } -- cgit From b457b94bb86897b7020c6f300cd19a3d8e192610 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 15:55:09 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FTRUNCATE(). Michael (This used to be commit 2ad66050a0452b8e7e08b1e7a01efa00c72fd451) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_commit.c | 3 +-- source3/modules/vfs_default.c | 12 ++++++------ source3/modules/vfs_full_audit.c | 6 +++--- source3/modules/vfs_prealloc.c | 3 +-- source3/smbd/fileio.c | 2 +- source3/smbd/open.c | 2 +- source3/smbd/vfs.c | 4 ++-- source3/torture/cmd_vfs.c | 2 +- 12 files changed, 25 insertions(+), 26 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 185694f6fa..2ecfcf1b66 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -236,9 +236,9 @@ static int skel_ntimes(vfs_handle_struct *handle, const char *path, const struc return vfswrap_ntimes(NULL, path, ts); } -static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset) +static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset) { - return vfswrap_ftruncate(NULL, fsp, fd, offset); + return vfswrap_ftruncate(NULL, fsp, offset); } static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index d4af67db51..5d3103ee76 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -229,9 +229,9 @@ static int skel_ntimes(vfs_handle_struct *handle, const char *path, const struc return SMB_VFS_NEXT_NTIMES(handle, path, ts); } -static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset) +static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset) { - return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset); + return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset); } static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 88975302b2..a36cd551ee 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -86,6 +86,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fchmod. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fchown. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from ftruncate. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -297,7 +298,7 @@ struct vfs_ops { int (*chdir)(struct vfs_handle_struct *handle, const char *path); char *(*getwd)(struct vfs_handle_struct *handle, char *buf); int (*ntimes)(struct vfs_handle_struct *handle, const char *path, const struct timespec ts[2]); - int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset); + int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset); bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 share_mode); int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int leasetype); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 366481039e..2fc0dda3c8 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -69,7 +69,7 @@ #define SMB_VFS_CHDIR(conn, path) ((conn)->vfs.ops.chdir((conn)->vfs.handles.chdir, (path))) #define SMB_VFS_GETWD(conn, buf) ((conn)->vfs.ops.getwd((conn)->vfs.handles.getwd, (buf))) #define SMB_VFS_NTIMES(conn, path, ts) ((conn)->vfs.ops.ntimes((conn)->vfs.handles.ntimes, (path), (ts))) -#define SMB_VFS_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (fd), (offset))) +#define SMB_VFS_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) #define SMB_VFS_KERNEL_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (fd), (share_mode))) #define SMB_VFS_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (fd), (leasetype))) @@ -188,7 +188,7 @@ #define SMB_VFS_OPAQUE_CHDIR(conn, path) ((conn)->vfs_opaque.ops.chdir((conn)->vfs_opaque.handles.chdir, (path))) #define SMB_VFS_OPAQUE_GETWD(conn, buf) ((conn)->vfs_opaque.ops.getwd((conn)->vfs_opaque.handles.getwd, (buf))) #define SMB_VFS_OPAQUE_NTIMES(conn, path, ts) ((conn)->vfs_opaque.ops.ntimes((conn)->vfs_opaque.handles.ntimes, (path), (ts))) -#define SMB_VFS_OPAQUE_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (fd), (offset))) +#define SMB_VFS_OPAQUE_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_OPAQUE_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) #define SMB_VFS_OPAQUE_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (fd), (share_mode))) #define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (fd), (leasetype))) @@ -308,7 +308,7 @@ #define SMB_VFS_NEXT_CHDIR(handle, path) ((handle)->vfs_next.ops.chdir((handle)->vfs_next.handles.chdir, (path))) #define SMB_VFS_NEXT_GETWD(handle, buf) ((handle)->vfs_next.ops.getwd((handle)->vfs_next.handles.getwd, (buf))) #define SMB_VFS_NEXT_NTIMES(handle, path, ts) ((handle)->vfs_next.ops.ntimes((handle)->vfs_next.handles.ntimes, (path), (ts))) -#define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (fd), (offset))) +#define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) #define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, fd, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (fd), (share_mode))) #define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, fd, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (fd), (leasetype))) diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c index f79e68f49e..fe7324122f 100644 --- a/source3/modules/vfs_commit.c +++ b/source3/modules/vfs_commit.c @@ -277,12 +277,11 @@ static int commit_close( static int commit_ftruncate( vfs_handle_struct * handle, files_struct * fsp, - int fd, SMB_OFF_T len) { int result; - result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, len); + result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len); if (result == 0) { struct commit_info *c; if ((c = VFS_FETCH_FSP_EXTENSION(handle, fsp))) { diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index f66f77cd47..6ac8cc5def 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -674,7 +674,7 @@ static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const str allocate is set. **********************************************************************/ -static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T len) +static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len) { SMB_STRUCT_STAT st; SMB_OFF_T currpos = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); @@ -699,7 +699,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs /* Shrink - just ftruncate. */ if (st.st_size > len) - return sys_ftruncate(fd, len); + return sys_ftruncate(fsp->fh->fd, len); /* Write out the real space on disk. */ if (SMB_VFS_LSEEK(fsp, st.st_size, SEEK_SET) != st.st_size) @@ -726,7 +726,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs return 0; } -static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T len) +static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len) { int result = -1; SMB_STRUCT_STAT st; @@ -736,7 +736,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f START_PROFILE(syscall_ftruncate); if (lp_strict_allocate(SNUM(fsp->conn))) { - result = strict_allocate_ftruncate(handle, fsp, fd, len); + result = strict_allocate_ftruncate(handle, fsp, fsp->fh->fd, len); END_PROFILE(syscall_ftruncate); return result; } @@ -747,7 +747,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f expansion and some that don't! On Linux fat can't do ftruncate extend but ext2 can. */ - result = sys_ftruncate(fd, len); + result = sys_ftruncate(fsp->fh->fd, len); if (result == 0) goto done; @@ -787,7 +787,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int f if (SMB_VFS_LSEEK(fsp, len-1, SEEK_SET) != len -1) goto done; - if (SMB_VFS_WRITE(fsp, fd, &c, 1)!=1) + if (SMB_VFS_WRITE(fsp, fsp->fh->fd, &c, 1)!=1) goto done; /* Seek to where we were */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index f7796adba0..1384c16290 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -159,7 +159,7 @@ static char *smb_full_audit_getwd(vfs_handle_struct *handle, static int smb_full_audit_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2]); static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_OFF_T len); + SMB_OFF_T len); static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle, @@ -1353,11 +1353,11 @@ static int smb_full_audit_ntimes(vfs_handle_struct *handle, } static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_OFF_T len) + SMB_OFF_T len) { int result; - result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, len); + result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len); do_log(SMB_VFS_OP_FTRUNCATE, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_prealloc.c b/source3/modules/vfs_prealloc.c index cebf3a3933..2d64bc0184 100644 --- a/source3/modules/vfs_prealloc.c +++ b/source3/modules/vfs_prealloc.c @@ -184,11 +184,10 @@ normal_open: static int prealloc_ftruncate(vfs_handle_struct * handle, files_struct * fsp, - int fd, SMB_OFF_T offset) { SMB_OFF_T *psize; - int ret = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset); + int ret = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset); /* Maintain the allocated space even in the face of truncates. */ if ((psize = VFS_FETCH_FSP_EXTENSION(handle, fsp))) { diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 1258b73cad..8cea4989f5 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -184,7 +184,7 @@ static int wcp_file_size_change(files_struct *fsp) write_cache *wcp = fsp->wcp; wcp->file_size = wcp->offset + wcp->data_size; - ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, wcp->file_size); + ret = SMB_VFS_FTRUNCATE(fsp, wcp->file_size); if (ret == -1) { DEBUG(0,("wcp_file_size_change (%s): ftruncate of size %.0f error %s\n", fsp->fsp_name, (double)wcp->file_size, strerror(errno) )); diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 036e3e12a2..cc62e020da 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1789,7 +1789,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, * We are modifing the file after open - update the stat * struct.. */ - if ((SMB_VFS_FTRUNCATE(fsp,fsp->fh->fd,0) == -1) || + if ((SMB_VFS_FTRUNCATE(fsp, 0) == -1) || (SMB_VFS_FSTAT(fsp, psbuf)==-1)) { status = map_nt_error_from_unix(errno); TALLOC_FREE(lck); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index c7edac7b7a..9a5e0aff60 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -539,7 +539,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len) fsp->fsp_name, (double)st.st_size )); flush_write_cache(fsp, SIZECHANGE_FLUSH); - if ((ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, (SMB_OFF_T)len)) != -1) { + if ((ret = SMB_VFS_FTRUNCATE(fsp, (SMB_OFF_T)len)) != -1) { set_filelen_write_cache(fsp, len); } return ret; @@ -581,7 +581,7 @@ int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len) release_level_2_oplocks_on_change(fsp); DEBUG(10,("vfs_set_filelen: ftruncate %s to len %.0f\n", fsp->fsp_name, (double)len)); flush_write_cache(fsp, SIZECHANGE_FLUSH); - if ((ret = SMB_VFS_FTRUNCATE(fsp, fsp->fh->fd, len)) != -1) { + if ((ret = SMB_VFS_FTRUNCATE(fsp, len)) != -1) { set_filelen_write_cache(fsp, len); notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED, FILE_NOTIFY_CHANGE_SIZE diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 3947c3dd3c..17028fefc2 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -818,7 +818,7 @@ static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar return NT_STATUS_OK; } - if (SMB_VFS_FTRUNCATE(vfs->files[fd], fd, off) == -1) { + if (SMB_VFS_FTRUNCATE(vfs->files[fd], off) == -1) { printf("ftruncate: error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; } -- cgit From 299d24dbc1d2d8eb0b78800eb5a8643b10c80274 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 16:12:03 +0100 Subject: Fix the build: Fix caller of strict_allocate_ftruncate(). Michael (This used to be commit 20691272a1e2562ab8c6143978d324af0334f871) --- source3/modules/vfs_default.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 6ac8cc5def..4505695915 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -736,7 +736,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O START_PROFILE(syscall_ftruncate); if (lp_strict_allocate(SNUM(fsp->conn))) { - result = strict_allocate_ftruncate(handle, fsp, fsp->fh->fd, len); + result = strict_allocate_ftruncate(handle, fsp, len); END_PROFILE(syscall_ftruncate); return result; } -- cgit From edd30e716fb5133b269ef82358e95d187a107870 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 16:38:23 +0100 Subject: Remove redundant parameter fd from SMB_VFS_LOCK(). Michael (This used to be commit 4f3ab2c406072e0b43581057e7e785e8ad454cfa) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/locking/posix.c | 4 ++-- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/torture/cmd_vfs.c | 2 +- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 2ecfcf1b66..d5cedaf5d2 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -241,9 +241,9 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_ return vfswrap_ftruncate(NULL, fsp, offset); } -static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { - return vfswrap_lock(NULL, fsp, fd, op, offset, count, type); + return vfswrap_lock(NULL, fsp, op, offset, count, type); } static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 5d3103ee76..37570b8ab0 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -234,9 +234,9 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_ return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset); } -static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { - return SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type); + return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type); } static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index a36cd551ee..9cf49bf721 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -87,6 +87,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from fchmod. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fchown. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from ftruncate. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from lock. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -299,7 +300,7 @@ struct vfs_ops { char *(*getwd)(struct vfs_handle_struct *handle, char *buf); int (*ntimes)(struct vfs_handle_struct *handle, const char *path, const struct timespec ts[2]); int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset); - bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); + bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 share_mode); int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int leasetype); bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 2fc0dda3c8..5bc2cbc751 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -70,7 +70,7 @@ #define SMB_VFS_GETWD(conn, buf) ((conn)->vfs.ops.getwd((conn)->vfs.handles.getwd, (buf))) #define SMB_VFS_NTIMES(conn, path, ts) ((conn)->vfs.ops.ntimes((conn)->vfs.handles.ntimes, (path), (ts))) #define SMB_VFS_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (offset))) -#define SMB_VFS_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) +#define SMB_VFS_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (op), (offset), (count), (type))) #define SMB_VFS_KERNEL_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (fd), (share_mode))) #define SMB_VFS_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (fd), (leasetype))) #define SMB_VFS_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (fd) ,(poffset), (pcount), (ptype), (ppid))) @@ -189,7 +189,7 @@ #define SMB_VFS_OPAQUE_GETWD(conn, buf) ((conn)->vfs_opaque.ops.getwd((conn)->vfs_opaque.handles.getwd, (buf))) #define SMB_VFS_OPAQUE_NTIMES(conn, path, ts) ((conn)->vfs_opaque.ops.ntimes((conn)->vfs_opaque.handles.ntimes, (path), (ts))) #define SMB_VFS_OPAQUE_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (offset))) -#define SMB_VFS_OPAQUE_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) +#define SMB_VFS_OPAQUE_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (op), (offset), (count), (type))) #define SMB_VFS_OPAQUE_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (fd), (share_mode))) #define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (fd), (leasetype))) #define SMB_VFS_OPAQUE_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid))) @@ -309,7 +309,7 @@ #define SMB_VFS_NEXT_GETWD(handle, buf) ((handle)->vfs_next.ops.getwd((handle)->vfs_next.handles.getwd, (buf))) #define SMB_VFS_NEXT_NTIMES(handle, path, ts) ((handle)->vfs_next.ops.ntimes((handle)->vfs_next.handles.ntimes, (path), (ts))) #define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (offset))) -#define SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type))) +#define SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (op), (offset), (count), (type))) #define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, fd, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (fd), (share_mode))) #define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, fd, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (fd), (leasetype))) #define SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid))) diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 207ee57ce1..9f84e7380f 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -188,7 +188,7 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OF DEBUG(8,("posix_fcntl_lock %d %d %.0f %.0f %d\n",fsp->fh->fd,op,(double)offset,(double)count,type)); - ret = SMB_VFS_LOCK(fsp,fsp->fh->fd,op,offset,count,type); + ret = SMB_VFS_LOCK(fsp, op, offset, count, type); if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno == EINVAL))) { @@ -212,7 +212,7 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OF DEBUG(0,("Count greater than 31 bits - retrying with 31 bit truncated length.\n")); errno = 0; count &= 0x7fffffff; - ret = SMB_VFS_LOCK(fsp,fsp->fh->fd,op,offset,count,type); + ret = SMB_VFS_LOCK(fsp, op, offset, count, type); } } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 4505695915..0076f8d1b4 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -801,12 +801,12 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O return result; } -static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { bool result; START_PROFILE(syscall_fcntl_lock); - result = fcntl_lock(fd, op, offset, count, type); + result = fcntl_lock(fsp->fh->fd, op, offset, count, type); END_PROFILE(syscall_fcntl_lock); return result; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 1384c16290..13f442485f 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -160,7 +160,7 @@ static int smb_full_audit_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2]); static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len); -static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, +static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, @@ -1365,12 +1365,12 @@ static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp return result; } -static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, +static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) { bool result; - result = SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type); + result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type); do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp->fsp_name); diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 17028fefc2..fbf9c3c9e3 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -901,7 +901,7 @@ static NTSTATUS cmd_lock(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c printf("lock: debug lock(fd=%d, op=%d, offset=%ld, count=%ld, type=%d))\n", fd, op, offset, count, type); - if ((ret = SMB_VFS_LOCK(vfs->files[fd], fd, op, offset, count, type)) == False) { + if ((ret = SMB_VFS_LOCK(vfs->files[fd], op, offset, count, type)) == False) { printf("lock: error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; } -- cgit From f6cac02f00da72885e8a6d0104d099d84ac0ff6e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 16:59:10 +0100 Subject: Fix wrong unused opaque macro for kernel_flock(). Michael (This used to be commit 5c01309a2b078f08c4f0caf802d81c9b3d53382f) --- source3/include/vfs_macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 5bc2cbc751..4566bb9b1d 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -190,7 +190,7 @@ #define SMB_VFS_OPAQUE_NTIMES(conn, path, ts) ((conn)->vfs_opaque.ops.ntimes((conn)->vfs_opaque.handles.ntimes, (path), (ts))) #define SMB_VFS_OPAQUE_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_OPAQUE_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (op), (offset), (count), (type))) -#define SMB_VFS_OPAQUE_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (fd), (share_mode))) +#define SMB_VFS_OPAQUE_KERNEL_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs_opaque.ops.kernel_flock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (fd), (share_mode))) #define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (fd), (leasetype))) #define SMB_VFS_OPAQUE_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_OPAQUE_SYMLINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.symlink((conn)->vfs_opaque.handles.symlink, (oldpath), (newpath))) -- cgit From 327cc04da587fa54f28dafb00267fde79b858349 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 17:14:20 +0100 Subject: Remove redundant parameter fd from SMB_VFS_KERNEL_FLOCK(). Michael (This used to be commit 195c519377c2fdc655e25760b52bc0694b8dda81) --- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/modules/vfs_gpfs.c | 2 +- source3/smbd/open.c | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 9cf49bf721..3ca602cc09 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -88,6 +88,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from fchown. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from ftruncate. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from lock. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from kernel_flock. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -301,7 +302,7 @@ struct vfs_ops { int (*ntimes)(struct vfs_handle_struct *handle, const char *path, const struct timespec ts[2]); int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset); bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); - int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 share_mode); + int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode); int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int leasetype); bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 4566bb9b1d..b1f094f815 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -71,7 +71,7 @@ #define SMB_VFS_NTIMES(conn, path, ts) ((conn)->vfs.ops.ntimes((conn)->vfs.handles.ntimes, (path), (ts))) #define SMB_VFS_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (op), (offset), (count), (type))) -#define SMB_VFS_KERNEL_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (fd), (share_mode))) +#define SMB_VFS_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (share_mode))) #define SMB_VFS_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (fd), (leasetype))) #define SMB_VFS_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (fd) ,(poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_SYMLINK(conn, oldpath, newpath) ((conn)->vfs.ops.symlink((conn)->vfs.handles.symlink, (oldpath), (newpath))) @@ -190,7 +190,7 @@ #define SMB_VFS_OPAQUE_NTIMES(conn, path, ts) ((conn)->vfs_opaque.ops.ntimes((conn)->vfs_opaque.handles.ntimes, (path), (ts))) #define SMB_VFS_OPAQUE_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_OPAQUE_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (op), (offset), (count), (type))) -#define SMB_VFS_OPAQUE_KERNEL_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs_opaque.ops.kernel_flock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (fd), (share_mode))) +#define SMB_VFS_OPAQUE_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs_opaque.ops.kernel_flock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (share_mode))) #define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (fd), (leasetype))) #define SMB_VFS_OPAQUE_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_OPAQUE_SYMLINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.symlink((conn)->vfs_opaque.handles.symlink, (oldpath), (newpath))) @@ -310,7 +310,7 @@ #define SMB_VFS_NEXT_NTIMES(handle, path, ts) ((handle)->vfs_next.ops.ntimes((handle)->vfs_next.handles.ntimes, (path), (ts))) #define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (op), (offset), (count), (type))) -#define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, fd, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (fd), (share_mode))) +#define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (share_mode))) #define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, fd, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (fd), (leasetype))) #define SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.symlink((handle)->vfs_next.handles.symlink, (oldpath), (newpath))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 0076f8d1b4..96161ad273 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -811,11 +811,11 @@ static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, S return result; } -static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, int fd, +static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, uint32 share_mode) { START_PROFILE(syscall_kernel_flock); - kernel_flock(fd, share_mode); + kernel_flock(fsp->fh->fd, share_mode); END_PROFILE(syscall_kernel_flock); return 0; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 13f442485f..cc14597d97 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -163,7 +163,7 @@ static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, + struct files_struct *fsp, uint32 share_mode); static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, int fd, int leasetype); @@ -1378,12 +1378,12 @@ static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, } static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, + struct files_struct *fsp, uint32 share_mode) { int result; - result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, fd, share_mode); + result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode); do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 832dcbfcad..1dd2c5967e 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -33,7 +33,7 @@ static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, - int fd, uint32 share_mode) + uint32 share_mode) { START_PROFILE(syscall_kernel_flock); diff --git a/source3/smbd/open.c b/source3/smbd/open.c index cc62e020da..b618092a32 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1764,7 +1764,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, the kernel refuses the operations then the kernel is wrong. note that GPFS supports it as well - jmcd */ - ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, fsp->fh->fd, share_access); + ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access); if(ret_flock == -1 ){ TALLOC_FREE(lck); -- cgit From fa1e5e95d505d28eb50398511f95ebf13a28b4e5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 18:36:06 +0100 Subject: Add NET_API_STATUS_SUCCESS define. Guenther (This used to be commit a72ad63163a8c642ea762087a739e6d63c37647a) --- source3/lib/netapi/netapi.c | 18 +++++++++--------- source3/lib/netapi/netapi.h | 6 +++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 9c418f254c..a37ed7c072 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -32,7 +32,7 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) if (stat_ctx && libnetapi_initialized) { *context = stat_ctx; - return W_ERROR_V(WERR_OK); + return NET_API_STATUS_SUCCESS; } frame = talloc_stackframe(); @@ -69,14 +69,14 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) *context = stat_ctx = ctx; - return W_ERROR_V(WERR_OK); + return NET_API_STATUS_SUCCESS; } NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx) { if (stat_ctx) { *ctx = stat_ctx; - return W_ERROR_V(WERR_OK); + return NET_API_STATUS_SUCCESS; } return libnetapi_init(ctx); @@ -98,7 +98,7 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) gfree_debugsyms(); - return W_ERROR_V(WERR_OK); + return NET_API_STATUS_SUCCESS; } NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, @@ -109,14 +109,14 @@ NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, if (!debug_parse_levels(debuglevel)) { return W_ERROR_V(WERR_GENERAL_FAILURE); } - return W_ERROR_V(WERR_OK); + return NET_API_STATUS_SUCCESS; } NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, const char **debuglevel) { *debuglevel = ctx->debuglevel; - return W_ERROR_V(WERR_OK); + return NET_API_STATUS_SUCCESS; } NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, @@ -127,7 +127,7 @@ NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, if (!ctx->username) { return W_ERROR_V(WERR_NOMEM); } - return W_ERROR_V(WERR_OK); + return NET_API_STATUS_SUCCESS; } NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, @@ -138,7 +138,7 @@ NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, if (!ctx->password) { return W_ERROR_V(WERR_NOMEM); } - return W_ERROR_V(WERR_OK); + return NET_API_STATUS_SUCCESS; } NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, @@ -149,7 +149,7 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, if (!ctx->workgroup) { return W_ERROR_V(WERR_NOMEM); } - return W_ERROR_V(WERR_OK); + return NET_API_STATUS_SUCCESS; } const char *libnetapi_errstr(struct libnetapi_ctx *ctx, diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 0dd6d95ceb..2c6e126949 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -1,7 +1,7 @@ /* * Unix SMB/CIFS implementation. * NetApi Support - * Copyright (C) Guenther Deschner 2007 + * Copyright (C) Guenther Deschner 2007-2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,10 @@ #define __LIB_NETAPI_H__ #define NET_API_STATUS uint32_t +#define NET_API_STATUS_SUCCESS 0 + +/**************************************************************** +****************************************************************/ struct libnetapi_ctx { const char *debuglevel; -- cgit From cc1982ab1cb436a9410699bac5bafa7c6077530a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 18:37:04 +0100 Subject: Close registry in libnetapi_free(). Guenther (This used to be commit e7258a4408e40686ff090d0f8e120ce78acbd097) --- source3/lib/netapi/netapi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index a37ed7c072..33ca67ec85 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -92,6 +92,7 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) gencache_shutdown(); secrets_shutdown(); + regdb_close(); TALLOC_FREE(ctx); TALLOC_FREE(frame); -- cgit From 0b92d8bc79172dc587f53ce4b35a8fa3128ae0ea Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 18:40:25 +0100 Subject: Free libnet_JoinCtx after joining. Guenther (This used to be commit 5abae9ef15fa9884c5c4a0e256274f70f6ecd779) --- source3/lib/netapi/joindomain.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index c7849c952f..8fe6193f40 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -77,7 +77,10 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, r->in.join_flags = join_flags; r->in.modify_config = true; - return libnet_Join(mem_ctx, r); + werr = libnet_Join(mem_ctx, r); + TALLOC_FREE(r); + + return werr; } static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx, -- cgit From 528d253cc834235213f29411a058485681260140 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 18:41:49 +0100 Subject: Rearrange order of libnet join context init. Guenther (This used to be commit 89669c66f27fb47c9769d1058e29bff83f862752) --- source3/lib/netapi/joindomain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 8fe6193f40..ceb7ca10d9 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -33,13 +33,13 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, struct libnet_JoinCtx *r = NULL; WERROR werr; - werr = libnet_init_JoinCtx(mem_ctx, &r); - W_ERROR_NOT_OK_RETURN(werr); - if (!domain_name) { return WERR_INVALID_PARAM; } + werr = libnet_init_JoinCtx(mem_ctx, &r); + W_ERROR_NOT_OK_RETURN(werr); + r->in.domain_name = talloc_strdup(mem_ctx, domain_name); W_ERROR_HAVE_NO_MEMORY(r->in.domain_name); -- cgit From 077eaafed5ac61d5091b35c9fc7d7c768fd67ad3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 18:46:07 +0100 Subject: Add error_string to libnetjoin and libnetunjoin structures incl. set functions. Guenther (This used to be commit 4f9985bb33aa5973e6b685a45039c8e227487db1) --- source3/libnet/libnet_join.c | 36 ++++++++++++++++++++++++++++++++++++ source3/libnet/libnet_join.h | 2 ++ 2 files changed, 38 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 36d5c0a889..95088606a2 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -22,6 +22,42 @@ #include "libnet/libnet_join.h" #include "libnet/libnet_proto.h" +/**************************************************************** +****************************************************************/ + +static void libnet_join_set_error_string(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r, + const char *format, ...) +{ + va_list args; + char *tmp = NULL; + + va_start(args, format); + tmp = talloc_vasprintf(mem_ctx, format, args); + va_end(args); + + TALLOC_FREE(r->out.error_string); + r->out.error_string = tmp; +} + +/**************************************************************** +****************************************************************/ + +static void libnet_unjoin_set_error_string(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r, + const char *format, ...) +{ + va_list args; + char *tmp = NULL; + + va_start(args, format); + tmp = talloc_vasprintf(mem_ctx, format, args); + va_end(args); + + TALLOC_FREE(r->out.error_string); + r->out.error_string = tmp; +} + static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h index 9e7b8a9813..ac1fe6efcb 100644 --- a/source3/libnet/libnet_join.h +++ b/source3/libnet/libnet_join.h @@ -44,6 +44,7 @@ struct libnet_JoinCtx { struct dom_sid *domain_sid; bool modified_config; WERROR result; + char *error_string; } out; }; @@ -61,6 +62,7 @@ struct libnet_UnjoinCtx { struct { bool modified_config; WERROR result; + char *error_string; } out; }; -- cgit From 60555e66dd06f74316e05b59aec8943f5b0a62fa Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 18:58:04 +0100 Subject: Add ADS_STRUCTs to libnetjoin and -unjoin, with talloc destructors. Guenther (This used to be commit 985d45206990988894e05ea6fb0aacc7396a6db4) --- source3/libnet/libnet_join.c | 137 +++++++++++++++++++++++++++++++++++++++++++ source3/libnet/libnet_join.h | 3 + 2 files changed, 140 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 95088606a2..7c8b395cd3 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -58,6 +58,103 @@ static void libnet_unjoin_set_error_string(TALLOC_CTX *mem_ctx, r->out.error_string = tmp; } +/**************************************************************** +****************************************************************/ + +static ADS_STATUS libnet_connect_ads(const char *dns_domain_name, + const char *netbios_domain_name, + const char *dc_name, + const char *user_name, + const char *password, + ADS_STRUCT **ads) +{ + ADS_STATUS status; + ADS_STRUCT *my_ads = NULL; + + my_ads = ads_init(dns_domain_name, + netbios_domain_name, + dc_name); + if (!my_ads) { + return ADS_ERROR_LDAP(LDAP_NO_MEMORY); + } + + if (user_name) { + SAFE_FREE(my_ads->auth.user_name); + my_ads->auth.user_name = SMB_STRDUP(user_name); + } + + if (password) { + SAFE_FREE(my_ads->auth.password); + my_ads->auth.password = SMB_STRDUP(password); + } + + status = ads_connect(my_ads); + if (!ADS_ERR_OK(status)) { + ads_destroy(&my_ads); + return status; + } + + *ads = my_ads; + return ADS_SUCCESS; +} + +/**************************************************************** +****************************************************************/ + +static ADS_STATUS libnet_join_connect_ads(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + ADS_STATUS status; + + if (r->in.ads) { + ads_destroy(&r->in.ads); + } + + status = libnet_connect_ads(r->in.domain_name, + r->in.domain_name, + r->in.dc_name, + r->in.admin_account, + r->in.admin_password, + &r->in.ads); + if (!ADS_ERR_OK(status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to connect to AD: %s\n", + ads_errstr(status)); + } + + return status; +} + +/**************************************************************** +****************************************************************/ + +static ADS_STATUS libnet_unjoin_connect_ads(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r) +{ + ADS_STATUS status; + + if (r->in.ads) { + ads_destroy(&r->in.ads); + } + + status = libnet_connect_ads(r->in.domain_name, + r->in.domain_name, + r->in.dc_name, + r->in.admin_account, + r->in.admin_password, + &r->in.ads); + if (!ADS_ERR_OK(status)) { + libnet_unjoin_set_error_string(mem_ctx, r, + "failed to connect to AD: %s\n", + ads_errstr(status)); + } + + return status; +} + +/**************************************************************** +****************************************************************/ + static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { @@ -484,6 +581,33 @@ static WERROR do_UnjoinConfig(struct libnet_UnjoinCtx *r) return werr; } +/**************************************************************** +****************************************************************/ + +static int libnet_destroy_JoinCtx(struct libnet_JoinCtx *r) +{ + if (r->in.ads) { + ads_destroy(&r->in.ads); + } + + return 0; +} + +/**************************************************************** +****************************************************************/ + +static int libnet_destroy_UnjoinCtx(struct libnet_UnjoinCtx *r) +{ + if (r->in.ads) { + ads_destroy(&r->in.ads); + } + + return 0; +} + +/**************************************************************** +****************************************************************/ + WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx **r) { @@ -494,11 +618,19 @@ WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx, return WERR_NOMEM; } + talloc_set_destructor(ctx, libnet_destroy_JoinCtx); + + ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname()); + W_ERROR_HAVE_NO_MEMORY(ctx->in.machine_name); + *r = ctx; return WERR_OK; } +/**************************************************************** +****************************************************************/ + WERROR libnet_init_UnjoinCtx(TALLOC_CTX *mem_ctx, struct libnet_UnjoinCtx **r) { @@ -509,6 +641,11 @@ WERROR libnet_init_UnjoinCtx(TALLOC_CTX *mem_ctx, return WERR_NOMEM; } + talloc_set_destructor(ctx, libnet_destroy_UnjoinCtx); + + ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname()); + W_ERROR_HAVE_NO_MEMORY(ctx->in.machine_name); + *r = ctx; return WERR_OK; diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h index ac1fe6efcb..b2e59b99c9 100644 --- a/source3/libnet/libnet_join.h +++ b/source3/libnet/libnet_join.h @@ -34,6 +34,7 @@ struct libnet_JoinCtx { const char *os_string; const char *upn; bool modify_config; + struct ads_struct *ads; } in; struct { @@ -51,12 +52,14 @@ struct libnet_JoinCtx { struct libnet_UnjoinCtx { struct { const char *dc_name; + const char *machine_name; const char *domain_name; const char *admin_account; const char *admin_password; uint32_t unjoin_flags; bool modify_config; struct dom_sid *domain_sid; + struct ads_struct *ads; } in; struct { -- cgit From 0bbc04d5164858ed91353600ee068715a272568b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 19:07:38 +0100 Subject: Rearrange libnet join code and add support for account pre-creation in AD. Guenther (This used to be commit 18ae8580420c37aa4b189eb5ce53cc65a9827d95) --- source3/libnet/libnet_join.c | 112 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 100 insertions(+), 12 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 7c8b395cd3..1d52b81a75 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -155,6 +155,39 @@ static ADS_STATUS libnet_unjoin_connect_ads(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ +static ADS_STATUS libnet_join_precreate_machine_acct(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + ADS_STATUS status; + LDAPMessage *res = NULL; + const char *attrs[] = { "dn", NULL }; + + status = ads_search_dn(r->in.ads, &res, r->in.account_ou, attrs); + if (!ADS_ERR_OK(status)) { + return status; + } + + if (ads_count_replies(r->in.ads, res) != 1) { + ads_msgfree(r->in.ads, res); + return ADS_ERROR_LDAP(LDAP_NO_SUCH_OBJECT); + } + + status = ads_create_machine_acct(r->in.ads, + r->in.machine_name, + r->in.account_ou); + ads_msgfree(r->in.ads, res); + + if ((status.error_type == ENUM_ADS_ERROR_LDAP) && + (status.err.rc == LDAP_ALREADY_EXISTS)) { + status = ADS_SUCCESS; + } + + return status; +} + +/**************************************************************** +****************************************************************/ + static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { @@ -174,6 +207,9 @@ static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx, return true; } +/**************************************************************** +****************************************************************/ + static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { @@ -362,6 +398,9 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, return status; } +/**************************************************************** +****************************************************************/ + static bool libnet_join_unjoindomain_remove_secrets(TALLOC_CTX *mem_ctx, struct libnet_UnjoinCtx *r) { @@ -376,6 +415,9 @@ static bool libnet_join_unjoindomain_remove_secrets(TALLOC_CTX *mem_ctx, return true; } +/**************************************************************** +****************************************************************/ + static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx, struct libnet_UnjoinCtx *r) { @@ -481,6 +523,9 @@ done: return status; } +/**************************************************************** +****************************************************************/ + static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) { WERROR werr; @@ -519,6 +564,9 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) return werr; } +/**************************************************************** +****************************************************************/ + static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) { WERROR werr = WERR_OK; @@ -534,6 +582,8 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) return werr; } +/**************************************************************** +****************************************************************/ static WERROR do_JoinConfig(struct libnet_JoinCtx *r) { @@ -558,6 +608,9 @@ static WERROR do_JoinConfig(struct libnet_JoinCtx *r) return werr; } +/**************************************************************** +****************************************************************/ + static WERROR do_UnjoinConfig(struct libnet_UnjoinCtx *r) { WERROR werr; @@ -651,11 +704,54 @@ WERROR libnet_init_UnjoinCtx(TALLOC_CTX *mem_ctx, return WERR_OK; } +/**************************************************************** +****************************************************************/ + +static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + NTSTATUS status; + ADS_STATUS ads_status; + + if (r->in.account_ou) { + ads_status = libnet_join_connect_ads(mem_ctx, r); + if (!ADS_ERR_OK(ads_status)) { + return WERR_GENERAL_FAILURE; + } + ads_status = libnet_join_precreate_machine_acct(mem_ctx, r); + if (!ADS_ERR_OK(ads_status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to precreate account in ou %s: %s\n", + r->in.account_ou, + ads_errstr(ads_status)); + return WERR_GENERAL_FAILURE; + } + + r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE; + } + + status = libnet_join_joindomain_rpc(mem_ctx, r); + if (!NT_STATUS_IS_OK(status)) { + if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { + return WERR_SETUP_ALREADY_JOINED; + } + return ntstatus_to_werror(status); + } + + if (!libnet_join_joindomain_store_secrets(mem_ctx, r)) { + return WERR_SETUP_NOT_JOINED; + } + + return WERR_OK; +} + +/**************************************************************** +****************************************************************/ + WERROR libnet_Join(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { WERROR werr; - NTSTATUS status; if (!r->in.domain_name) { return WERR_INVALID_PARAM; @@ -670,17 +766,9 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, } if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - - status = libnet_join_joindomain_rpc(mem_ctx, r); - if (!NT_STATUS_IS_OK(status)) { - if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { - return WERR_SETUP_ALREADY_JOINED; - } - return ntstatus_to_werror(status); - } - - if (!libnet_join_joindomain_store_secrets(mem_ctx, r)) { - return WERR_SETUP_NOT_JOINED; + werr = libnet_DomainJoin(mem_ctx, r); + if (!W_ERROR_IS_OK(werr)) { + return werr; } } -- cgit From 5b5f17a81d76b4675a4a0f09f92dddbc3a221673 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 19:11:26 +0100 Subject: Honor the WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE flag when unjoining from AD. Guenther (This used to be commit ed164b523e63c3ebf2c822a00a877ef169738a3a) --- source3/libnet/libnet_join.c | 66 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 10 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 1d52b81a75..627558d4a9 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -188,6 +188,24 @@ static ADS_STATUS libnet_join_precreate_machine_acct(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ +static ADS_STATUS libnet_unjoin_remove_machine_acct(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r) +{ + ADS_STATUS status; + + if (!r->in.ads) { + status = libnet_unjoin_connect_ads(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + return status; + } + } + + return ads_leave_realm(r->in.ads, r->in.machine_name); +} + +/**************************************************************** +****************************************************************/ + static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { @@ -780,27 +798,55 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, return werr; } +/**************************************************************** +****************************************************************/ + +static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, + struct libnet_UnjoinCtx *r) +{ + NTSTATUS status; + + status = libnet_join_unjoindomain_rpc(mem_ctx, r); + if (!NT_STATUS_IS_OK(status)) { + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { + return WERR_SETUP_NOT_JOINED; + } + return ntstatus_to_werror(status); + } + + if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) { + ADS_STATUS ads_status; + libnet_unjoin_connect_ads(mem_ctx, r); + ads_status = libnet_unjoin_remove_machine_acct(mem_ctx, r); + if (!ADS_ERR_OK(ads_status)) { + libnet_unjoin_set_error_string(mem_ctx, r, + "failed to remove machine account from AD: %s\n", + ads_errstr(ads_status)); + } + } + + libnet_join_unjoindomain_remove_secrets(mem_ctx, r); + + return WERR_OK; +} + +/**************************************************************** +****************************************************************/ + WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx, struct libnet_UnjoinCtx *r) { WERROR werr; - NTSTATUS status; if (r->in.modify_config && !lp_include_registry_globals()) { return WERR_NOT_SUPPORTED; } if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - - status = libnet_join_unjoindomain_rpc(mem_ctx, r); - if (!NT_STATUS_IS_OK(status)) { - if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { - return WERR_SETUP_NOT_JOINED; - } - return ntstatus_to_werror(status); + werr = libnet_DomainUnjoin(mem_ctx, r); + if (!W_ERROR_IS_OK(werr)) { + return werr; } - - libnet_join_unjoindomain_remove_secrets(mem_ctx, r); } werr = do_UnjoinConfig(r); -- cgit From d66118629cccf01799ecdbcd73a944903908a64c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 19:31:20 +0100 Subject: Add libnet_join_find_machine_acct(). Guenther (This used to be commit f550ed02ff9e0546c63064ab9dac760eac7e1e16) --- source3/libnet/libnet_join.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 627558d4a9..bc775a9d40 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -206,6 +206,52 @@ static ADS_STATUS libnet_unjoin_remove_machine_acct(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ +static ADS_STATUS libnet_join_find_machine_acct(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + ADS_STATUS status; + LDAPMessage *res = NULL; + char *dn = NULL; + + if (!r->in.machine_name) { + return ADS_ERROR(LDAP_NO_MEMORY); + } + + status = ads_find_machine_acct(r->in.ads, + &res, + r->in.machine_name); + if (!ADS_ERR_OK(status)) { + return status; + } + + if (ads_count_replies(r->in.ads, res) != 1) { + status = ADS_ERROR_LDAP(LDAP_NO_MEMORY); + goto done; + } + + dn = ads_get_dn(r->in.ads, res); + if (!dn) { + status = ADS_ERROR_LDAP(LDAP_NO_MEMORY); + goto done; + } + + TALLOC_FREE(r->out.dn); + r->out.dn = talloc_strdup(mem_ctx, dn); + if (!r->out.dn) { + status = ADS_ERROR_LDAP(LDAP_NO_MEMORY); + goto done; + } + + done: + ads_msgfree(r->in.ads, res); + ads_memfree(r->in.ads, dn); + + return status; +} + +/**************************************************************** +****************************************************************/ + static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { -- cgit From 1fba8c801934233e754710dd477cafdab97841bd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:01:28 +0100 Subject: Let libnetapi use it's own krb5 cred cache in memory if necessary. Guenther (This used to be commit 863fb30038e384585502f0154a742481594b99d0) --- source3/lib/netapi/netapi.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 33ca67ec85..6d27b99d96 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -26,9 +26,13 @@ struct libnetapi_ctx *stat_ctx = NULL; TALLOC_CTX *frame = NULL; static bool libnetapi_initialized = false; +/**************************************************************** +****************************************************************/ + NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) { struct libnetapi_ctx *ctx = NULL; + char *krb5_cc_env = NULL; if (stat_ctx && libnetapi_initialized) { *context = stat_ctx; @@ -65,6 +69,12 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) BlockSignals(True, SIGPIPE); + krb5_cc_env = getenv(KRB5_ENV_CCNAME); + if (!krb5_cc_env || (strlen(krb5_cc_env) == 0)) { + ctx->krb5_cc_env = talloc_strdup(frame, "MEMORY:libnetapi"); + setenv(KRB5_ENV_CCNAME, ctx->krb5_cc_env, 1); + } + libnetapi_initialized = true; *context = stat_ctx = ctx; @@ -72,6 +82,9 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) return NET_API_STATUS_SUCCESS; } +/**************************************************************** +****************************************************************/ + NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx) { if (stat_ctx) { @@ -82,6 +95,9 @@ NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx) return libnetapi_init(ctx); } +/**************************************************************** +****************************************************************/ + NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) { gfree_names(); @@ -94,6 +110,11 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) secrets_shutdown(); regdb_close(); + if (ctx->krb5_cc_env && + (strequal(ctx->krb5_cc_env, getenv(KRB5_ENV_CCNAME)))) { + unsetenv(KRB5_ENV_CCNAME); + } + TALLOC_FREE(ctx); TALLOC_FREE(frame); @@ -102,6 +123,9 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) return NET_API_STATUS_SUCCESS; } +/**************************************************************** +****************************************************************/ + NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel) { @@ -113,6 +137,9 @@ NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, return NET_API_STATUS_SUCCESS; } +/**************************************************************** +****************************************************************/ + NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, const char **debuglevel) { @@ -120,6 +147,9 @@ NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, return NET_API_STATUS_SUCCESS; } +/**************************************************************** +****************************************************************/ + NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username) { @@ -153,6 +183,9 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, return NET_API_STATUS_SUCCESS; } +/**************************************************************** +****************************************************************/ + const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status) { -- cgit From 1b3520db8836437b9d4d48fab4df69126c1d9b5d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:03:32 +0100 Subject: Add krb5 cc env to libnetapi_ctx. Guenther (This used to be commit df2b078fa1658bdbff1280f7fe0b062d9eabd60c) --- source3/lib/netapi/netapi.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 2c6e126949..3c9d3b3853 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -31,8 +31,12 @@ struct libnetapi_ctx { char *username; char *workgroup; char *password; + char *krb5_cc_env; }; +/**************************************************************** +****************************************************************/ + NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx); NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx); NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx); -- cgit From 751fc874bec2cbc93b4a84067f3e7102f39bd76c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:06:41 +0100 Subject: Add libnetapi_set_error_string and libnetapi_get_error_string. Guenther (This used to be commit f8806bad8134d544229c426f58bee143ba752cf8) --- source3/lib/netapi/netapi.c | 27 +++++++++++++++++++++++++-- source3/lib/netapi/netapi.h | 10 ++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 6d27b99d96..d5527dc4ff 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -130,7 +130,7 @@ NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel) { AllowDebugChange = true; - ctx->debuglevel = debuglevel; + ctx->debuglevel = talloc_strdup(ctx, debuglevel); if (!debug_parse_levels(debuglevel)) { return W_ERROR_V(WERR_GENERAL_FAILURE); } @@ -141,7 +141,7 @@ NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, ****************************************************************/ NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, - const char **debuglevel) + char **debuglevel) { *debuglevel = ctx->debuglevel; return NET_API_STATUS_SUCCESS; @@ -195,3 +195,26 @@ const char *libnetapi_errstr(struct libnetapi_ctx *ctx, return get_friendly_werror_msg(W_ERROR(status)); } + +/**************************************************************** +****************************************************************/ + +NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, + const char *error_string) +{ + TALLOC_FREE(ctx->error_string); + ctx->error_string = talloc_strdup(ctx, error_string); + if (!ctx->error_string) { + return W_ERROR_V(WERR_NOMEM); + } + return NET_API_STATUS_SUCCESS; + +} + +/**************************************************************** +****************************************************************/ + +const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx) +{ + return ctx->error_string; +} diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 3c9d3b3853..46dd8e1a24 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -27,7 +27,8 @@ ****************************************************************/ struct libnetapi_ctx { - const char *debuglevel; + char *debuglevel; + char *error_string; char *username; char *workgroup; char *password; @@ -41,11 +42,16 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx); NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx); NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx); NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel); -NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, const char **debuglevel); +NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debuglevel); NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username); NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password); NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup); const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status); +NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *error_string); +const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx); + +/**************************************************************** +****************************************************************/ /* wkssvc */ NET_API_STATUS NetJoinDomain(const char *server, -- cgit From d6659f8ac84d5b3f19fb16a739657240f835c358 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:08:45 +0100 Subject: In the local path of NetJoinDomain, try to get error string from libnetjoin. Guenther (This used to be commit 0f0f0e13022da584b77e850fec2cef6169e1ac28) --- source3/lib/netapi/joindomain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index ceb7ca10d9..aa8ec6e0b5 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -78,6 +78,9 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, r->in.modify_config = true; werr = libnet_Join(mem_ctx, r); + if (!W_ERROR_IS_OK(werr) && r->out.error_string) { + libnetapi_set_error_string(mem_ctx, r->out.error_string); + } TALLOC_FREE(r); return werr; -- cgit From 74fc0bf9e5f4fe21b80a4b6df144d780e1bb943a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:10:47 +0100 Subject: In libnetapi example, use libnetapi_get_error_string(). Guenther (This used to be commit b624db92d61809a44881abbdd09dfa3a74ff7a88) --- source3/lib/netapi/examples/netdomjoin/netdomjoin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/lib/netapi/examples/netdomjoin/netdomjoin.c b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c index 634d265597..a0ac0b1e56 100644 --- a/source3/lib/netapi/examples/netdomjoin/netdomjoin.c +++ b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c @@ -104,7 +104,12 @@ int main(int argc, char **argv) password, join_flags); if (status != 0) { - printf("Join failed with: %s\n", libnetapi_errstr(ctx, status)); + const char *errstr = NULL; + errstr = libnetapi_get_error_string(ctx); + if (!errstr) { + errstr = libnetapi_errstr(ctx, status); + } + printf("Join failed with: %s\n", errstr); } else { printf("Successfully joined\n"); } -- cgit From 60eb92478c58ae3c68b691c62e6bc7cb6518c679 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:16:57 +0100 Subject: Merge remaining post-AD-join functions from net into libnet_join. Guenther (This used to be commit 3e816d7555218192881d79645fca26981a7099c7) --- source3/libnet/libnet_join.c | 184 +++++++++++++++++++++++++++++++++++++++++++ source3/libnet/libnet_join.h | 3 +- 2 files changed, 186 insertions(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index bc775a9d40..4149116833 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -252,6 +252,190 @@ static ADS_STATUS libnet_join_find_machine_acct(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ +static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + ADS_STATUS status; + ADS_MODLIST mods; + fstring my_fqdn; + const char *spn_array[3] = {NULL, NULL, NULL}; + char *spn = NULL; + + if (!r->in.ads) { + status = libnet_join_connect_ads(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + return status; + } + } + + status = libnet_join_find_machine_acct(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + return status; + } + + spn = talloc_asprintf(mem_ctx, "HOST/%s", r->in.machine_name); + if (!spn) { + return ADS_ERROR_LDAP(LDAP_NO_MEMORY); + } + strupper_m(spn); + spn_array[0] = spn; + + if (name_to_fqdn(my_fqdn, r->in.machine_name) && + !strequal(my_fqdn, r->in.machine_name)) { + + strlower_m(my_fqdn); + spn = talloc_asprintf(mem_ctx, "HOST/%s", my_fqdn); + if (!spn) { + return ADS_ERROR_LDAP(LDAP_NO_MEMORY); + } + spn_array[1] = spn; + } + + mods = ads_init_mods(mem_ctx); + if (!mods) { + return ADS_ERROR_LDAP(LDAP_NO_MEMORY); + } + + status = ads_mod_str(mem_ctx, &mods, "dNSHostName", my_fqdn); + if (!ADS_ERR_OK(status)) { + return ADS_ERROR_LDAP(LDAP_NO_MEMORY); + } + + status = ads_mod_strlist(mem_ctx, &mods, "servicePrincipalName", + spn_array); + if (!ADS_ERR_OK(status)) { + return ADS_ERROR_LDAP(LDAP_NO_MEMORY); + } + + return ads_gen_mod(r->in.ads, r->out.dn, mods); +} + +/**************************************************************** +****************************************************************/ + +static ADS_STATUS libnet_join_set_machine_upn(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + ADS_STATUS status; + ADS_MODLIST mods; + + if (!r->in.create_upn) { + return ADS_SUCCESS; + } + + if (!r->in.ads) { + status = libnet_join_connect_ads(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + return status; + } + } + + status = libnet_join_find_machine_acct(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + return status; + } + + if (!r->in.upn) { + r->in.upn = talloc_asprintf(mem_ctx, + "host/%s@%s", + r->in.machine_name, + r->out.dns_domain_name); + if (!r->in.upn) { + return ADS_ERROR(LDAP_NO_MEMORY); + } + } + + mods = ads_init_mods(mem_ctx); + if (!mods) { + return ADS_ERROR_LDAP(LDAP_NO_MEMORY); + } + + status = ads_mod_str(mem_ctx, &mods, "userPrincipalName", r->in.upn); + if (!ADS_ERR_OK(status)) { + return ADS_ERROR_LDAP(LDAP_NO_MEMORY); + } + + return ads_gen_mod(r->in.ads, r->out.dn, mods); +} + + +/**************************************************************** +****************************************************************/ + +static ADS_STATUS libnet_join_set_os_attributes(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + ADS_STATUS status; + ADS_MODLIST mods; + char *os_sp = NULL; + + if (!r->in.os_name || !r->in.os_version ) { + return ADS_SUCCESS; + } + + if (!r->in.ads) { + status = libnet_join_connect_ads(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + return status; + } + } + + status = libnet_join_find_machine_acct(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + return status; + } + + mods = ads_init_mods(mem_ctx); + if (!mods) { + return ADS_ERROR(LDAP_NO_MEMORY); + } + + os_sp = talloc_asprintf(mem_ctx, "Samba %s", SAMBA_VERSION_STRING); + if (!os_sp) { + return ADS_ERROR(LDAP_NO_MEMORY); + } + + status = ads_mod_str(mem_ctx, &mods, "operatingSystem", + r->in.os_name); + if (!ADS_ERR_OK(status)) { + return status; + } + + status = ads_mod_str(mem_ctx, &mods, "operatingSystemVersion", + r->in.os_version); + if (!ADS_ERR_OK(status)) { + return status; + } + + status = ads_mod_str(mem_ctx, &mods, "operatingSystemServicePack", + os_sp); + if (!ADS_ERR_OK(status)) { + return status; + } + + return ads_gen_mod(r->in.ads, r->out.dn, mods); +} + +/**************************************************************** +****************************************************************/ + +static bool libnet_join_create_keytab(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + if (!lp_use_kerberos_keytab()) { + return true; + } + + if (!ads_keytab_create_default(r->in.ads)) { + return false; + } + + return true; +} + +/**************************************************************** +****************************************************************/ + static bool libnet_join_joindomain_store_secrets(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h index b2e59b99c9..c6a0cd183c 100644 --- a/source3/libnet/libnet_join.h +++ b/source3/libnet/libnet_join.h @@ -31,7 +31,8 @@ struct libnet_JoinCtx { const char *machine_password; uint32_t join_flags; const char *os_version; - const char *os_string; + const char *os_name; + bool create_upn; const char *upn; bool modify_config; struct ads_struct *ads; -- cgit From ec75d53dfc6b678f1270927864dae621e63b11c7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:20:03 +0100 Subject: Finally use libnet_join_set_* functions in libnetjoin. Guenther (This used to be commit 1436670854ae635cfa2a69939d3ac31da87c3f66) --- source3/libnet/libnet_join.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 4149116833..94fa62e47b 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -990,6 +990,36 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, return WERR_SETUP_NOT_JOINED; } + ads_status = libnet_join_set_machine_spn(mem_ctx, r); + if (!ADS_ERR_OK(ads_status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to set machine spn: %s\n", + ads_errstr(ads_status)); + return WERR_GENERAL_FAILURE; + } + + ads_status = libnet_join_set_os_attributes(mem_ctx, r); + if (!ADS_ERR_OK(ads_status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to set machine os attributes: %s\n", + ads_errstr(ads_status)); + return WERR_GENERAL_FAILURE; + } + + ads_status = libnet_join_set_machine_upn(mem_ctx, r); + if (!ADS_ERR_OK(ads_status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to set machine upn: %s\n", + ads_errstr(ads_status)); + return WERR_GENERAL_FAILURE; + } + + if (!libnet_join_create_keytab(mem_ctx, r)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to create kerberos keytab\n"); + return WERR_GENERAL_FAILURE; + } + return WERR_OK; } -- cgit From d5dec339043875e98cbceadf3cbd0d1b39c9b463 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:41:55 +0100 Subject: There is no LDAP in some corners of this world. Fix the build... Guenther (This used to be commit 83ed37023c2be4c6b4d99d8117ac8438a413112c) --- source3/libnet/libnet_join.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 94fa62e47b..5c64778da3 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -58,6 +58,8 @@ static void libnet_unjoin_set_error_string(TALLOC_CTX *mem_ctx, r->out.error_string = tmp; } +#ifdef WITH_LDAP + /**************************************************************** ****************************************************************/ @@ -416,6 +418,8 @@ static ADS_STATUS libnet_join_set_os_attributes(TALLOC_CTX *mem_ctx, return ads_gen_mod(r->in.ads, r->out.dn, mods); } +#endif + /**************************************************************** ****************************************************************/ @@ -426,10 +430,11 @@ static bool libnet_join_create_keytab(TALLOC_CTX *mem_ctx, return true; } +#ifdef WITH_ADS if (!ads_keytab_create_default(r->in.ads)) { return false; } - +#endif return true; } @@ -959,6 +964,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { NTSTATUS status; +#ifdef WITH_LDAP ADS_STATUS ads_status; if (r->in.account_ou) { @@ -977,7 +983,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE; } - +#endif status = libnet_join_joindomain_rpc(mem_ctx, r); if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { @@ -990,6 +996,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, return WERR_SETUP_NOT_JOINED; } +#ifdef WITH_LDAP ads_status = libnet_join_set_machine_spn(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { libnet_join_set_error_string(mem_ctx, r, @@ -1013,7 +1020,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, ads_errstr(ads_status)); return WERR_GENERAL_FAILURE; } - +#endif if (!libnet_join_create_keytab(mem_ctx, r)) { libnet_join_set_error_string(mem_ctx, r, "failed to create kerberos keytab\n"); @@ -1074,6 +1081,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, return ntstatus_to_werror(status); } +#ifdef WITH_LDAP if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) { ADS_STATUS ads_status; libnet_unjoin_connect_ads(mem_ctx, r); @@ -1084,7 +1092,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, ads_errstr(ads_status)); } } - +#endif libnet_join_unjoindomain_remove_secrets(mem_ctx, r); return WERR_OK; -- cgit From c8abd25d94fba0df62136c33837ddfcdaa459a66 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:56:34 +0100 Subject: Trying to make the buildfarm w/o krb5 happy. Guenther (This used to be commit 079f2eba81886707ea4b18f103e097dbac994b2f) --- source3/libnet/libnet_join.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 5c64778da3..f4c0dfa2c2 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -430,7 +430,7 @@ static bool libnet_join_create_keytab(TALLOC_CTX *mem_ctx, return true; } -#ifdef WITH_ADS +#ifdef WITH_KRB5 if (!ads_keytab_create_default(r->in.ads)) { return false; } -- cgit From 8d261ee580f7d589920eb405a68aec04e6cc8e7a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 6 Jan 2008 17:25:20 +0100 Subject: talloc_stackframe only needs 1 talloc (This used to be commit c0c2084d40b79e949dab7c68626aa665b9ea1a8e) --- source3/lib/talloc_stack.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/source3/lib/talloc_stack.c b/source3/lib/talloc_stack.c index e6e4ed321a..cc7ce3a518 100644 --- a/source3/lib/talloc_stack.c +++ b/source3/lib/talloc_stack.c @@ -41,16 +41,18 @@ static int talloc_stacksize; static TALLOC_CTX **talloc_stack; -static int talloc_pop(int *ptr) +static int talloc_pop(TALLOC_CTX *frame) { - int tos = *ptr; int i; - for (i=talloc_stacksize-1; i>=tos; i--) { + for (i=talloc_stacksize-1; i>0; i--) { + if (frame == talloc_stack[i]) { + break; + } talloc_free(talloc_stack[i]); } - talloc_stacksize = tos; + talloc_stacksize = i; return 0; } @@ -64,7 +66,6 @@ static int talloc_pop(int *ptr) TALLOC_CTX *talloc_stackframe(void) { TALLOC_CTX **tmp, *top; - int *cleanup; if (!(tmp = TALLOC_REALLOC_ARRAY(NULL, talloc_stack, TALLOC_CTX *, talloc_stacksize + 1))) { @@ -77,12 +78,7 @@ TALLOC_CTX *talloc_stackframe(void) goto fail; } - if (!(cleanup = talloc(top, int))) { - goto fail; - } - - *cleanup = talloc_stacksize; - talloc_set_destructor(cleanup, talloc_pop); + talloc_set_destructor(top, talloc_pop); talloc_stack[talloc_stacksize++] = top; -- cgit From 6dc988c918d7909b6eec052e6c3511467e9be697 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 Jan 2008 00:14:24 +0100 Subject: Change db_tdb_fetch_locked to use only one talloc (This used to be commit 921c8657e2eeb71d5b9ae2675255a852b26cc30d) --- source3/lib/dbwrap_tdb.c | 88 +++++++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c index b24fd0618a..cce987d789 100644 --- a/source3/lib/dbwrap_tdb.c +++ b/source3/lib/dbwrap_tdb.c @@ -43,33 +43,50 @@ static int db_tdb_record_destr(struct db_record* data) return 0; } -static struct db_record *db_tdb_fetch_locked(struct db_context *db, - TALLOC_CTX *mem_ctx, TDB_DATA key) -{ - struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data, - struct db_tdb_ctx); +struct tdb_fetch_locked_state { + TALLOC_CTX *mem_ctx; struct db_record *result; - TDB_DATA value; +}; - result = TALLOC_P(mem_ctx, struct db_record); - if (result == NULL) { - DEBUG(0, ("talloc failed\n")); - return NULL; +static int db_tdb_fetchlock_parse(TDB_DATA key, TDB_DATA data, + void *private_data) +{ + struct tdb_fetch_locked_state *state = + (struct tdb_fetch_locked_state *)private_data; + + state->result = (struct db_record *)talloc_size( + state->mem_ctx, + sizeof(struct db_record) + key.dsize + data.dsize); + + if (state->result == NULL) { + return 0; } - result->key.dsize = key.dsize; - result->key.dptr = (uint8 *)talloc_memdup(result, key.dptr, key.dsize); - if (result->key.dptr == NULL) { - DEBUG(0, ("talloc failed\n")); - TALLOC_FREE(result); - return NULL; + state->result->key.dsize = key.dsize; + state->result->key.dptr = ((uint8 *)state->result) + + sizeof(struct db_record); + memcpy(state->result->key.dptr, key.dptr, key.dsize); + + state->result->value.dsize = data.dsize; + + if (data.dsize > 0) { + state->result->value.dptr = state->result->key.dptr + key.dsize; + memcpy(state->result->value.dptr, data.dptr, data.dsize); } + else { + state->result->value.dptr = NULL; + } + + return 0; +} - result->value.dptr = NULL; - result->value.dsize = 0; - result->private_data = talloc_reference(result, ctx); - result->store = db_tdb_store; - result->delete_rec = db_tdb_delete; +static struct db_record *db_tdb_fetch_locked(struct db_context *db, + TALLOC_CTX *mem_ctx, TDB_DATA key) +{ + struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data, + struct db_tdb_ctx); + struct tdb_fetch_locked_state state; + int res; if (DEBUGLEVEL >= 10) { char *keystr = hex_encode(NULL, key.dptr, key.dsize); @@ -81,32 +98,33 @@ static struct db_record *db_tdb_fetch_locked(struct db_context *db, if (tdb_chainlock(ctx->wtdb->tdb, key) != 0) { DEBUG(3, ("tdb_chainlock failed\n")); - TALLOC_FREE(result); return NULL; } - talloc_set_destructor(result, db_tdb_record_destr); + state.mem_ctx = mem_ctx; + state.result = NULL; - value = tdb_fetch(ctx->wtdb->tdb, key); + res = tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetchlock_parse, + &state); - if (value.dptr == NULL) { - return result; + if (state.result == NULL) { + db_tdb_fetchlock_parse(key, tdb_null, &state); } - result->value.dsize = value.dsize; - result->value.dptr = (uint8 *)talloc_memdup(result, value.dptr, - value.dsize); - if (result->value.dptr == NULL) { - DEBUG(3, ("talloc failed\n")); - TALLOC_FREE(result); + if (state.result == NULL) { + tdb_chainunlock(ctx->wtdb->tdb, key); return NULL; } - SAFE_FREE(value.dptr); + talloc_set_destructor(state.result, db_tdb_record_destr); - DEBUG(10, ("Allocated locked data 0x%p\n", result)); + state.result->private_data = talloc_reference(state.result, ctx); + state.result->store = db_tdb_store; + state.result->delete_rec = db_tdb_delete; - return result; + DEBUG(10, ("Allocated locked data 0x%p\n", state.result)); + + return state.result; } static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, -- cgit From c3c19615c16a2a2dc7d3620d7117b9f261e5c35a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 Jan 2008 00:41:26 +0100 Subject: make db_tdb_fetch use tdb_parse_record (This used to be commit 88d82d0623e71ae1ef4f8fdefba10e3a230ea526) --- source3/lib/dbwrap_tdb.c | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c index cce987d789..83a0d111aa 100644 --- a/source3/lib/dbwrap_tdb.c +++ b/source3/lib/dbwrap_tdb.c @@ -70,7 +70,7 @@ static int db_tdb_fetchlock_parse(TDB_DATA key, TDB_DATA data, state->result->value.dsize = data.dsize; if (data.dsize > 0) { - state->result->value.dptr = state->result->key.dptr + key.dsize; + state->result->value.dptr = state->result->key.dptr+key.dsize; memcpy(state->result->value.dptr, data.dptr, data.dsize); } else { @@ -127,29 +127,49 @@ static struct db_record *db_tdb_fetch_locked(struct db_context *db, return state.result; } +struct tdb_fetch_state { + TALLOC_CTX *mem_ctx; + int result; + TDB_DATA data; +}; + +static int db_tdb_fetch_parse(TDB_DATA key, TDB_DATA data, + void *private_data) +{ + struct tdb_fetch_state *state = + (struct tdb_fetch_state *)private_data; + + state->data.dptr = (uint8 *)talloc_memdup(state->mem_ctx, data.dptr, + data.dsize); + if (state->data.dptr == NULL) { + state->result = -1; + return 0; + } + + state->data.dsize = data.dsize; + return 0; +} + static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key, TDB_DATA *pdata) { struct db_tdb_ctx *ctx = talloc_get_type_abort( db->private_data, struct db_tdb_ctx); - TDB_DATA data; - - data = tdb_fetch(ctx->wtdb->tdb, key); + struct tdb_fetch_state state; - if (data.dptr == NULL) { - pdata->dptr = NULL; - pdata->dsize = 0; - return 0; - } + state.mem_ctx = mem_ctx; + state.result = 0; + state.data.dptr = NULL; + state.data.dsize = 0; - pdata->dptr = (uint8 *)talloc_memdup(mem_ctx, data.dptr, data.dsize); - SAFE_FREE(data.dptr); + tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state); - if (pdata->dptr == NULL) { + if (state.result == -1) { return -1; } - pdata->dsize = data.dsize; + + *pdata = state.data; return 0; } -- cgit From fa6d7b42f1c85004a7c7ece4822277e8e23f32f5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 Jan 2008 12:57:10 +0100 Subject: Do not talloc_strdup filename and servicepath (This used to be commit 66be770993acf4e1673e9615bcddb21768c33e62) --- source3/locking/locking.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 270c6d2261..2ec8cd2938 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -585,22 +585,14 @@ static bool parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) } /* Save off the associated service path and filename. */ - lck->servicepath = talloc_strdup(lck, (const char *)dbuf.dptr + sizeof(*data) + - (lck->num_share_modes * - sizeof(struct share_mode_entry)) + - data->u.s.delete_token_size ); - if (lck->servicepath == NULL) { - smb_panic("parse_share_modes: talloc_strdup failed"); - } - - lck->filename = talloc_strdup(lck, (const char *)dbuf.dptr + sizeof(*data) + - (lck->num_share_modes * - sizeof(struct share_mode_entry)) + - data->u.s.delete_token_size + - strlen(lck->servicepath) + 1 ); - if (lck->filename == NULL) { - smb_panic("parse_share_modes: talloc_strdup failed"); - } + lck->servicepath = (const char *)dbuf.dptr + sizeof(*data) + + (lck->num_share_modes * sizeof(struct share_mode_entry)) + + data->u.s.delete_token_size; + + lck->filename = (const char *)dbuf.dptr + sizeof(*data) + + (lck->num_share_modes * sizeof(struct share_mode_entry)) + + data->u.s.delete_token_size + + strlen(lck->servicepath) + 1; /* * Ensure that each entry has a real process attached. -- cgit From 26169410cd3fa90be5740a913f027802488eca8d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 21:47:53 +0100 Subject: Remove redundant parameter fd from SMB_VFS_LINUX_SETLEASE(). Michael (This used to be commit 8880eb82f16d561a4023ec8426f8ea35c579a7a6) --- source3/include/vfs.h | 2 +- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_default.c | 6 +++--- source3/modules/vfs_full_audit.c | 6 +++--- source3/modules/vfs_gpfs.c | 8 ++++---- source3/smbd/oplock_linux.c | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 3ca602cc09..921760c704 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -303,7 +303,7 @@ struct vfs_ops { int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset); bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode); - int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int leasetype); + int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype); bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath); int (*readlink)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index b1f094f815..1b85a575ad 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -72,7 +72,7 @@ #define SMB_VFS_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (op), (offset), (count), (type))) #define SMB_VFS_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (share_mode))) -#define SMB_VFS_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (fd), (leasetype))) +#define SMB_VFS_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (leasetype))) #define SMB_VFS_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (fd) ,(poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_SYMLINK(conn, oldpath, newpath) ((conn)->vfs.ops.symlink((conn)->vfs.handles.symlink, (oldpath), (newpath))) #define SMB_VFS_READLINK(conn, path, buf, bufsiz) ((conn)->vfs.ops.readlink((conn)->vfs.handles.readlink, (path), (buf), (bufsiz))) @@ -191,7 +191,7 @@ #define SMB_VFS_OPAQUE_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_OPAQUE_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (op), (offset), (count), (type))) #define SMB_VFS_OPAQUE_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs_opaque.ops.kernel_flock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (share_mode))) -#define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, fd, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (fd), (leasetype))) +#define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (leasetype))) #define SMB_VFS_OPAQUE_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_OPAQUE_SYMLINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.symlink((conn)->vfs_opaque.handles.symlink, (oldpath), (newpath))) #define SMB_VFS_OPAQUE_READLINK(conn, path, buf, bufsiz) ((conn)->vfs_opaque.ops.readlink((conn)->vfs_opaque.handles.readlink, (path), (buf), (bufsiz))) @@ -311,7 +311,7 @@ #define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (offset))) #define SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (op), (offset), (count), (type))) #define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (share_mode))) -#define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, fd, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (fd), (leasetype))) +#define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (leasetype))) #define SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.symlink((handle)->vfs_next.handles.symlink, (oldpath), (newpath))) #define SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz) ((handle)->vfs_next.ops.readlink((handle)->vfs_next.handles.readlink, (path), (buf), (bufsiz))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 96161ad273..712aae9fca 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -830,7 +830,7 @@ static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd return result; } -static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, int fd, +static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, int leasetype) { int result = -1; @@ -839,11 +839,11 @@ static int vfswrap_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, #ifdef HAVE_KERNEL_OPLOCKS_LINUX /* first set the signal handler */ - if(linux_set_lease_sighandler(fd) == -1) { + if(linux_set_lease_sighandler(fsp->fh->fd) == -1) { return -1; } - result = linux_setlease(fd, leasetype); + result = linux_setlease(fsp->fh->fd, leasetype); #else errno = ENOSYS; #endif diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index cc14597d97..2f0935f4b4 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -166,7 +166,7 @@ static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode); static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, - int fd, int leasetype); + int leasetype); static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); static int smb_full_audit_symlink(vfs_handle_struct *handle, @@ -1392,11 +1392,11 @@ static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle, } static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, - int fd, int leasetype) + int leasetype) { int result; - result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, fd, leasetype); + result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype); do_log(SMB_VFS_OP_LINUX_SETLEASE, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 1dd2c5967e..f7605b20de 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -52,21 +52,21 @@ static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, } static int vfs_gpfs_setlease(vfs_handle_struct *handle, files_struct *fsp, - int fd, int leasetype) + int leasetype) { int ret; START_PROFILE(syscall_linux_setlease); - if ( linux_set_lease_sighandler(fd) == -1) + if ( linux_set_lease_sighandler(fsp->fh->fd) == -1) return -1; - ret = set_gpfs_lease(fd,leasetype); + ret = set_gpfs_lease(fsp->fh->fd,leasetype); if ( ret < 0 ) { /* This must have come from GPFS not being available */ /* or some other error, hence call the default */ - ret = linux_setlease(fd, leasetype); + ret = linux_setlease(fsp->fh->fd, leasetype); } END_PROFILE(syscall_linux_setlease); diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c index 086f105b89..05021b6c74 100644 --- a/source3/smbd/oplock_linux.c +++ b/source3/smbd/oplock_linux.c @@ -164,7 +164,7 @@ static files_struct *linux_oplock_receive_message(fd_set *fds) static bool linux_set_kernel_oplock(files_struct *fsp, int oplock_type) { - if ( SMB_VFS_LINUX_SETLEASE(fsp,fsp->fh->fd, F_WRLCK) == -1) { + if ( SMB_VFS_LINUX_SETLEASE(fsp, F_WRLCK) == -1) { DEBUG(3,("linux_set_kernel_oplock: Refused oplock on file %s, " "fd = %d, file_id = %s. (%s)\n", fsp->fsp_name, fsp->fh->fd, @@ -202,7 +202,7 @@ static void linux_release_kernel_oplock(files_struct *fsp) /* * Remove the kernel oplock on this file. */ - if ( SMB_VFS_LINUX_SETLEASE(fsp,fsp->fh->fd, F_UNLCK) == -1) { + if ( SMB_VFS_LINUX_SETLEASE(fsp, F_UNLCK) == -1) { if (DEBUGLVL(0)) { dbgtext("linux_release_kernel_oplock: Error when " "removing kernel oplock on file " ); -- cgit From f7bf4cb3f17b5356b93c4ec89c300ad5dc20d2bc Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 22:18:50 +0100 Subject: Remove redundant parameter fd from SMB_VFS_GETLOCK(). Michael (This used to be commit ee5a20becdcdb20d7012732b324c6938fab44f67) --- source3/include/vfs.h | 4 +++- source3/include/vfs_macros.h | 6 +++--- source3/locking/posix.c | 4 ++-- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 921760c704..8fbf3ea373 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -89,6 +89,8 @@ /* Leave at 22 - not yet released. Remove parameter fd from ftruncate. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from lock. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from kernel_flock. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from linux_setlease. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from getlock. - obnox */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -304,7 +306,7 @@ struct vfs_ops { bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode); int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype); - bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); + bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath); int (*readlink)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz); int (*link)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 1b85a575ad..35b2630507 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -73,7 +73,7 @@ #define SMB_VFS_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (op), (offset), (count), (type))) #define SMB_VFS_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (share_mode))) #define SMB_VFS_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (leasetype))) -#define SMB_VFS_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (fd) ,(poffset), (pcount), (ptype), (ppid))) +#define SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_SYMLINK(conn, oldpath, newpath) ((conn)->vfs.ops.symlink((conn)->vfs.handles.symlink, (oldpath), (newpath))) #define SMB_VFS_READLINK(conn, path, buf, bufsiz) ((conn)->vfs.ops.readlink((conn)->vfs.handles.readlink, (path), (buf), (bufsiz))) #define SMB_VFS_LINK(conn, oldpath, newpath) ((conn)->vfs.ops.link((conn)->vfs.handles.link, (oldpath), (newpath))) @@ -192,7 +192,7 @@ #define SMB_VFS_OPAQUE_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (op), (offset), (count), (type))) #define SMB_VFS_OPAQUE_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs_opaque.ops.kernel_flock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (share_mode))) #define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (leasetype))) -#define SMB_VFS_OPAQUE_GETLOCK(fsp, fd, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid))) +#define SMB_VFS_OPAQUE_GETLOCK(fsp, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_OPAQUE_SYMLINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.symlink((conn)->vfs_opaque.handles.symlink, (oldpath), (newpath))) #define SMB_VFS_OPAQUE_READLINK(conn, path, buf, bufsiz) ((conn)->vfs_opaque.ops.readlink((conn)->vfs_opaque.handles.readlink, (path), (buf), (bufsiz))) #define SMB_VFS_OPAQUE_LINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.link((conn)->vfs_opaque.handles.link, (oldpath), (newpath))) @@ -312,7 +312,7 @@ #define SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (op), (offset), (count), (type))) #define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (share_mode))) #define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (leasetype))) -#define SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (fd), (poffset), (pcount), (ptype), (ppid))) +#define SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid))) #define SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.symlink((handle)->vfs_next.handles.symlink, (oldpath), (newpath))) #define SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz) ((handle)->vfs_next.ops.readlink((handle)->vfs_next.handles.readlink, (path), (buf), (bufsiz))) #define SMB_VFS_NEXT_LINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.link((handle)->vfs_next.handles.link, (oldpath), (newpath))) diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 9f84e7380f..1b88c472b0 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -233,7 +233,7 @@ static bool posix_fcntl_getlock(files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T DEBUG(8,("posix_fcntl_getlock %d %.0f %.0f %d\n", fsp->fh->fd,(double)*poffset,(double)*pcount,*ptype)); - ret = SMB_VFS_GETLOCK(fsp,fsp->fh->fd,poffset,pcount,ptype,&pid); + ret = SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, &pid); if (!ret && ((errno == EFBIG) || (errno == ENOLCK) || (errno == EINVAL))) { @@ -257,7 +257,7 @@ static bool posix_fcntl_getlock(files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T DEBUG(0,("Count greater than 31 bits - retrying with 31 bit truncated length.\n")); errno = 0; *pcount &= 0x7fffffff; - ret = SMB_VFS_GETLOCK(fsp,fsp->fh->fd,poffset,pcount,ptype,&pid); + ret = SMB_VFS_GETLOCK(fsp,poffset,pcount,ptype,&pid); } } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 712aae9fca..0054fb3646 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -820,12 +820,12 @@ static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, return 0; } -static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) +static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) { bool result; START_PROFILE(syscall_fcntl_getlock); - result = fcntl_getlock(fd, poffset, pcount, ptype, ppid); + result = fcntl_getlock(fsp->fh->fd, poffset, pcount, ptype, ppid); END_PROFILE(syscall_fcntl_getlock); return result; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 2f0935f4b4..54433347b8 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -167,7 +167,7 @@ static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle, uint32 share_mode); static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp, int leasetype); -static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, +static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); static int smb_full_audit_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath); @@ -1404,12 +1404,12 @@ static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct return result; } -static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, +static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) { bool result; - result = SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid); + result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid); do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp->fsp_name); -- cgit From e3ea1e1391a10fb1f4708abab038c0cfc2b86b41 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 22:48:19 +0100 Subject: Enable talloc reporting in libnetapi if DEVELOPER compiled. Guenther (This used to be commit 01e9151546a83e0c772a144efa85437ca0c8a307) --- source3/lib/netapi/netapi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index d5527dc4ff..61b51909c9 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -39,6 +39,9 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) return NET_API_STATUS_SUCCESS; } +#ifdef DEVELOPER + talloc_enable_leak_report(); +#endif frame = talloc_stackframe(); ctx = talloc_zero(frame, struct libnetapi_ctx); -- cgit From a8d200893a0a7bfbd5a33a52fbe47c4d14a6ed50 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 23:05:58 +0100 Subject: Refactor our DsGetDcName call a bit (before it will move into libnetapi). Guenther (This used to be commit 41c129da3d33f9fc2864d360e4b6ec5a72caf2a3) --- source3/libsmb/dsgetdcname.c | 117 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 101 insertions(+), 16 deletions(-) diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index f8089cbd6a..fa6cbe146f 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -4,7 +4,7 @@ DsGetDcname Copyright (C) Gerald Carter 2006 - Copyright (C) Guenther Deschner 2007 + Copyright (C) Guenther Deschner 2007-2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -891,28 +891,72 @@ static NTSTATUS DsGetDcName_rediscover(TALLOC_CTX *mem_ctx, } /******************************************************************** - DsGetDcName. +********************************************************************/ - This will be the only public function here. +NTSTATUS DsGetDcName_remote(TALLOC_CTX *mem_ctx, + const char *computer_name, + const char *domain_name, + struct GUID *domain_guid, + const char *site_name, + uint32_t flags, + struct DS_DOMAIN_CONTROLLER_INFO **info) +{ + WERROR werr; + NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_cli = NULL; + + status = cli_full_connection(&cli, NULL, computer_name, + NULL, 0, + "IPC$", "IPC", + "", + "", + "", + 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, + &status); + if (!pipe_cli) { + goto done; + } + + werr = rpccli_netlogon_dsr_getdcname(pipe_cli, + mem_ctx, + computer_name, + domain_name, + domain_guid, + NULL, + flags, + info); + status = werror_to_ntstatus(werr); + + done: + cli_rpc_pipe_close(pipe_cli); + if (cli) { + cli_shutdown(cli); + } + + return status; +} + +/******************************************************************** ********************************************************************/ -NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx, - const char *computer_name, - const char *domain_name, - struct GUID *domain_guid, - const char *site_name, - uint32_t flags, - struct DS_DOMAIN_CONTROLLER_INFO **info) +NTSTATUS DsGetDcName_local(TALLOC_CTX *mem_ctx, + const char *computer_name, + const char *domain_name, + struct GUID *domain_guid, + const char *site_name, + uint32_t flags, + struct DS_DOMAIN_CONTROLLER_INFO **info) { NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; struct DS_DOMAIN_CONTROLLER_INFO *myinfo = NULL; - DEBUG(10,("DsGetDcName: computer_name: %s, domain_name: %s, " - "domain_guid: %s, site_name: %s, flags: 0x%08x\n", - computer_name, domain_name, - domain_guid ? GUID_string(mem_ctx, domain_guid) : "(null)", - site_name, flags)); - *info = NULL; if (!check_allowed_required_flags(flags)) { @@ -947,3 +991,44 @@ NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx, return status; } + +/******************************************************************** + DsGetDcName. + + This will be the only public function here. +********************************************************************/ + +NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx, + const char *computer_name, + const char *domain_name, + struct GUID *domain_guid, + const char *site_name, + uint32_t flags, + struct DS_DOMAIN_CONTROLLER_INFO **info) +{ + DEBUG(10,("DsGetDcName: computer_name: %s, domain_name: %s, " + "domain_guid: %s, site_name: %s, flags: 0x%08x\n", + computer_name, domain_name, + domain_guid ? GUID_string(mem_ctx, domain_guid) : "(null)", + site_name, flags)); + + *info = NULL; + + if (computer_name) { + return DsGetDcName_remote(mem_ctx, + computer_name, + domain_name, + domain_guid, + site_name, + flags, + info); + } + + return DsGetDcName_local(mem_ctx, + computer_name, + domain_name, + domain_guid, + site_name, + flags, + info); +} -- cgit From 62e9d503d82d645cf29af643732ad97c0eb8b340 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 7 Jan 2008 23:53:34 +0100 Subject: Remove redundant parameter fd from SMB_VFS_SYS_ACL_GET_FD(). Michael (This used to be commit 42663e8736e1a3dfb57e0aafdcbf5fec880da779) --- source3/include/vfs.h | 2 +- source3/include/vfs_macros.h | 6 +++--- source3/lib/sysacls.c | 26 +++++++++++++------------- source3/modules/vfs_aixacl.c | 9 ++++----- source3/modules/vfs_aixacl2.c | 3 +-- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 9 ++++----- source3/modules/vfs_gpfs.c | 3 +-- source3/modules/vfs_hpuxacl.c | 5 ++--- source3/modules/vfs_irixacl.c | 3 +-- source3/modules/vfs_posixacl.c | 5 ++--- source3/modules/vfs_tru64acl.c | 5 ++--- source3/smbd/posix_acls.c | 8 ++++---- source3/smbd/trans2.c | 2 +- 14 files changed, 41 insertions(+), 49 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 8fbf3ea373..97648e740d 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -352,7 +352,7 @@ struct vfs_ops { int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p); void * (*sys_acl_get_qualifier)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d); SMB_ACL_T (*sys_acl_get_file)(struct vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type); - SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); + SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp); int (*sys_acl_clear_perms)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset); int (*sys_acl_add_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm); char * (*sys_acl_to_text)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 35b2630507..e7f39a57ef 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -98,7 +98,7 @@ #define SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs.ops.sys_acl_get_permset((conn)->vfs.handles.sys_acl_get_permset, (entry_d), (permset_p))) #define SMB_VFS_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs.ops.sys_acl_get_qualifier((conn)->vfs.handles.sys_acl_get_qualifier, (entry_d))) #define SMB_VFS_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs.ops.sys_acl_get_file((conn)->vfs.handles.sys_acl_get_file, (path_p), (type))) -#define SMB_VFS_SYS_ACL_GET_FD(fsp, fd) ((fsp)->conn->vfs.ops.sys_acl_get_fd((fsp)->conn->vfs.handles.sys_acl_get_fd, (fsp), (fd))) +#define SMB_VFS_SYS_ACL_GET_FD(fsp) ((fsp)->conn->vfs.ops.sys_acl_get_fd((fsp)->conn->vfs.handles.sys_acl_get_fd, (fsp))) #define SMB_VFS_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs.ops.sys_acl_clear_perms((conn)->vfs.handles.sys_acl_clear_perms, (permset))) #define SMB_VFS_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_add_perm((conn)->vfs.handles.sys_acl_add_perm, (permset), (perm))) #define SMB_VFS_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs.ops.sys_acl_to_text((conn)->vfs.handles.sys_acl_to_text, (theacl), (plen))) @@ -217,7 +217,7 @@ #define SMB_VFS_OPAQUE_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs_opaque.ops.sys_acl_get_permset((conn)->vfs_opaque.handles.sys_acl_get_permset, (entry_d), (permset_p))) #define SMB_VFS_OPAQUE_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs_opaque.ops.sys_acl_get_qualifier((conn)->vfs_opaque.handles.sys_acl_get_qualifier, (entry_d))) #define SMB_VFS_OPAQUE_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs_opaque.ops.sys_acl_get_file((conn)->vfs_opaque.handles.sys_acl_get_file, (path_p), (type))) -#define SMB_VFS_OPAQUE_SYS_ACL_GET_FD(fsp, fd) ((fsp)->conn->vfs_opaque.ops.sys_acl_get_fd((fsp)->conn->vfs_opaque.handles.sys_acl_get_fd, (fsp), (fd))) +#define SMB_VFS_OPAQUE_SYS_ACL_GET_FD(fsp) ((fsp)->conn->vfs_opaque.ops.sys_acl_get_fd((fsp)->conn->vfs_opaque.handles.sys_acl_get_fd, (fsp))) #define SMB_VFS_OPAQUE_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs_opaque.ops.sys_acl_clear_perms((conn)->vfs_opaque.handles.sys_acl_clear_perms, (permset))) #define SMB_VFS_OPAQUE_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_add_perm((conn)->vfs_opaque.handles.sys_acl_add_perm, (permset), (perm))) #define SMB_VFS_OPAQUE_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs_opaque.ops.sys_acl_to_text((conn)->vfs_opaque.handles.sys_acl_to_text, (theacl), (plen))) @@ -337,7 +337,7 @@ #define SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p) ((handle)->vfs_next.ops.sys_acl_get_permset((handle)->vfs_next.handles.sys_acl_get_permset, (entry_d), (permset_p))) #define SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d) ((handle)->vfs_next.ops.sys_acl_get_qualifier((handle)->vfs_next.handles.sys_acl_get_qualifier, (entry_d))) #define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type) ((handle)->vfs_next.ops.sys_acl_get_file((handle)->vfs_next.handles.sys_acl_get_file, (path_p), (type))) -#define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd) ((handle)->vfs_next.ops.sys_acl_get_fd((handle)->vfs_next.handles.sys_acl_get_fd, (fsp), (fd))) +#define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp) ((handle)->vfs_next.ops.sys_acl_get_fd((handle)->vfs_next.handles.sys_acl_get_fd, (fsp))) #define SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset) ((handle)->vfs_next.ops.sys_acl_clear_perms((handle)->vfs_next.handles.sys_acl_clear_perms, (permset))) #define SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm) ((handle)->vfs_next.ops.sys_acl_add_perm((handle)->vfs_next.handles.sys_acl_add_perm, (permset), (perm))) #define SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen) ((handle)->vfs_next.ops.sys_acl_to_text((handle)->vfs_next.handles.sys_acl_to_text, (theacl), (plen))) diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c index 3e61f42aa5..f23d03f706 100644 --- a/source3/lib/sysacls.c +++ b/source3/lib/sysacls.c @@ -364,9 +364,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, return posixacl_sys_acl_get_file(handle, path_p, type); } -SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { - return posixacl_sys_acl_get_fd(handle, fsp, fd); + return posixacl_sys_acl_get_fd(handle, fsp); } int sys_acl_set_file(vfs_handle_struct *handle, @@ -395,9 +395,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, return aixacl_sys_acl_get_file(handle, path_p, type); } -SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { - return aixacl_sys_acl_get_fd(handle, fsp, fd); + return aixacl_sys_acl_get_fd(handle, fsp); } int sys_acl_set_file(vfs_handle_struct *handle, @@ -426,9 +426,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, return tru64acl_sys_acl_get_file(handle, path_p, type); } -SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { - return tru64acl_sys_acl_get_fd(handle, fsp, fd); + return tru64acl_sys_acl_get_fd(handle, fsp); } int sys_acl_set_file(vfs_handle_struct *handle, @@ -457,9 +457,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, return solarisacl_sys_acl_get_file(handle, path_p, type); } -SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { - return solarisacl_sys_acl_get_fd(handle, fsp, fd); + return solarisacl_sys_acl_get_fd(handle, fsp); } int sys_acl_set_file(vfs_handle_struct *handle, @@ -488,9 +488,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, return hpuxacl_sys_acl_get_file(handle, path_p, type); } -SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { - return hpuxacl_sys_acl_get_fd(handle, fsp, fd); + return hpuxacl_sys_acl_get_fd(handle, fsp); } int sys_acl_set_file(vfs_handle_struct *handle, @@ -519,9 +519,9 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, return irixacl_sys_acl_get_file(handle, path_p, type); } -SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { - return irixacl_sys_acl_get_fd(handle, fsp, fd); + return irixacl_sys_acl_get_fd(handle, fsp); } int sys_acl_set_file(vfs_handle_struct *handle, @@ -555,7 +555,7 @@ SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, return NULL; } -SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { #ifdef ENOTSUP errno = ENOTSUP; diff --git a/source3/modules/vfs_aixacl.c b/source3/modules/vfs_aixacl.c index a60470ffc9..1a76ed6878 100644 --- a/source3/modules/vfs_aixacl.c +++ b/source3/modules/vfs_aixacl.c @@ -80,8 +80,7 @@ SMB_ACL_T aixacl_sys_acl_get_file(vfs_handle_struct *handle, } SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - int fd) + files_struct *fsp) { struct acl *file_acl = (struct acl *)NULL; @@ -93,7 +92,7 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle, /* Get the acl using fstatacl */ DEBUG(10,("Entering AIX sys_acl_get_fd\n")); - DEBUG(10,("fd is %d\n",fd)); + DEBUG(10,("fd is %d\n",fsp->fh->fd)); file_acl = (struct acl *)SMB_MALLOC(BUFSIZ); if(file_acl == NULL) { @@ -104,7 +103,7 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle, memset(file_acl,0,BUFSIZ); - rc = fstatacl(fd,0,file_acl,BUFSIZ); + rc = fstatacl(fsp->fh->fd,0,file_acl,BUFSIZ); if( (rc == -1) && (errno == ENOSPC)) { struct acl *new_acl = SMB_MALLOC(file_acl->acl_len + sizeof(struct acl)); if( new_acl == NULL) { @@ -113,7 +112,7 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle, return NULL; } file_acl = new_acl; - rc = fstatacl(fd,0,file_acl,file_acl->acl_len + sizeof(struct acl)); + rc = fstatacl(fsp->fh->fd,0,file_acl,file_acl->acl_len + sizeof(struct acl)); if( rc == -1) { DEBUG(0,("fstatacl returned %d with errno %d\n",rc,errno)); SAFE_FREE(file_acl); diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index d63886d68e..42ecb9892c 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -258,8 +258,7 @@ SMB_ACL_T aixjfs2_sys_acl_get_file(vfs_handle_struct *handle, } SMB_ACL_T aixjfs2_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - int fd) + files_struct *fsp) { acl_type_t aixjfs2_type; aixjfs2_type.u64 = ACL_AIXC; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 0054fb3646..d909b0475a 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1042,9 +1042,9 @@ static SMB_ACL_T vfswrap_sys_acl_get_file(vfs_handle_struct *handle, const char return sys_acl_get_file(handle, path_p, type); } -static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { - return sys_acl_get_fd(handle, fsp, fd); + return sys_acl_get_fd(handle, fsp); } static int vfswrap_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 54433347b8..d572c155e2 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -221,8 +221,7 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type); static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - int fd); + files_struct *fsp); static int smb_full_audit_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset); static int smb_full_audit_sys_acl_add_perm(vfs_handle_struct *handle, @@ -451,7 +450,7 @@ static vfs_op_tuple audit_op_tuples[] = { SMB_VFS_LAYER_LOGGER}, {SMB_VFS_OP(smb_full_audit_sys_acl_get_file), SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_LOGGER}, - {SMB_VFS_OP(smb_full_audit_sys_acl_get_fd), SMB_VFS_OP_SYS_ACL_GET_FD, +{SMB_VFS_OP(smb_full_audit_sys_acl_get_fd), SMB_VFS_OP_SYS_ACL_GET_FD, SMB_VFS_LAYER_LOGGER}, {SMB_VFS_OP(smb_full_audit_sys_acl_clear_perms), SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, SMB_VFS_LAYER_LOGGER}, @@ -1684,11 +1683,11 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle, } static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, int fd) + files_struct *fsp) { SMB_ACL_T result; - result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd); + result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp); do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index f7605b20de..714f6e2917 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -501,8 +501,7 @@ SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle, } SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - int fd) + files_struct *fsp) { return gpfsacl_get_posix_acl(fsp->fsp_name, GPFS_ACL_TYPE_ACCESS); } diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c index edce161c19..67fbfe56f6 100644 --- a/source3/modules/vfs_hpuxacl.c +++ b/source3/modules/vfs_hpuxacl.c @@ -182,15 +182,14 @@ SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle, * get the access ACL of a file referred to by a fd */ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - int fd) + files_struct *fsp) { /* * HPUX doesn't have the facl call. Fake it using the path.... JRA. */ /* For all I see, the info should already be in the fsp * parameter, but get it again to be safe --- necessary? */ - files_struct *file_struct_p = file_find_fd(fd); + files_struct *file_struct_p = file_find_fd(fsp->fh->fd); if (file_struct_p == NULL) { errno = EBADF; return NULL; diff --git a/source3/modules/vfs_irixacl.c b/source3/modules/vfs_irixacl.c index dab6deb747..cf53633504 100644 --- a/source3/modules/vfs_irixacl.c +++ b/source3/modules/vfs_irixacl.c @@ -32,8 +32,7 @@ SMB_ACL_T irixacl_sys_acl_get_file(vfs_handle_struct *handle, } SMB_ACL_T irixacl_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - int fd) + files_struct *fsp) { errno = ENOTSUP; return NULL; diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c index fb0c0bc8e9..faa5e8e2ad 100644 --- a/source3/modules/vfs_posixacl.c +++ b/source3/modules/vfs_posixacl.c @@ -63,11 +63,10 @@ SMB_ACL_T posixacl_sys_acl_get_file(vfs_handle_struct *handle, } SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - int fd) + files_struct *fsp) { struct smb_acl_t *result; - acl_t acl = acl_get_fd(fd); + acl_t acl = acl_get_fd(fsp->fh->fd); if (acl == NULL) { return NULL; diff --git a/source3/modules/vfs_tru64acl.c b/source3/modules/vfs_tru64acl.c index 43cae0f826..ee81ee6021 100644 --- a/source3/modules/vfs_tru64acl.c +++ b/source3/modules/vfs_tru64acl.c @@ -67,11 +67,10 @@ SMB_ACL_T tru64acl_sys_acl_get_file(vfs_handle_struct *handle, } SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - int fd) + files_struct *fsp) { struct smb_acl_t *result; - acl_t tru64_acl = acl_get_fd(fd, ACL_TYPE_ACCESS); + acl_t tru64_acl = acl_get_fd(fsp->fh->fd, ACL_TYPE_ACCESS); if (tru64_acl == NULL) { return NULL; diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 1aa3001923..b07033b8ac 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -3085,7 +3085,7 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info, } /* Get the ACL from the fd. */ - posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd); + posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp); pal = fload_inherited_info(fsp); @@ -3808,13 +3808,13 @@ int fchmod_acl(files_struct *fsp, int fd, mode_t mode) SMB_ACL_T posix_acl = NULL; int ret = -1; - if ((posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fd)) == NULL) + if ((posix_acl = SMB_VFS_SYS_ACL_GET_FD(fsp)) == NULL) return -1; if ((ret = chmod_acl_internals(conn, posix_acl, mode)) == -1) goto done; - ret = SMB_VFS_SYS_ACL_SET_FD(fsp, fd, posix_acl); + ret = SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, posix_acl); done: @@ -4099,7 +4099,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c /* Get the current file ACL. */ if (fsp && fsp->fh->fd != -1) { - file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd); + file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp); } else { file_acl = SMB_VFS_SYS_ACL_GET_FILE( conn, fname, SMB_ACL_TYPE_ACCESS); } diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index ab6706aec7..611f803210 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -4305,7 +4305,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd uint16 num_def_acls = 0; if (fsp && !fsp->is_directory && (fsp->fh->fd != -1)) { - file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp, fsp->fh->fd); + file_acl = SMB_VFS_SYS_ACL_GET_FD(fsp); } else { file_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname, SMB_ACL_TYPE_ACCESS); } -- cgit From 65fc5dbedd1b858d7406e4691e2ecc663ba756ce Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 00:21:58 +0100 Subject: Add comment. Michael (This used to be commit 8b52626f7fd30e1bdf2dd3b4263de1aff282cdd5) --- source3/include/vfs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 97648e740d..fa8645e385 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -91,6 +91,8 @@ /* Leave at 22 - not yet released. Remove parameter fd from kernel_flock. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from linux_setlease. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from getlock. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from sys_acl_get_fd. - obnox */ + #define SMB_VFS_INTERFACE_VERSION 22 -- cgit From b2182c11eab0e1b2f0acb5d82aec86d4598573eb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 01:14:24 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FCHMOD_ACL(). Michael (This used to be commit 7b201c177b3668f54751ba17d6a0b53ed913e7f7) --- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_audit.c | 6 +++--- source3/modules/vfs_default.c | 6 +++--- source3/modules/vfs_extd_audit.c | 6 +++--- source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/open.c | 5 ++--- source3/smbd/posix_acls.c | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index fa8645e385..abe474f360 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -92,6 +92,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from linux_setlease. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from getlock. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from sys_acl_get_fd. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fchmod_acl. - obnox */ @@ -347,7 +348,7 @@ struct vfs_ops { /* POSIX ACL operations. */ int (*chmod_acl)(struct vfs_handle_struct *handle, const char *name, mode_t mode); - int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode); + int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode); int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p); int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index e7f39a57ef..3cd4be1760 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -91,7 +91,7 @@ /* POSIX ACL operations. */ #define SMB_VFS_CHMOD_ACL(conn, name, mode) ((conn)->vfs.ops.chmod_acl((conn)->vfs.handles.chmod_acl, (name), (mode))) -#define SMB_VFS_FCHMOD_ACL(fsp, fd, mode) ((fsp)->conn->vfs.ops.fchmod_acl((fsp)->conn->vfs.handles.chmod_acl, (fsp), (fd), (mode))) +#define SMB_VFS_FCHMOD_ACL(fsp, mode) ((fsp)->conn->vfs.ops.fchmod_acl((fsp)->conn->vfs.handles.chmod_acl, (fsp), (mode))) #define SMB_VFS_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs.ops.sys_acl_get_entry((conn)->vfs.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p))) #define SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs.ops.sys_acl_get_tag_type((conn)->vfs.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p))) @@ -210,7 +210,7 @@ /* POSIX ACL operations. */ #define SMB_VFS_OPAQUE_CHMOD_ACL(conn, name, mode) ((conn)->vfs_opaque.ops.chmod_acl((conn)->vfs_opaque.handles.chmod_acl, (name), (mode))) -#define SMB_VFS_OPAQUE_FCHMOD_ACL(fsp, fd, mode) ((fsp)->conn->vfs_opaque.ops.fchmod_acl((fsp)->conn->vfs_opaque.handles.chmod_acl, (fsp), (fd), (mode))) +#define SMB_VFS_OPAQUE_FCHMOD_ACL(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod_acl((fsp)->conn->vfs_opaque.handles.chmod_acl, (fsp), (mode))) #define SMB_VFS_OPAQUE_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs_opaque.ops.sys_acl_get_entry((conn)->vfs_opaque.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p))) #define SMB_VFS_OPAQUE_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs_opaque.ops.sys_acl_get_tag_type((conn)->vfs_opaque.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p))) @@ -330,7 +330,7 @@ /* POSIX ACL operations. */ #define SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode) ((handle)->vfs_next.ops.chmod_acl((handle)->vfs_next.handles.chmod_acl, (name), (mode))) -#define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode) ((handle)->vfs_next.ops.fchmod_acl((handle)->vfs_next.handles.chmod_acl, (fsp), (fd), (mode))) +#define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod_acl((handle)->vfs_next.handles.chmod_acl, (fsp), (mode))) #define SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p) ((handle)->vfs_next.ops.sys_acl_get_entry((handle)->vfs_next.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p))) #define SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p) ((handle)->vfs_next.ops.sys_acl_get_tag_type((handle)->vfs_next.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p))) diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c index 27e7f998ab..a63bf4f672 100644 --- a/source3/modules/vfs_audit.c +++ b/source3/modules/vfs_audit.c @@ -40,7 +40,7 @@ static int audit_unlink(vfs_handle_struct *handle, const char *path); static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode); static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode); static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode); -static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode); +static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode); /* VFS operations */ @@ -282,11 +282,11 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod return result; } -static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; - result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode); + result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode); syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n", fsp->fsp_name, mode, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index d909b0475a..f820d4b3e2 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -563,7 +563,7 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t m { int saved_errno = errno; /* We might get ENOSYS */ - if ((result = SMB_VFS_FCHMOD_ACL(fsp, fsp->fh->fd, mode)) == 0) { + if ((result = SMB_VFS_FCHMOD_ACL(fsp, mode)) == 0) { END_PROFILE(syscall_fchmod); return result; } @@ -1002,7 +1002,7 @@ static int vfswrap_chmod_acl(vfs_handle_struct *handle, const char *name, mode_ #endif } -static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { #ifdef HAVE_NO_ACL errno = ENOSYS; @@ -1011,7 +1011,7 @@ static int vfswrap_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int int result; START_PROFILE(fchmod_acl); - result = fchmod_acl(fsp, fd, mode); + result = fchmod_acl(fsp, mode); END_PROFILE(fchmod_acl); return result; #endif diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c index f9b03731e7..a21e281e2c 100644 --- a/source3/modules/vfs_extd_audit.c +++ b/source3/modules/vfs_extd_audit.c @@ -43,7 +43,7 @@ static int audit_unlink(vfs_handle_struct *handle, const char *path); static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode); static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode); static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode); -static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode); +static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode); /* VFS operations */ @@ -328,11 +328,11 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod return result; } -static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; - result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode); + result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode); syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n", fsp->fsp_name, mode, diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index d572c155e2..4e70879dc2 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -205,7 +205,7 @@ static NTSTATUS smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struc static int smb_full_audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode); static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, mode_t mode); + mode_t mode); static int smb_full_audit_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p); @@ -1594,11 +1594,11 @@ static int smb_full_audit_chmod_acl(vfs_handle_struct *handle, } static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, - int fd, mode_t mode) + mode_t mode) { int result; - result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode); + result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode); do_log(SMB_VFS_OP_FCHMOD_ACL, (result >= 0), handle, "%s|%o", fsp->fsp_name, mode); diff --git a/source3/smbd/open.c b/source3/smbd/open.c index b618092a32..4abe017380 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1887,7 +1887,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, int saved_errno = errno; /* We might get ENOSYS in the next * call.. */ - if (SMB_VFS_FCHMOD_ACL(fsp, fsp->fh->fd, unx_mode) == -1 && + if (SMB_VFS_FCHMOD_ACL(fsp, unx_mode) == -1 && errno == ENOSYS) { errno = saved_errno; /* Ignore ENOSYS */ } @@ -1901,8 +1901,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, { int saved_errno = errno; /* We might get ENOSYS in the * next call.. */ - ret = SMB_VFS_FCHMOD_ACL(fsp, fsp->fh->fd, - new_unx_mode); + ret = SMB_VFS_FCHMOD_ACL(fsp, new_unx_mode); if (ret == -1 && errno == ENOSYS) { errno = saved_errno; /* Ignore ENOSYS */ diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index b07033b8ac..23a246fea7 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -3802,7 +3802,7 @@ int inherit_access_acl(connection_struct *conn, const char *inherit_from_dir, and set the mask to rwx. Needed to preserve complex ACLs set by NT. ****************************************************************************/ -int fchmod_acl(files_struct *fsp, int fd, mode_t mode) +int fchmod_acl(files_struct *fsp, mode_t mode) { connection_struct *conn = fsp->conn; SMB_ACL_T posix_acl = NULL; -- cgit From 5921607f2647cec20a6bcebd17c5a0c53449c1ba Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 01:54:19 +0100 Subject: Remove redundant parameter fd from SMB_VFS_SYS_ACL_SET_FD(). Michael (This used to be commit 9296e93588c0e795cae770765050247ac1474a74) --- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/lib/sysacls.c | 28 ++++++++++++++-------------- source3/modules/vfs_aixacl.c | 4 ++-- source3/modules/vfs_aixacl2.c | 4 ++-- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/modules/vfs_gpfs.c | 2 +- source3/modules/vfs_hpuxacl.c | 6 +++--- source3/modules/vfs_irixacl.c | 4 ++-- source3/modules/vfs_posixacl.c | 4 ++-- source3/modules/vfs_solarisacl.c | 8 ++++---- source3/modules/vfs_tru64acl.c | 6 +++--- source3/smbd/posix_acls.c | 10 +++++----- 14 files changed, 48 insertions(+), 47 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index abe474f360..f6f7d4fded 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -93,6 +93,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from getlock. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from sys_acl_get_fd. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fchmod_acl. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from sys_acl_set_fd. - obnox */ @@ -366,7 +367,7 @@ struct vfs_ops { int (*sys_acl_set_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset); int (*sys_acl_valid)(struct vfs_handle_struct *handle, SMB_ACL_T theacl ); int (*sys_acl_set_file)(struct vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl); - int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_ACL_T theacl); + int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl); int (*sys_acl_delete_def_file)(struct vfs_handle_struct *handle, const char *path); int (*sys_acl_get_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm); int (*sys_acl_free_text)(struct vfs_handle_struct *handle, char *text); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 3cd4be1760..3b9852a19c 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -109,7 +109,7 @@ #define SMB_VFS_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs.ops.sys_acl_set_permset((conn)->vfs.handles.sys_acl_set_permset, (entry), (permset))) #define SMB_VFS_SYS_ACL_VALID(conn, theacl) ((conn)->vfs.ops.sys_acl_valid((conn)->vfs.handles.sys_acl_valid, (theacl))) #define SMB_VFS_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs.ops.sys_acl_set_file((conn)->vfs.handles.sys_acl_set_file, (name), (acltype), (theacl))) -#define SMB_VFS_SYS_ACL_SET_FD(fsp, fd, theacl) ((fsp)->conn->vfs.ops.sys_acl_set_fd((fsp)->conn->vfs.handles.sys_acl_set_fd, (fsp), (fd), (theacl))) +#define SMB_VFS_SYS_ACL_SET_FD(fsp, theacl) ((fsp)->conn->vfs.ops.sys_acl_set_fd((fsp)->conn->vfs.handles.sys_acl_set_fd, (fsp), (theacl))) #define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs.ops.sys_acl_delete_def_file((conn)->vfs.handles.sys_acl_delete_def_file, (path))) #define SMB_VFS_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_get_perm((conn)->vfs.handles.sys_acl_get_perm, (permset), (perm))) #define SMB_VFS_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs.ops.sys_acl_free_text((conn)->vfs.handles.sys_acl_free_text, (text))) @@ -228,7 +228,7 @@ #define SMB_VFS_OPAQUE_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs_opaque.ops.sys_acl_set_permset((conn)->vfs_opaque.handles.sys_acl_set_permset, (entry), (permset))) #define SMB_VFS_OPAQUE_SYS_ACL_VALID(conn, theacl) ((conn)->vfs_opaque.ops.sys_acl_valid((conn)->vfs_opaque.handles.sys_acl_valid, (theacl))) #define SMB_VFS_OPAQUE_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs_opaque.ops.sys_acl_set_file((conn)->vfs_opaque.handles.sys_acl_set_file, (name), (acltype), (theacl))) -#define SMB_VFS_OPAQUE_SYS_ACL_SET_FD(fsp, fd, theacl) ((fsp)->conn->vfs_opaque.ops.sys_acl_set_fd((fsp)->conn->vfs_opaque.handles.sys_acl_set_fd, (fsp), (fd), (theacl))) +#define SMB_VFS_OPAQUE_SYS_ACL_SET_FD(fsp, theacl) ((fsp)->conn->vfs_opaque.ops.sys_acl_set_fd((fsp)->conn->vfs_opaque.handles.sys_acl_set_fd, (fsp), (theacl))) #define SMB_VFS_OPAQUE_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs_opaque.ops.sys_acl_delete_def_file((conn)->vfs_opaque.handles.sys_acl_delete_def_file, (path))) #define SMB_VFS_OPAQUE_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_get_perm((conn)->vfs_opaque.handles.sys_acl_get_perm, (permset), (perm))) #define SMB_VFS_OPAQUE_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs_opaque.ops.sys_acl_free_text((conn)->vfs_opaque.handles.sys_acl_free_text, (text))) @@ -348,7 +348,7 @@ #define SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset) ((handle)->vfs_next.ops.sys_acl_set_permset((handle)->vfs_next.handles.sys_acl_set_permset, (entry), (permset))) #define SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl) ((handle)->vfs_next.ops.sys_acl_valid((handle)->vfs_next.handles.sys_acl_valid, (theacl))) #define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl) ((handle)->vfs_next.ops.sys_acl_set_file((handle)->vfs_next.handles.sys_acl_set_file, (name), (acltype), (theacl))) -#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl) ((handle)->vfs_next.ops.sys_acl_set_fd((handle)->vfs_next.handles.sys_acl_set_fd, (fsp), (fd), (theacl))) +#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl) ((handle)->vfs_next.ops.sys_acl_set_fd((handle)->vfs_next.handles.sys_acl_set_fd, (fsp), (theacl))) #define SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path) ((handle)->vfs_next.ops.sys_acl_delete_def_file((handle)->vfs_next.handles.sys_acl_delete_def_file, (path))) #define SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm) ((handle)->vfs_next.ops.sys_acl_get_perm((handle)->vfs_next.handles.sys_acl_get_perm, (permset), (perm))) #define SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text) ((handle)->vfs_next.ops.sys_acl_free_text((handle)->vfs_next.handles.sys_acl_free_text, (text))) diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c index f23d03f706..9c1256ed65 100644 --- a/source3/lib/sysacls.c +++ b/source3/lib/sysacls.c @@ -3,7 +3,7 @@ Samba system utilities for ACL support. Copyright (C) Jeremy Allison 2000. Copyright (C) Volker Lendecke 2006 - Copyright (C) Michael Adam 2006 + Copyright (C) Michael Adam 2006,2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -376,9 +376,9 @@ int sys_acl_set_file(vfs_handle_struct *handle, } int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T acl_d) + SMB_ACL_T acl_d) { - return posixacl_sys_acl_set_fd(handle, fsp, fd, acl_d); + return posixacl_sys_acl_set_fd(handle, fsp, acl_d); } int sys_acl_delete_def_file(vfs_handle_struct *handle, @@ -407,9 +407,9 @@ int sys_acl_set_file(vfs_handle_struct *handle, } int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T acl_d) + SMB_ACL_T acl_d) { - return aixacl_sys_acl_set_fd(handle, fsp, fd, acl_d); + return aixacl_sys_acl_set_fd(handle, fsp, acl_d); } int sys_acl_delete_def_file(vfs_handle_struct *handle, @@ -438,9 +438,9 @@ int sys_acl_set_file(vfs_handle_struct *handle, } int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T acl_d) + SMB_ACL_T acl_d) { - return tru64acl_sys_acl_set_fd(handle, fsp, fd, acl_d); + return tru64acl_sys_acl_set_fd(handle, fsp, acl_d); } int sys_acl_delete_def_file(vfs_handle_struct *handle, @@ -469,9 +469,9 @@ int sys_acl_set_file(vfs_handle_struct *handle, } int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T acl_d) + SMB_ACL_T acl_d) { - return solarisacl_sys_acl_set_fd(handle, fsp, fd, acl_d); + return solarisacl_sys_acl_set_fd(handle, fsp, acl_d); } int sys_acl_delete_def_file(vfs_handle_struct *handle, @@ -500,9 +500,9 @@ int sys_acl_set_file(vfs_handle_struct *handle, } int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T acl_d) + SMB_ACL_T acl_d) { - return hpuxacl_sys_acl_set_fd(handle, fsp, fd, acl_d); + return hpuxacl_sys_acl_set_fd(handle, fsp, acl_d); } int sys_acl_delete_def_file(vfs_handle_struct *handle, @@ -531,9 +531,9 @@ int sys_acl_set_file(vfs_handle_struct *handle, } int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T acl_d) + SMB_ACL_T acl_d) { - return irixacl_sys_acl_set_fd(handle, fsp, fd, acl_d); + return irixacl_sys_acl_set_fd(handle, fsp, acl_d); } int sys_acl_delete_def_file(vfs_handle_struct *handle, @@ -577,7 +577,7 @@ int sys_acl_set_file(vfs_handle_struct *handle, } int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T acl_d) + SMB_ACL_T acl_d) { #ifdef ENOTSUP errno = ENOTSUP; diff --git a/source3/modules/vfs_aixacl.c b/source3/modules/vfs_aixacl.c index 1a76ed6878..726a7f485e 100644 --- a/source3/modules/vfs_aixacl.c +++ b/source3/modules/vfs_aixacl.c @@ -153,7 +153,7 @@ int aixacl_sys_acl_set_file(vfs_handle_struct *handle, int aixacl_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl) + SMB_ACL_T theacl) { struct acl *file_acl = NULL; unsigned int rc; @@ -162,7 +162,7 @@ int aixacl_sys_acl_set_fd(vfs_handle_struct *handle, if (!file_acl) return -1; - rc = fchacl(fd,file_acl,file_acl->acl_len); + rc = fchacl(fsp->fh->fd,file_acl,file_acl->acl_len); DEBUG(10,("errno is %d\n",errno)); DEBUG(10,("return code is %d\n",rc)); SAFE_FREE(file_acl); diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index 42ecb9892c..996adbbdfe 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -448,7 +448,7 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle, int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl) + SMB_ACL_T theacl) { struct acl *acl_aixc; acl_type_t acl_type_info; @@ -467,7 +467,7 @@ int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle, return -1; rc = aclx_fput( - fd, + fsp->fh->fd, SET_ACL, /* set only the ACL, not mode bits */ acl_type_info, acl_aixc, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index f820d4b3e2..a46c2a336f 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1097,9 +1097,9 @@ static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, const char *name return sys_acl_set_file(handle, name, acltype, theacl); } -static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl) +static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl) { - return sys_acl_set_fd(handle, fsp, fd, theacl); + return sys_acl_set_fd(handle, fsp, theacl); } static int vfswrap_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 4e70879dc2..64c74df1ba 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -250,7 +250,7 @@ static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl); static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl); + SMB_ACL_T theacl); static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path); static int smb_full_audit_sys_acl_get_perm(vfs_handle_struct *handle, @@ -1843,11 +1843,11 @@ static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle, } static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl) + SMB_ACL_T theacl) { int result; - result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl); + result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl); do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 714f6e2917..bcf61f3bc7 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -615,7 +615,7 @@ int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle, int gpfsacl_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl) + SMB_ACL_T theacl) { return gpfsacl_sys_acl_set_file(handle, fsp->fsp_name, SMB_ACL_TYPE_ACCESS, theacl); } diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c index 67fbfe56f6..e101886450 100644 --- a/source3/modules/vfs_hpuxacl.c +++ b/source3/modules/vfs_hpuxacl.c @@ -1,7 +1,7 @@ /* * Unix SMB/Netbios implementation. * VFS module to get and set HP-UX ACLs - * Copyright (C) Michael Adam 2006 + * Copyright (C) Michael Adam 2006,2008 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -306,14 +306,14 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle, */ int hpuxacl_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl) + SMB_ACL_T theacl) { /* * HPUX doesn't have the facl call. Fake it using the path.... JRA. */ /* For all I see, the info should already be in the fsp * parameter, but get it again to be safe --- necessary? */ - files_struct *file_struct_p = file_find_fd(fd); + files_struct *file_struct_p = file_find_fd(fsp->fh->fd); if (file_struct_p == NULL) { errno = EBADF; return -1; diff --git a/source3/modules/vfs_irixacl.c b/source3/modules/vfs_irixacl.c index cf53633504..6484e8f3eb 100644 --- a/source3/modules/vfs_irixacl.c +++ b/source3/modules/vfs_irixacl.c @@ -1,7 +1,7 @@ /* Unix SMB/Netbios implementation. VFS module to get and set irix acls - Copyright (C) Michael Adam 2006 + Copyright (C) Michael Adam 2006,2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,7 +49,7 @@ int irixacl_sys_acl_set_file(vfs_handle_struct *handle, int irixacl_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl) + SMB_ACL_T theacl) { errno = ENOTSUP; return -1; diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c index faa5e8e2ad..21fb2ada31 100644 --- a/source3/modules/vfs_posixacl.c +++ b/source3/modules/vfs_posixacl.c @@ -113,14 +113,14 @@ int posixacl_sys_acl_set_file(vfs_handle_struct *handle, int posixacl_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl) + SMB_ACL_T theacl) { int res; acl_t acl = smb_acl_to_posix(theacl); if (acl == NULL) { return -1; } - res = acl_set_fd(fd, acl); + res = acl_set_fd(fsp->fh->fd, acl); acl_free(acl); return res; } diff --git a/source3/modules/vfs_solarisacl.c b/source3/modules/vfs_solarisacl.c index cda243f8c1..ce763f07e7 100644 --- a/source3/modules/vfs_solarisacl.c +++ b/source3/modules/vfs_solarisacl.c @@ -1,7 +1,7 @@ /* Unix SMB/Netbios implementation. VFS module to get and set Solaris ACLs - Copyright (C) Michael Adam 2006 + Copyright (C) Michael Adam 2006,2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -219,7 +219,7 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle, */ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl) + SMB_ACL_T theacl) { SOLARIS_ACL_T solaris_acl = NULL; SOLARIS_ACL_T default_acl = NULL; @@ -242,7 +242,7 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle, strerror(errno))); goto done; } - if (!solaris_acl_get_fd(fd, &default_acl, &default_count)) { + if (!solaris_acl_get_fd(fsp->fh->fd, &default_acl, &default_count)) { DEBUG(10, ("error getting (default) acl from fd\n")); goto done; } @@ -258,7 +258,7 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle, goto done; } - ret = facl(fd, SETACL, count, solaris_acl); + ret = facl(fsp->fh->fd, SETACL, count, solaris_acl); if (ret != 0) { DEBUG(10, ("call of facl failed (%s).\n", strerror(errno))); } diff --git a/source3/modules/vfs_tru64acl.c b/source3/modules/vfs_tru64acl.c index ee81ee6021..b23a7ddcfa 100644 --- a/source3/modules/vfs_tru64acl.c +++ b/source3/modules/vfs_tru64acl.c @@ -1,7 +1,7 @@ /* Unix SMB/Netbios implementation. VFS module to get and set Tru64 acls - Copyright (C) Michael Adam 2006 + Copyright (C) Michael Adam 2006,2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -128,14 +128,14 @@ fail: int tru64acl_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, - int fd, SMB_ACL_T theacl) + SMB_ACL_T theacl) { int res; acl_t tru64_acl = smb_acl_to_tru64_acl(theacl); if (tru64_acl == NULL) { return -1; } - res = acl_set_fd(fd, ACL_TYPE_ACCESS, tru64_acl); + res = acl_set_fd(fsp->fh->fd, ACL_TYPE_ACCESS, tru64_acl); acl_free(tru64_acl); return res; diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 23a246fea7..b6cb1d2e54 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -2573,7 +2573,7 @@ static bool set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, bool defau } } } else { - if (SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, the_acl) == -1) { + if (SMB_VFS_SYS_ACL_SET_FD(fsp, the_acl) == -1) { /* * Some systems allow all the above calls and only fail with no ACL support * when attempting to apply the acl. HPUX with HFS is an example of this. JRA. @@ -2589,7 +2589,7 @@ static bool set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, bool defau fsp->fsp_name )); become_root(); - sret = SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, the_acl); + sret = SMB_VFS_SYS_ACL_SET_FD(fsp, the_acl); unbecome_root(); if (sret == 0) { ret = True; @@ -3814,7 +3814,7 @@ int fchmod_acl(files_struct *fsp, mode_t mode) if ((ret = chmod_acl_internals(conn, posix_acl, mode)) == -1) goto done; - ret = SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, posix_acl); + ret = SMB_VFS_SYS_ACL_SET_FD(fsp, posix_acl); done: @@ -4152,7 +4152,7 @@ static bool remove_posix_acl(connection_struct *conn, files_struct *fsp, const c /* Set the new empty file ACL. */ if (fsp && fsp->fh->fd != -1) { - if (SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, new_file_acl) == -1) { + if (SMB_VFS_SYS_ACL_SET_FD(fsp, new_file_acl) == -1) { DEBUG(5,("remove_posix_acl: acl_set_file failed on %s (%s)\n", fname, strerror(errno) )); goto done; @@ -4199,7 +4199,7 @@ bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char * if (fsp && fsp->fh->fd != -1) { /* The preferred way - use an open fd. */ - if (SMB_VFS_SYS_ACL_SET_FD(fsp, fsp->fh->fd, file_acl) == -1) { + if (SMB_VFS_SYS_ACL_SET_FD(fsp, file_acl) == -1) { DEBUG(5,("set_unix_posix_acl: acl_set_file failed on %s (%s)\n", fname, strerror(errno) )); SMB_VFS_SYS_ACL_FREE_ACL(conn, file_acl); -- cgit From 66273a795328768647c1be0d90885b15a095a011 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 01:56:56 +0100 Subject: Remove forgotton fd from solarisacl_sys_acl_get_fd(). Michael (This used to be commit 38f34b1d743caaf9f2d750580b991958d260fead) --- source3/modules/vfs_solarisacl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/modules/vfs_solarisacl.c b/source3/modules/vfs_solarisacl.c index ce763f07e7..7bdfe8465b 100644 --- a/source3/modules/vfs_solarisacl.c +++ b/source3/modules/vfs_solarisacl.c @@ -100,8 +100,7 @@ SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle, * get the access ACL of a file referred to by a fd */ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - int fd) + files_struct *fsp) { SMB_ACL_T result = NULL; int count; @@ -109,7 +108,7 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle, DEBUG(10, ("entering solarisacl_sys_acl_get_fd.\n")); - if (!solaris_acl_get_fd(fd, &solaris_acl, &count)) { + if (!solaris_acl_get_fd(fsp->fh->fd, &solaris_acl, &count)) { goto done; } /* -- cgit From 50ee744fa445b74136a8f2cef36c2b48ba7ee5f6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 10:00:47 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FGETXATTR(). Michael (This used to be commit 2cb739a82dc6bb194d60718cc74b26ee7c1c46a7) --- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_cap.c | 4 ++-- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/posix_acls.c | 2 +- source3/smbd/trans2.c | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index f6f7d4fded..171f90f410 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -94,6 +94,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from sys_acl_get_fd. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fchmod_acl. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from sys_acl_set_fd. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fgetxattr. - obnox */ @@ -377,7 +378,7 @@ struct vfs_ops { /* EA operations. */ ssize_t (*getxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size); ssize_t (*lgetxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size); - ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size); + ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size); ssize_t (*listxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size); ssize_t (*llistxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size); ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 3b9852a19c..488d1792c0 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -119,7 +119,7 @@ /* EA operations. */ #define SMB_VFS_GETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.getxattr((conn)->vfs.handles.getxattr,(path),(name),(value),(size))) #define SMB_VFS_LGETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.lgetxattr((conn)->vfs.handles.lgetxattr,(path),(name),(value),(size))) -#define SMB_VFS_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(fd),(name),(value),(size))) +#define SMB_VFS_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(name),(value),(size))) #define SMB_VFS_LISTXATTR(conn,path,list,size) ((conn)->vfs.ops.listxattr((conn)->vfs.handles.listxattr,(path),(list),(size))) #define SMB_VFS_LLISTXATTR(conn,path,list,size) ((conn)->vfs.ops.llistxattr((conn)->vfs.handles.llistxattr,(path),(list),(size))) #define SMB_VFS_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(fd),(list),(size))) @@ -238,7 +238,7 @@ /* EA operations. */ #define SMB_VFS_OPAQUE_GETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.getxattr((conn)->vfs_opaque.handles.getxattr,(path),(name),(value),(size))) #define SMB_VFS_OPAQUE_LGETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.lgetxattr((conn)->vfs_opaque.handles.lgetxattr,(path),(name),(value),(size))) -#define SMB_VFS_OPAQUE_FGETXATTR(fsp,fd,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(fd),(name),(value),(size))) +#define SMB_VFS_OPAQUE_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(name),(value),(size))) #define SMB_VFS_OPAQUE_LISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.listxattr((conn)->vfs_opaque.handles.listxattr,(path),(list),(size))) #define SMB_VFS_OPAQUE_LLISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.llistxattr((conn)->vfs_opaque.handles.llistxattr,(path),(list),(size))) #define SMB_VFS_OPAQUE_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(fd),(list),(size))) @@ -358,7 +358,7 @@ /* EA operations. */ #define SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size) ((handle)->vfs_next.ops.getxattr((handle)->vfs_next.handles.getxattr,(path),(name),(value),(size))) #define SMB_VFS_NEXT_LGETXATTR(handle,path,name,value,size) ((handle)->vfs_next.ops.lgetxattr((handle)->vfs_next.handles.lgetxattr,(path),(name),(value),(size))) -#define SMB_VFS_NEXT_FGETXATTR(handle,fsp,fd,name,value,size) ((handle)->vfs_next.ops.fgetxattr((handle)->vfs_next.handles.fgetxattr,(fsp),(fd),(name),(value),(size))) +#define SMB_VFS_NEXT_FGETXATTR(handle,fsp,name,value,size) ((handle)->vfs_next.ops.fgetxattr((handle)->vfs_next.handles.fgetxattr,(fsp),(name),(value),(size))) #define SMB_VFS_NEXT_LISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.listxattr((handle)->vfs_next.handles.listxattr,(path),(list),(size))) #define SMB_VFS_NEXT_LLISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.llistxattr((handle)->vfs_next.handles.llistxattr,(path),(list),(size))) #define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,fd,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(fd),(list),(size))) diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index f99891cb32..56ab48f9e2 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -363,7 +363,7 @@ size) return SMB_VFS_NEXT_LGETXATTR(handle, cappath, capname, value, size); } -static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, void *value, size_t size) +static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, void *value, size_t size) { char *cappath = capencode(talloc_tos(), path); @@ -371,7 +371,7 @@ static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp errno = ENOMEM; return -1; } - return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, cappath, value, size); + return SMB_VFS_NEXT_FGETXATTR(handle, fsp, cappath, value, size); } static ssize_t cap_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index a46c2a336f..ec6e6e912a 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1141,9 +1141,9 @@ static ssize_t vfswrap_lgetxattr(struct vfs_handle_struct *handle,const char *pa return sys_lgetxattr(path, name, value, size); } -static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size) { - return sys_fgetxattr(fd, name, value, size); + return sys_fgetxattr(fsp->fh->fd, name, value, size); } static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 64c74df1ba..82e212ed0a 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -270,7 +270,7 @@ static ssize_t smb_full_audit_lgetxattr(struct vfs_handle_struct *handle, const char *path, const char *name, void *value, size_t size); static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, + struct files_struct *fsp, const char *name, void *value, size_t size); static ssize_t smb_full_audit_listxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size); @@ -1956,12 +1956,12 @@ static ssize_t smb_full_audit_lgetxattr(struct vfs_handle_struct *handle, } static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, + struct files_struct *fsp, const char *name, void *value, size_t size) { ssize_t result; - result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, name, value, size); + result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size); do_log(SMB_VFS_OP_FGETXATTR, (result >= 0), handle, "%s|%s", fsp->fsp_name, name); diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index b6cb1d2e54..be05ebd2ab 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -445,7 +445,7 @@ static struct pai_val *fload_inherited_info(files_struct *fsp) do { if (fsp->fh->fd != -1) - ret = SMB_VFS_FGETXATTR(fsp, fsp->fh->fd, SAMBA_POSIX_INHERITANCE_EA_NAME, + ret = SMB_VFS_FGETXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME, pai_buf, pai_buf_size); else ret = SMB_VFS_GETXATTR(fsp->conn,fsp->fsp_name,SAMBA_POSIX_INHERITANCE_EA_NAME, diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 611f803210..42914298fa 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -130,7 +130,7 @@ static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_str } if (fsp && fsp->fh->fd != -1) { - sizeret = SMB_VFS_FGETXATTR(fsp, fsp->fh->fd, ea_name, val, attr_size); + sizeret = SMB_VFS_FGETXATTR(fsp, ea_name, val, attr_size); } else { sizeret = SMB_VFS_GETXATTR(conn, fname, ea_name, val, attr_size); } -- cgit From 9f691df852581b1ae4fab7cb9907606f4dcab291 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 10:51:40 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FLISTXATTR(). Michael (This used to be commit 167649b3b8bc293f8434ffc9fb5f80463e4e75be) --- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/trans2.c | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 171f90f410..cf969a6d7a 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -95,6 +95,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from fchmod_acl. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from sys_acl_set_fd. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fgetxattr. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from flistxattr. - obnox */ @@ -381,7 +382,7 @@ struct vfs_ops { ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size); ssize_t (*listxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size); ssize_t (*llistxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size); - ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size); + ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size); int (*removexattr)(struct vfs_handle_struct *handle, const char *path, const char *name); int (*lremovexattr)(struct vfs_handle_struct *handle, const char *path, const char *name); int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 488d1792c0..64b30b253a 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -122,7 +122,7 @@ #define SMB_VFS_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(name),(value),(size))) #define SMB_VFS_LISTXATTR(conn,path,list,size) ((conn)->vfs.ops.listxattr((conn)->vfs.handles.listxattr,(path),(list),(size))) #define SMB_VFS_LLISTXATTR(conn,path,list,size) ((conn)->vfs.ops.llistxattr((conn)->vfs.handles.llistxattr,(path),(list),(size))) -#define SMB_VFS_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(fd),(list),(size))) +#define SMB_VFS_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(list),(size))) #define SMB_VFS_REMOVEXATTR(conn,path,name) ((conn)->vfs.ops.removexattr((conn)->vfs.handles.removexattr,(path),(name))) #define SMB_VFS_LREMOVEXATTR(conn,path,name) ((conn)->vfs.ops.lremovexattr((conn)->vfs.handles.lremovexattr,(path),(name))) #define SMB_VFS_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(fd),(name))) @@ -241,7 +241,7 @@ #define SMB_VFS_OPAQUE_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(name),(value),(size))) #define SMB_VFS_OPAQUE_LISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.listxattr((conn)->vfs_opaque.handles.listxattr,(path),(list),(size))) #define SMB_VFS_OPAQUE_LLISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.llistxattr((conn)->vfs_opaque.handles.llistxattr,(path),(list),(size))) -#define SMB_VFS_OPAQUE_FLISTXATTR(fsp,fd,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(fd),(list),(size))) +#define SMB_VFS_OPAQUE_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(list),(size))) #define SMB_VFS_OPAQUE_REMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.removexattr((conn)->vfs_opaque.handles.removexattr,(path),(name))) #define SMB_VFS_OPAQUE_LREMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.lremovexattr((conn)->vfs_opaque.handles.lremovexattr,(path),(name))) #define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(fd),(name))) @@ -361,7 +361,7 @@ #define SMB_VFS_NEXT_FGETXATTR(handle,fsp,name,value,size) ((handle)->vfs_next.ops.fgetxattr((handle)->vfs_next.handles.fgetxattr,(fsp),(name),(value),(size))) #define SMB_VFS_NEXT_LISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.listxattr((handle)->vfs_next.handles.listxattr,(path),(list),(size))) #define SMB_VFS_NEXT_LLISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.llistxattr((handle)->vfs_next.handles.llistxattr,(path),(list),(size))) -#define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,fd,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(fd),(list),(size))) +#define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(list),(size))) #define SMB_VFS_NEXT_REMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.removexattr((handle)->vfs_next.handles.removexattr,(path),(name))) #define SMB_VFS_NEXT_LREMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.lremovexattr((handle)->vfs_next.handles.lremovexattr,(path),(name))) #define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,fd,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(fd),(name))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index ec6e6e912a..b96a2d201c 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1156,9 +1156,9 @@ ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, c return sys_llistxattr(path, list, size); } -ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size) +ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) { - return sys_flistxattr(fd, list, size); + return sys_flistxattr(fsp->fh->fd, list, size); } static int vfswrap_removexattr(struct vfs_handle_struct *handle, const char *path, const char *name) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 82e212ed0a..ecf136347c 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -277,7 +277,7 @@ static ssize_t smb_full_audit_listxattr(struct vfs_handle_struct *handle, static ssize_t smb_full_audit_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size); static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, char *list, + struct files_struct *fsp, char *list, size_t size); static int smb_full_audit_removexattr(struct vfs_handle_struct *handle, const char *path, @@ -1994,12 +1994,12 @@ static ssize_t smb_full_audit_llistxattr(struct vfs_handle_struct *handle, } static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, char *list, + struct files_struct *fsp, char *list, size_t size) { ssize_t result; - result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, fd, list, size); + result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size); do_log(SMB_VFS_OP_FLISTXATTR, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 42914298fa..2958985b02 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -187,7 +187,7 @@ static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_str } if (fsp && fsp->fh->fd != -1) { - sizeret = SMB_VFS_FLISTXATTR(fsp, fsp->fh->fd, ea_namelist, ea_namelist_size); + sizeret = SMB_VFS_FLISTXATTR(fsp, ea_namelist, ea_namelist_size); } else { sizeret = SMB_VFS_LISTXATTR(conn, fname, ea_namelist, ea_namelist_size); } -- cgit From 1590dd32cfccd9ce73cd798330b5207bcc48bfaf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 11:29:09 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FREMOVEXATTR(). Michael (This used to be commit bfc3b5a27f707d3e4b8d5d66192891e22365fbb3) --- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_cap.c | 4 ++-- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/posix_acls.c | 2 +- source3/smbd/trans2.c | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index cf969a6d7a..2174042d7c 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -96,6 +96,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from sys_acl_set_fd. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fgetxattr. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from flistxattr. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fremovexattr. - obnox */ @@ -385,7 +386,7 @@ struct vfs_ops { ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size); int (*removexattr)(struct vfs_handle_struct *handle, const char *path, const char *name); int (*lremovexattr)(struct vfs_handle_struct *handle, const char *path, const char *name); - int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name); + int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name); int (*setxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags); int (*lsetxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags); int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name, const void *value, size_t size, int flags); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 64b30b253a..6b066f505f 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -125,7 +125,7 @@ #define SMB_VFS_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(list),(size))) #define SMB_VFS_REMOVEXATTR(conn,path,name) ((conn)->vfs.ops.removexattr((conn)->vfs.handles.removexattr,(path),(name))) #define SMB_VFS_LREMOVEXATTR(conn,path,name) ((conn)->vfs.ops.lremovexattr((conn)->vfs.handles.lremovexattr,(path),(name))) -#define SMB_VFS_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(fd),(name))) +#define SMB_VFS_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(name))) #define SMB_VFS_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.setxattr((conn)->vfs.handles.setxattr,(path),(name),(value),(size),(flags))) #define SMB_VFS_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.lsetxattr((conn)->vfs.handles.lsetxattr,(path),(name),(value),(size),(flags))) #define SMB_VFS_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags))) @@ -244,7 +244,7 @@ #define SMB_VFS_OPAQUE_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(list),(size))) #define SMB_VFS_OPAQUE_REMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.removexattr((conn)->vfs_opaque.handles.removexattr,(path),(name))) #define SMB_VFS_OPAQUE_LREMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.lremovexattr((conn)->vfs_opaque.handles.lremovexattr,(path),(name))) -#define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,fd,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(fd),(name))) +#define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(name))) #define SMB_VFS_OPAQUE_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.setxattr((conn)->vfs_opaque.handles.setxattr,(path),(name),(value),(size),(flags))) #define SMB_VFS_OPAQUE_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.lsetxattr((conn)->vfs_opaque.handles.lsetxattr,(path),(name),(value),(size),(flags))) #define SMB_VFS_OPAQUE_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags))) @@ -364,7 +364,7 @@ #define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(list),(size))) #define SMB_VFS_NEXT_REMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.removexattr((handle)->vfs_next.handles.removexattr,(path),(name))) #define SMB_VFS_NEXT_LREMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.lremovexattr((handle)->vfs_next.handles.lremovexattr,(path),(name))) -#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,fd,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(fd),(name))) +#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(name))) #define SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.setxattr((handle)->vfs_next.handles.setxattr,(path),(name),(value),(size),(flags))) #define SMB_VFS_NEXT_LSETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.lsetxattr((handle)->vfs_next.handles.lsetxattr,(path),(name),(value),(size),(flags))) #define SMB_VFS_NEXT_FSETXATTR(handle,fsp,fd,name,value,size,flags) ((handle)->vfs_next.ops.fsetxattr((handle)->vfs_next.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags))) diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 56ab48f9e2..ab76722f4c 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -420,7 +420,7 @@ static int cap_lremovexattr(vfs_handle_struct *handle, const char *path, const c return SMB_VFS_NEXT_LREMOVEXATTR(handle, cappath, capname); } -static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path) +static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path) { char *cappath = capencode(talloc_tos(), path); @@ -428,7 +428,7 @@ static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, errno = ENOMEM; return -1; } - return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, cappath); + return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, cappath); } static int cap_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index b96a2d201c..fecf0562b8 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1171,9 +1171,9 @@ static int vfswrap_lremovexattr(struct vfs_handle_struct *handle, const char *pa return sys_lremovexattr(path, name); } -static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +static int vfswrap_fremovexattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name) { - return sys_fremovexattr(fd, name); + return sys_fremovexattr(fsp->fh->fd, name); } static int vfswrap_setxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index ecf136347c..6517c17256 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -286,7 +286,7 @@ static int smb_full_audit_lremovexattr(struct vfs_handle_struct *handle, const char *path, const char *name); static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, + struct files_struct *fsp, const char *name); static int smb_full_audit_setxattr(struct vfs_handle_struct *handle, const char *path, @@ -2036,12 +2036,12 @@ static int smb_full_audit_lremovexattr(struct vfs_handle_struct *handle, } static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, + struct files_struct *fsp, const char *name) { int result; - result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, name); + result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name); do_log(SMB_VFS_OP_FREMOVEXATTR, (result >= 0), handle, "%s|%s", fsp->fsp_name, name); diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index be05ebd2ab..120e82c4b0 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -229,7 +229,7 @@ static void store_inheritance_attributes(files_struct *fsp, canon_ace *file_ace_ if (!pai_protected && num_inherited_entries(file_ace_list) == 0 && num_inherited_entries(dir_ace_list) == 0) { /* Instead just remove the attribute if it exists. */ if (fsp->fh->fd != -1) - SMB_VFS_FREMOVEXATTR(fsp, fsp->fh->fd, SAMBA_POSIX_INHERITANCE_EA_NAME); + SMB_VFS_FREMOVEXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME); else SMB_VFS_REMOVEXATTR(fsp->conn, fsp->fsp_name, SAMBA_POSIX_INHERITANCE_EA_NAME); return; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 2958985b02..c20d930433 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -355,7 +355,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, s if (fsp && (fsp->fh->fd != -1)) { DEBUG(10,("set_ea: deleting ea name %s on file %s by file descriptor.\n", unix_ea_name, fsp->fsp_name)); - ret = SMB_VFS_FREMOVEXATTR(fsp, fsp->fh->fd, unix_ea_name); + ret = SMB_VFS_FREMOVEXATTR(fsp, unix_ea_name); } else { DEBUG(10,("set_ea: deleting ea name %s on file %s.\n", unix_ea_name, fname)); -- cgit From aab6704ce803a738ba125895b20a31f242fe2885 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 11:47:33 +0100 Subject: Remove redundant parameter fd from SMB_VFS_FSETXATTR(). Michael (This used to be commit 0bd2643463a9160c8a1c7e1c2f8cca7b89060e09) --- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_cap.c | 4 ++-- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 7 +++---- source3/smbd/posix_acls.c | 2 +- source3/smbd/trans2.c | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 2174042d7c..412625055b 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -97,6 +97,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from fgetxattr. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from flistxattr. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fremovexattr. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fsetxattr. - obnox */ @@ -389,7 +390,7 @@ struct vfs_ops { int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name); int (*setxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags); int (*lsetxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags); - int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name, const void *value, size_t size, int flags); + int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags); /* aio operations */ int (*aio_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 6b066f505f..a8640eb0e8 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -128,7 +128,7 @@ #define SMB_VFS_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(name))) #define SMB_VFS_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.setxattr((conn)->vfs.handles.setxattr,(path),(name),(value),(size),(flags))) #define SMB_VFS_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.lsetxattr((conn)->vfs.handles.lsetxattr,(path),(name),(value),(size),(flags))) -#define SMB_VFS_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags))) +#define SMB_VFS_FSETXATTR(fsp,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(name),(value),(size),(flags))) /* AIO operations. */ #define SMB_VFS_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_read((fsp)->conn->vfs.handles.aio_read,(fsp),(aiocb))) @@ -247,7 +247,7 @@ #define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(name))) #define SMB_VFS_OPAQUE_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.setxattr((conn)->vfs_opaque.handles.setxattr,(path),(name),(value),(size),(flags))) #define SMB_VFS_OPAQUE_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.lsetxattr((conn)->vfs_opaque.handles.lsetxattr,(path),(name),(value),(size),(flags))) -#define SMB_VFS_OPAQUE_FSETXATTR(fsp,fd,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags))) +#define SMB_VFS_OPAQUE_FSETXATTR(fsp,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(name),(value),(size),(flags))) /* AIO operations. */ #define SMB_VFS_OPAQUE_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_read((fsp)->conn->vfs_opaque.handles.aio_read,(fsp),(aiocb))) @@ -367,7 +367,7 @@ #define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(name))) #define SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.setxattr((handle)->vfs_next.handles.setxattr,(path),(name),(value),(size),(flags))) #define SMB_VFS_NEXT_LSETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.lsetxattr((handle)->vfs_next.handles.lsetxattr,(path),(name),(value),(size),(flags))) -#define SMB_VFS_NEXT_FSETXATTR(handle,fsp,fd,name,value,size,flags) ((handle)->vfs_next.ops.fsetxattr((handle)->vfs_next.handles.fsetxattr,(fsp),(fd),(name),(value),(size),(flags))) +#define SMB_VFS_NEXT_FSETXATTR(handle,fsp,name,value,size,flags) ((handle)->vfs_next.ops.fsetxattr((handle)->vfs_next.handles.fsetxattr,(fsp),(name),(value),(size),(flags))) /* AIO operations. */ #define SMB_VFS_NEXT_AIO_READ(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_read((handle)->vfs_next.handles.aio_read,(fsp),(aiocb))) diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index ab76722f4c..2f2d6a7182 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -455,7 +455,7 @@ static int cap_lsetxattr(vfs_handle_struct *handle, const char *path, const char return SMB_VFS_NEXT_LSETXATTR(handle, cappath, capname, value, size, flags); } -static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *path, const void *value, size_t size, int flags) +static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, const void *value, size_t size, int flags) { char *cappath = capencode(talloc_tos(), path); @@ -463,7 +463,7 @@ static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int errno = ENOMEM; return -1; } - return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, cappath, value, size, flags); + return SMB_VFS_NEXT_FSETXATTR(handle, fsp, cappath, value, size, flags); } /* VFS operations structure */ diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index fecf0562b8..3abe1483bb 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1186,9 +1186,9 @@ static int vfswrap_lsetxattr(struct vfs_handle_struct *handle, const char *path, return sys_lsetxattr(path, name, value, size, flags); } -static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) { - return sys_fsetxattr(fd, name, value, size, flags); + return sys_fsetxattr(fsp->fh->fd, name, value, size, flags); } static int vfswrap_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 6517c17256..ffa2c52da1 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -297,7 +297,7 @@ static int smb_full_audit_lsetxattr(struct vfs_handle_struct *handle, const char *name, const void *value, size_t size, int flags); static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, const char *name, + struct files_struct *fsp, const char *name, const void *value, size_t size, int flags); static int smb_full_audit_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); @@ -2082,13 +2082,12 @@ static int smb_full_audit_lsetxattr(struct vfs_handle_struct *handle, } static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle, - struct files_struct *fsp, int fd, const char *name, + struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) { int result; - result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, name, value, size, - flags); + result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags); do_log(SMB_VFS_OP_FSETXATTR, (result >= 0), handle, "%s|%s", fsp->fsp_name, name); diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 120e82c4b0..5f18615f66 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -238,7 +238,7 @@ static void store_inheritance_attributes(files_struct *fsp, canon_ace *file_ace_ pai_buf = create_pai_buf(file_ace_list, dir_ace_list, pai_protected, &store_size); if (fsp->fh->fd != -1) - ret = SMB_VFS_FSETXATTR(fsp, fsp->fh->fd, SAMBA_POSIX_INHERITANCE_EA_NAME, + ret = SMB_VFS_FSETXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME, pai_buf, store_size, 0); else ret = SMB_VFS_SETXATTR(fsp->conn,fsp->fsp_name, SAMBA_POSIX_INHERITANCE_EA_NAME, diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index c20d930433..485513c734 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -373,7 +373,7 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, s if (fsp && (fsp->fh->fd != -1)) { DEBUG(10,("set_ea: setting ea name %s on file %s by file descriptor.\n", unix_ea_name, fsp->fsp_name)); - ret = SMB_VFS_FSETXATTR(fsp, fsp->fh->fd, unix_ea_name, + ret = SMB_VFS_FSETXATTR(fsp, unix_ea_name, ea_list->ea.value.data, ea_list->ea.value.length, 0); } else { DEBUG(10,("set_ea: setting ea name %s on file %s.\n", -- cgit From c6576503c9298f1123ac4902e2b72453745d3566 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 11:46:11 +0100 Subject: When unjoining fails (e.g. missing creds) make sure we still correct config. Guenther (This used to be commit 7f51583f681b1acc9bfbab6ee0e2d1c13d2c4ca4) --- source3/libnet/libnet_join.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index f4c0dfa2c2..05ab184cec 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1075,6 +1075,9 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, status = libnet_join_unjoindomain_rpc(mem_ctx, r); if (!NT_STATUS_IS_OK(status)) { + libnet_unjoin_set_error_string(mem_ctx, r, + "failed to unjoin domain: %s\n", + nt_errstr(status)); if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { return WERR_SETUP_NOT_JOINED; } @@ -1113,6 +1116,7 @@ WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx, if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { werr = libnet_DomainUnjoin(mem_ctx, r); if (!W_ERROR_IS_OK(werr)) { + do_UnjoinConfig(r); return werr; } } -- cgit From ab216a1b4ea585faa42be4908a24a475173683d2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 11:49:35 +0100 Subject: Fix crash bug when strequal is used too late in libnetapi_free. Guenther (This used to be commit ba2b8a310e1d6f78116350e24c17ae4db08b9bed) --- source3/lib/netapi/netapi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 61b51909c9..3516105353 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -103,6 +103,14 @@ NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx) NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) { + + if (ctx->krb5_cc_env) { + char *env = getenv(KRB5_ENV_CCNAME); + if (env && (strequal(ctx->krb5_cc_env, env))) { + unsetenv(KRB5_ENV_CCNAME); + } + } + gfree_names(); gfree_loadparm(); gfree_case_tables(); @@ -113,11 +121,6 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx) secrets_shutdown(); regdb_close(); - if (ctx->krb5_cc_env && - (strequal(ctx->krb5_cc_env, getenv(KRB5_ENV_CCNAME)))) { - unsetenv(KRB5_ENV_CCNAME); - } - TALLOC_FREE(ctx); TALLOC_FREE(frame); -- cgit From a01dc30db7cb16c794f5daf23ad2df607f891626 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 11:53:38 +0100 Subject: Add NetApiBufferFree() to libnetapi. Guenther (This used to be commit c49196954d38f0c2851abbfe25086cd6fe660a2e) --- source3/lib/netapi/netapi.c | 14 ++++++++++++++ source3/lib/netapi/netapi.h | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index 3516105353..d4cb3a9fe2 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -224,3 +224,17 @@ const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx) { return ctx->error_string; } + +/**************************************************************** +****************************************************************/ + +NET_API_STATUS NetApiBufferFree(void *buffer) +{ + if (!buffer) { + return W_ERROR_V(WERR_INSUFFICIENT_BUFFER); + } + + talloc_free(buffer); + + return NET_API_STATUS_SUCCESS; +} diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 46dd8e1a24..4a40b32fc9 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -53,6 +53,11 @@ const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx); /**************************************************************** ****************************************************************/ +NET_API_STATUS NetApiBufferFree(void *buffer); + +/**************************************************************** +****************************************************************/ + /* wkssvc */ NET_API_STATUS NetJoinDomain(const char *server, const char *domain, -- cgit From 200bba3ad6592952041daa9da9805941c6dd03ba Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 11:54:51 +0100 Subject: Make name_buffer in NetGetJoinInformation() talloced. Guenther (This used to be commit 421905fb608df6736944ac21ac67abee24991521) --- source3/lib/netapi/joindomain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index aa8ec6e0b5..e4fb63eebb 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -437,9 +437,9 @@ static WERROR NetGetJoinInformationLocal(struct libnetapi_ctx *ctx, uint16_t *name_type) { if ((lp_security() == SEC_ADS) && lp_realm()) { - *name_buffer = SMB_STRDUP(lp_realm()); + *name_buffer = talloc_strdup(ctx, lp_realm()); } else { - *name_buffer = SMB_STRDUP(lp_workgroup()); + *name_buffer = talloc_strdup(ctx, lp_workgroup()); } if (!*name_buffer) { return WERR_NOMEM; -- cgit From 67f2afe3c4cfd46aa20b7a7c568ac6b5ab16acb8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 11:55:45 +0100 Subject: Correctly free buffers in netdomjoin-gui. Guenther (This used to be commit 04d78d4d9a8cffe44c927036038aef1d6d6b44b2) --- source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index 1e1681ba37..4a3588e9ab 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -249,6 +249,8 @@ static void callback_do_reboot(GtkWidget *widget, SAFE_FREE(buffer); state->name_type_new = type; #endif + NetApiBufferFree((void *)buffer); + gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer), state->name_buffer_new); if (state->name_type_new == NetSetupDomainName) { @@ -1292,8 +1294,12 @@ static int initialize_join_state(struct join_state *state, if (status) { return status; } - state->name_buffer_initial = (char *)buffer; + state->name_buffer_initial = strdup(buffer); + if (!state->name_buffer_initial) { + return -1; + } state->name_type_initial = type; + NetApiBufferFree((void *)buffer); } { @@ -1311,6 +1317,7 @@ static int initialize_join_state(struct join_state *state, if (!state->comment) { return -1; } + NetApiBufferFree(buffer); } #if 0 { -- cgit From 4a056e127ac35d640d899cd8a4735b927aa8d005 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 12:20:51 +0100 Subject: Remove redundant parameter fd from SMB_VFS_AIO_CANCEL(). Michael (This used to be commit 3c997ae0002d4c50e8899600c17ddf74ac61f6f0) --- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/aio.c | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 412625055b..02cfb12836 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -98,6 +98,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from flistxattr. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fremovexattr. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fsetxattr. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from aio_cancel. - obnox */ @@ -396,7 +397,7 @@ struct vfs_ops { int (*aio_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); int (*aio_write)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); ssize_t (*aio_return_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); - int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb); + int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); int (*aio_error_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb); int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index a8640eb0e8..63e566b334 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -134,7 +134,7 @@ #define SMB_VFS_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_read((fsp)->conn->vfs.handles.aio_read,(fsp),(aiocb))) #define SMB_VFS_AIO_WRITE(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_write((fsp)->conn->vfs.handles.aio_write,(fsp),(aiocb))) #define SMB_VFS_AIO_RETURN(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_return_fn((fsp)->conn->vfs.handles.aio_return,(fsp),(aiocb))) -#define SMB_VFS_AIO_CANCEL(fsp,fd,aiocb) ((fsp)->conn->vfs.ops.aio_cancel((fsp)->conn->vfs.handles.aio_cancel,(fsp),(fd),(aiocb))) +#define SMB_VFS_AIO_CANCEL(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_cancel((fsp)->conn->vfs.handles.aio_cancel,(fsp),(aiocb))) #define SMB_VFS_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_error_fn((fsp)->conn->vfs.handles.aio_error,(fsp),(aiocb))) #define SMB_VFS_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs.ops.aio_fsync((fsp)->conn->vfs.handles.aio_fsync,(fsp),(op),(aiocb))) #define SMB_VFS_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs.ops.aio_suspend((fsp)->conn->vfs.handles.aio_suspend,(fsp),(aiocb),(n),(ts))) @@ -253,7 +253,7 @@ #define SMB_VFS_OPAQUE_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_read((fsp)->conn->vfs_opaque.handles.aio_read,(fsp),(aiocb))) #define SMB_VFS_OPAQUE_AIO_WRITE(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_write((fsp)->conn->vfs_opaque.handles.aio_write,(fsp),(aiocb))) #define SMB_VFS_OPAQUE_AIO_RETURN(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_return_fn((fsp)->conn->vfs_opaque.handles.aio_return,(fsp),(aiocb))) -#define SMB_VFS_OPAQUE_AIO_CANCEL(fsp,fd,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_cancel((fsp)->conn->vfs_opaque.handles.cancel,(fsp),(fd),(aiocb))) +#define SMB_VFS_OPAQUE_AIO_CANCEL(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_cancel((fsp)->conn->vfs_opaque.handles.cancel,(fsp),(aiocb))) #define SMB_VFS_OPAQUE_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_error_fn((fsp)->conn->vfs_opaque.handles.aio_error,(fsp),(aiocb))) #define SMB_VFS_OPAQUE_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_fsync((fsp)->conn->vfs_opaque.handles.aio_fsync,(fsp),(op),(aiocb))) #define SMB_VFS_OPAQUE_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs_opaque.ops.aio_suspend((fsp)->conn->vfs_opaque.handles.aio_suspend,(fsp),(aiocb),(n),(ts))) @@ -373,7 +373,7 @@ #define SMB_VFS_NEXT_AIO_READ(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_read((handle)->vfs_next.handles.aio_read,(fsp),(aiocb))) #define SMB_VFS_NEXT_AIO_WRITE(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_write((handle)->vfs_next.handles.aio_write,(fsp),(aiocb))) #define SMB_VFS_NEXT_AIO_RETURN(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_return_fn((handle)->vfs_next.handles.aio_return,(fsp),(aiocb))) -#define SMB_VFS_NEXT_AIO_CANCEL(handle,fsp,fd,aiocb) ((handle)->vfs_next.ops.aio_cancel((handle)->vfs_next.handles.aio_cancel,(fsp),(fd),(aiocb))) +#define SMB_VFS_NEXT_AIO_CANCEL(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_cancel((handle)->vfs_next.handles.aio_cancel,(fsp),(aiocb))) #define SMB_VFS_NEXT_AIO_ERROR(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_error_fn((handle)->vfs_next.handles.aio_error,(fsp),(aiocb))) #define SMB_VFS_NEXT_AIO_FSYNC(handle,fsp,op,aiocb) ((handle)->vfs_next.ops.aio_fsync((handle)->vfs_next.handles.aio_fsync,(fsp),(op),(aiocb))) #define SMB_VFS_NEXT_AIO_SUSPEND(handle,fsp,aiocb,n,ts) ((handle)->vfs_next.ops.aio_suspend((handle)->vfs_next.handles.aio_suspend,(fsp),(aiocb),(n),(ts))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 3abe1483bb..97138bdacf 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1206,9 +1206,9 @@ static ssize_t vfswrap_aio_return(struct vfs_handle_struct *handle, struct files return sys_aio_return(aiocb); } -static int vfswrap_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb) +static int vfswrap_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) { - return sys_aio_cancel(fd, aiocb); + return sys_aio_cancel(fsp->fh->fd, aiocb); } static int vfswrap_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index ffa2c52da1..95fdc17d56 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -303,7 +303,7 @@ static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle, static int smb_full_audit_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); static int smb_full_audit_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); static ssize_t smb_full_audit_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); -static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb); +static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); static int smb_full_audit_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); static int smb_full_audit_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb); static int smb_full_audit_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts); @@ -2128,11 +2128,11 @@ static ssize_t smb_full_audit_aio_return(struct vfs_handle_struct *handle, struc return result; } -static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb) +static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) { int result; - result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, fd, aiocb); + result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb); do_log(SMB_VFS_OP_AIO_CANCEL, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index bc1761b0fd..c8175f77ac 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -746,7 +746,7 @@ void cancel_aio_by_fsp(files_struct *fsp) /* Don't delete the aio_extra record as we may have completed and don't yet know it. Just do the aio_cancel call and return. */ - SMB_VFS_AIO_CANCEL(fsp,fsp->fh->fd, &aio_ex->acb); + SMB_VFS_AIO_CANCEL(fsp, &aio_ex->acb); aio_ex->fsp = NULL; /* fsp will be closed when we * return. */ } -- cgit From 17e8104d9b0032dd3a7aa7242bc23f2021723e07 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 12:25:47 +0100 Subject: Correctly talloc ctx->remote_path in libgpo (thanks Michael for the pointer). Guenther (This used to be commit 2ea57a76a6bc8f9c835818780fcc9324896d5c1f) --- source3/libgpo/gpo_filesync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libgpo/gpo_filesync.c b/source3/libgpo/gpo_filesync.c index 9f6557ef32..03d5286fae 100644 --- a/source3/libgpo/gpo_filesync.c +++ b/source3/libgpo/gpo_filesync.c @@ -166,7 +166,7 @@ static void gpo_sync_func(const char *mnt, } old_nt_dir = ctx->remote_path; - ctx->remote_path = nt_dir; + ctx->remote_path = talloc_strdup(ctx->mem_ctx, nt_dir); old_unix_dir = ctx->local_path; ctx->local_path = talloc_strdup(ctx->mem_ctx, unix_dir); @@ -174,7 +174,7 @@ static void gpo_sync_func(const char *mnt, ctx->mask = talloc_asprintf(ctx->mem_ctx, "%s\\*", nt_dir); - if (!ctx->local_path || !ctx->mask) { + if (!ctx->local_path || !ctx->mask || !ctx->remote_path) { DEBUG(0,("gpo_sync_func: ENOMEM\n")); return; } -- cgit From f0b67934143b24914ef36c1d326350ef0ca66ee3 Mon Sep 17 00:00:00 2001 From: Karolin Seeger Date: Tue, 8 Jan 2008 12:23:25 +0100 Subject: Add missing quote. Fix bug 5172. Thanks to Jason Filley for reporting! Karolin (This used to be commit 6be1ee8e6fb4e7fd413098c40b40569a980bd7a5) --- packaging/Example/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/Example/setup.sh b/packaging/Example/setup.sh index 994b16d5ef..7fd8fc4110 100755 --- a/packaging/Example/setup.sh +++ b/packaging/Example/setup.sh @@ -24,4 +24,4 @@ echo "Done. Now settting up samba command" ln /sbin/init.d/samba.init /sbin/samba echo "Done." echo "To start / stop samba:" -echo " execute: samba [start | stop] +echo " execute: samba [start | stop]" -- cgit From f89fa0a6f85b74469519ba97752f45db8b879689 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 13:46:54 +0100 Subject: Do not ignore provided machine_name in ads_get_upn(). Guenther (This used to be commit ddc1307844379f99b3dde48fc351d0326d22a7ce) --- source3/libads/ldap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 975e926864..28bc7793d7 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -3026,26 +3026,26 @@ char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name ) ADS_STATUS status; int count = 0; char *name = NULL; - - status = ads_find_machine_acct(ads, &res, global_myname()); + + status = ads_find_machine_acct(ads, &res, machine_name); if (!ADS_ERR_OK(status)) { DEBUG(0,("ads_get_upn: Failed to find account for %s\n", global_myname())); goto out; } - + if ( (count = ads_count_replies(ads, res)) != 1 ) { DEBUG(1,("ads_get_upn: %d entries returned!\n", count)); goto out; } - + if ( (name = ads_pull_string(ads, ctx, res, "userPrincipalName")) == NULL ) { DEBUG(2,("ads_get_upn: No userPrincipalName attribute!\n")); } out: ads_msgfree(ads, res); - + return name; } -- cgit From 697208406cd5b669d76265f753097faa761df9c8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 14:03:12 +0100 Subject: Fix define check s/WITH_LDAP/HAVE_LDAP/ in libnet_join. Guenther (This used to be commit 045a69c59c3b0732bb12a8b0efc8c9675e811719) --- source3/libnet/libnet_join.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 05ab184cec..454c1f29fb 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -58,7 +58,7 @@ static void libnet_unjoin_set_error_string(TALLOC_CTX *mem_ctx, r->out.error_string = tmp; } -#ifdef WITH_LDAP +#ifdef HAVE_LDAP /**************************************************************** ****************************************************************/ @@ -964,7 +964,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { NTSTATUS status; -#ifdef WITH_LDAP +#ifdef HAVE_LDAP ADS_STATUS ads_status; if (r->in.account_ou) { @@ -996,7 +996,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, return WERR_SETUP_NOT_JOINED; } -#ifdef WITH_LDAP +#ifdef HAVE_LDAP ads_status = libnet_join_set_machine_spn(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { libnet_join_set_error_string(mem_ctx, r, @@ -1084,7 +1084,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, return ntstatus_to_werror(status); } -#ifdef WITH_LDAP +#ifdef HAVE_LDAP if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) { ADS_STATUS ads_status; libnet_unjoin_connect_ads(mem_ctx, r); -- cgit From 62c91987d902d4dfe27023ff2ec2fb73e602105b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 14:06:18 +0100 Subject: Use ads_get_upn() in net_derive_salting_principal(). Guenther (This used to be commit a3b348b113f248d2eccffd6073560619a97a2976) --- source3/utils/net_ads.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 141031dacb..310af82beb 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -1255,7 +1255,6 @@ static bool net_derive_salting_principal( TALLOC_CTX *ctx, ADS_STRUCT *ads ) ADS_STATUS status; fstring salt; char *std_salt; - LDAPMessage *res = NULL; const char *machine_name = global_myname(); status = ads_domain_func_level( ads, &domain_func ); @@ -1278,24 +1277,11 @@ static bool net_derive_salting_principal( TALLOC_CTX *ctx, ADS_STRUCT *ads ) if ( domain_func == DS_DOMAIN_FUNCTION_2000 ) { char *upn; - int count; - - status = ads_find_machine_acct(ads, &res, machine_name); - if (!ADS_ERR_OK(status)) { - return False; - } - if ( (count = ads_count_replies(ads, res)) != 1 ) { - DEBUG(1,("net_set_machine_spn: %d entries returned!\n", count)); - return False; - } - - upn = ads_pull_string(ads, ctx, res, "userPrincipalName"); + upn = ads_get_upn(ads, ctx, machine_name); if ( upn ) { fstrcpy( salt, upn ); } - - ads_msgfree(ads, res); } return kerberos_secrets_store_des_salt( salt ); -- cgit From 791fe3119ef1756fc476b17b8c590241bee5de2e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 18:07:55 +0100 Subject: Pedantic cosmetics: rerun make idl. Guenther (This used to be commit d1fa8049b1c0a3cebbc2c64e245e8055c8d3e84b) --- source3/librpc/gen_ndr/cli_dfs.c | 412 ++++----- source3/librpc/gen_ndr/cli_echo.c | 160 ++-- source3/librpc/gen_ndr/cli_epmapper.c | 128 +-- source3/librpc/gen_ndr/cli_eventlog.c | 384 ++++----- source3/librpc/gen_ndr/cli_initshutdown.c | 54 +- source3/librpc/gen_ndr/cli_lsa.c | 1312 ++++++++++++++--------------- source3/librpc/gen_ndr/cli_netlogon.c | 810 +++++++++--------- source3/librpc/gen_ndr/cli_srvsvc.c | 972 ++++++++++----------- source3/librpc/gen_ndr/cli_svcctl.c | 792 ++++++++--------- source3/librpc/gen_ndr/cli_unixinfo.c | 80 +- source3/librpc/gen_ndr/cli_winreg.c | 630 +++++++------- source3/librpc/gen_ndr/cli_wkssvc.c | 558 ++++++------ 12 files changed, 3146 insertions(+), 3146 deletions(-) diff --git a/source3/librpc/gen_ndr/cli_dfs.c b/source3/librpc/gen_ndr/cli_dfs.c index fda04608d3..1cd085eaec 100644 --- a/source3/librpc/gen_ndr/cli_dfs.c +++ b/source3/librpc/gen_ndr/cli_dfs.c @@ -10,28 +10,28 @@ NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct dfs_GetManagerVersion r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_GetManagerVersion, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_GETMANAGERVERSION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_GetManagerVersion, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *version = *r.out.version; - + /* Return result */ return NT_STATUS_OK; } @@ -40,37 +40,37 @@ NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const { struct dfs_Add r; NTSTATUS status; - + /* In parameters */ r.in.path = path; r.in.server = server; r.in.share = share; r.in.comment = comment; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_Add, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_Add, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -78,35 +78,35 @@ NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, con { struct dfs_Remove r; NTSTATUS status; - + /* In parameters */ r.in.dfs_entry_path = dfs_entry_path; r.in.servername = servername; r.in.sharename = sharename; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_Remove, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_Remove, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -114,37 +114,37 @@ NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co { struct dfs_SetInfo r; NTSTATUS status; - + /* In parameters */ r.in.dfs_entry_path = dfs_entry_path; r.in.servername = servername; r.in.sharename = sharename; r.in.level = level; r.in.info = info; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_SetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_SETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_SetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -152,37 +152,37 @@ NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co { struct dfs_GetInfo r; NTSTATUS status; - + /* In parameters */ r.in.dfs_entry_path = dfs_entry_path; r.in.servername = servername; r.in.sharename = sharename; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_GetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_GETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_GetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -190,29 +190,29 @@ NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint3 { struct dfs_Enum r; NTSTATUS status; - + /* In parameters */ r.in.level = level; r.in.bufsize = bufsize; r.in.info = info; r.in.total = total; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_Enum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_Enum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; @@ -220,12 +220,12 @@ NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint3 if (total && r.out.total) { *total = *r.out.total; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -233,32 +233,32 @@ NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WER { struct dfs_Rename r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_Rename, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_RENAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_Rename, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -266,32 +266,32 @@ NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERRO { struct dfs_Move r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_Move, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MOVE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_Move, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -299,32 +299,32 @@ NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, TALLOC_CTX { struct dfs_ManagerGetConfigInfo r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_ManagerGetConfigInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MANAGERGETCONFIGINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_ManagerGetConfigInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -332,32 +332,32 @@ NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, TALLOC_CTX { struct dfs_ManagerSendSiteInfo r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_ManagerSendSiteInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MANAGERSENDSITEINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_ManagerSendSiteInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -365,7 +365,7 @@ NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct dfs_AddFtRoot r; NTSTATUS status; - + /* In parameters */ r.in.servername = servername; r.in.dns_servername = dns_servername; @@ -376,33 +376,33 @@ NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.unknown1 = unknown1; r.in.flags = flags; r.in.unknown2 = unknown2; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_AddFtRoot, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADDFTROOT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_AddFtRoot, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (unknown2 && r.out.unknown2) { *unknown2 = *r.out.unknown2; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -410,7 +410,7 @@ NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct dfs_RemoveFtRoot r; NTSTATUS status; - + /* In parameters */ r.in.servername = servername; r.in.dns_servername = dns_servername; @@ -418,33 +418,33 @@ NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.rootshare = rootshare; r.in.flags = flags; r.in.unknown = unknown; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_RemoveFtRoot, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVEFTROOT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_RemoveFtRoot, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (unknown && r.out.unknown) { *unknown = *r.out.unknown; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -452,36 +452,36 @@ NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct dfs_AddStdRoot r; NTSTATUS status; - + /* In parameters */ r.in.servername = servername; r.in.rootshare = rootshare; r.in.comment = comment; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_AddStdRoot, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADDSTDROOT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_AddStdRoot, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -489,35 +489,35 @@ NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct dfs_RemoveStdRoot r; NTSTATUS status; - + /* In parameters */ r.in.servername = servername; r.in.rootshare = rootshare; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_RemoveStdRoot, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVESTDROOT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_RemoveStdRoot, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -525,34 +525,34 @@ NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct dfs_ManagerInitialize r; NTSTATUS status; - + /* In parameters */ r.in.servername = servername; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_ManagerInitialize, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MANAGERINITIALIZE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_ManagerInitialize, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -560,36 +560,36 @@ NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct dfs_AddStdRootForced r; NTSTATUS status; - + /* In parameters */ r.in.servername = servername; r.in.rootshare = rootshare; r.in.comment = comment; r.in.store = store; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_AddStdRootForced, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADDSTDROOTFORCED, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_AddStdRootForced, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -597,32 +597,32 @@ NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct dfs_GetDcAddress r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_GetDcAddress, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_GETDCADDRESS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_GetDcAddress, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -630,32 +630,32 @@ NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct dfs_SetDcAddress r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_SetDcAddress, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_SETDCADDRESS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_SetDcAddress, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -663,34 +663,34 @@ NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct dfs_FlushFtTable r; NTSTATUS status; - + /* In parameters */ r.in.servername = servername; r.in.rootshare = rootshare; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_FlushFtTable, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_FLUSHFTTABLE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_FlushFtTable, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -698,32 +698,32 @@ NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERRO { struct dfs_Add2 r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_Add2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADD2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_Add2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -731,32 +731,32 @@ NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WE { struct dfs_Remove2 r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_Remove2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVE2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_Remove2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -764,30 +764,30 @@ NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, con { struct dfs_EnumEx r; NTSTATUS status; - + /* In parameters */ r.in.dfs_name = dfs_name; r.in.level = level; r.in.bufsize = bufsize; r.in.info = info; r.in.total = total; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_EnumEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ENUMEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_EnumEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; @@ -795,12 +795,12 @@ NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, con if (total && r.out.total) { *total = *r.out.total; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -808,32 +808,32 @@ NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, W { struct dfs_SetInfo2 r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(dfs_SetInfo2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_SETINFO2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(dfs_SetInfo2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } diff --git a/source3/librpc/gen_ndr/cli_echo.c b/source3/librpc/gen_ndr/cli_echo.c index 4da2d7a209..2d6187a937 100644 --- a/source3/librpc/gen_ndr/cli_echo.c +++ b/source3/librpc/gen_ndr/cli_echo.c @@ -10,29 +10,29 @@ NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, ui { struct echo_AddOne r; NTSTATUS status; - + /* In parameters */ r.in.in_data = in_data; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_AddOne, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_ADDONE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_AddOne, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *out_data = *r.out.out_data; - + /* Return result */ return NT_STATUS_OK; } @@ -41,30 +41,30 @@ NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct echo_EchoData r; NTSTATUS status; - + /* In parameters */ r.in.len = len; r.in.in_data = in_data; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_EchoData, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_ECHODATA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_EchoData, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(out_data, r.out.out_data, r.in.len); - + /* Return result */ return NT_STATUS_OK; } @@ -73,29 +73,29 @@ NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct echo_SinkData r; NTSTATUS status; - + /* In parameters */ r.in.len = len; r.in.data = data; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_SinkData, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_SINKDATA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_SinkData, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return NT_STATUS_OK; } @@ -104,29 +104,29 @@ NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct echo_SourceData r; NTSTATUS status; - + /* In parameters */ r.in.len = len; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_SourceData, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_SOURCEDATA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_SourceData, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(data, r.out.data, r.in.len); - + /* Return result */ return NT_STATUS_OK; } @@ -135,29 +135,29 @@ NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct echo_TestCall r; NTSTATUS status; - + /* In parameters */ r.in.s1 = s1; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_TestCall, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTCALL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_TestCall, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *s2 = *r.out.s2; - + /* Return result */ return NT_STATUS_OK; } @@ -166,29 +166,29 @@ NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct echo_TestCall2 r; NTSTATUS status; - + /* In parameters */ r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_TestCall2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTCALL2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_TestCall2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ return r.out.result; } @@ -197,28 +197,28 @@ NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct echo_TestSleep r; NTSTATUS status; - + /* In parameters */ r.in.seconds = seconds; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_TestSleep, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTSLEEP, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_TestSleep, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return NT_STATUS_OK; } @@ -227,33 +227,33 @@ NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct echo_TestEnum r; NTSTATUS status; - + /* In parameters */ r.in.foo1 = foo1; r.in.foo2 = foo2; r.in.foo3 = foo3; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_TestEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_TestEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *foo1 = *r.out.foo1; *foo2 = *r.out.foo2; *foo3 = *r.out.foo3; - + /* Return result */ return NT_STATUS_OK; } @@ -262,29 +262,29 @@ NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct echo_TestSurrounding r; NTSTATUS status; - + /* In parameters */ r.in.data = data; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_TestSurrounding, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTSURROUNDING, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *data = *r.out.data; - + /* Return result */ return NT_STATUS_OK; } @@ -293,28 +293,28 @@ NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX * { struct echo_TestDoublePointer r; NTSTATUS status; - + /* In parameters */ r.in.data = data; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTDOUBLEPOINTER, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return NT_STATUS_OK; } diff --git a/source3/librpc/gen_ndr/cli_epmapper.c b/source3/librpc/gen_ndr/cli_epmapper.c index e00d9aa2a1..1ac594ddd7 100644 --- a/source3/librpc/gen_ndr/cli_epmapper.c +++ b/source3/librpc/gen_ndr/cli_epmapper.c @@ -10,30 +10,30 @@ NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin { struct epm_Insert r; NTSTATUS status; - + /* In parameters */ r.in.num_ents = num_ents; r.in.entries = entries; r.in.replace = replace; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(epm_Insert, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_INSERT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(epm_Insert, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return NT_STATUS_OK; } @@ -42,29 +42,29 @@ NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin { struct epm_Delete r; NTSTATUS status; - + /* In parameters */ r.in.num_ents = num_ents; r.in.entries = entries; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(epm_Delete, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_DELETE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(epm_Delete, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return NT_STATUS_OK; } @@ -73,7 +73,7 @@ NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin { struct epm_Lookup r; NTSTATUS status; - + /* In parameters */ r.in.inquiry_type = inquiry_type; r.in.object = object; @@ -81,28 +81,28 @@ NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin r.in.vers_option = vers_option; r.in.entry_handle = entry_handle; r.in.max_ents = max_ents; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(epm_Lookup, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_LOOKUP, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(epm_Lookup, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *entry_handle = *r.out.entry_handle; *num_ents = *r.out.num_ents; memcpy(entries, r.out.entries, r.in.max_ents); - + /* Return result */ return NT_STATUS_OK; } @@ -111,34 +111,34 @@ NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct { struct epm_Map r; NTSTATUS status; - + /* In parameters */ r.in.object = object; r.in.map_tower = map_tower; r.in.entry_handle = entry_handle; r.in.max_towers = max_towers; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(epm_Map, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_MAP, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(epm_Map, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *entry_handle = *r.out.entry_handle; *num_towers = *r.out.num_towers; memcpy(towers, r.out.towers, r.in.max_towers); - + /* Return result */ return NT_STATUS_OK; } @@ -147,29 +147,29 @@ NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct epm_LookupHandleFree r; NTSTATUS status; - + /* In parameters */ r.in.entry_handle = entry_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(epm_LookupHandleFree, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_LOOKUPHANDLEFREE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(epm_LookupHandleFree, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *entry_handle = *r.out.entry_handle; - + /* Return result */ return NT_STATUS_OK; } @@ -178,28 +178,28 @@ NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct epm_InqObject r; NTSTATUS status; - + /* In parameters */ r.in.epm_object = epm_object; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(epm_InqObject, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_INQOBJECT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(epm_InqObject, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return NT_STATUS_OK; } @@ -208,30 +208,30 @@ NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct epm_MgmtDelete r; NTSTATUS status; - + /* In parameters */ r.in.object_speced = object_speced; r.in.object = object; r.in.tower = tower; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(epm_MgmtDelete, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_MGMTDELETE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(epm_MgmtDelete, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return NT_STATUS_OK; } @@ -240,27 +240,27 @@ NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) { struct epm_MapAuth r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(epm_MapAuth, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_MAPAUTH, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(epm_MapAuth, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return NT_STATUS_OK; } diff --git a/source3/librpc/gen_ndr/cli_eventlog.c b/source3/librpc/gen_ndr/cli_eventlog.c index 3fd61a7d49..fbcd098538 100644 --- a/source3/librpc/gen_ndr/cli_eventlog.c +++ b/source3/librpc/gen_ndr/cli_eventlog.c @@ -10,29 +10,29 @@ NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX { struct eventlog_ClearEventLogW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.unknown = unknown; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CLEAREVENTLOGW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -41,27 +41,27 @@ NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX { struct eventlog_BackupEventLogW r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_BACKUPEVENTLOGW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -70,29 +70,29 @@ NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli, TALLOC_CTX * { struct eventlog_CloseEventLog r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_CloseEventLog, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CLOSEEVENTLOG, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_CloseEventLog, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ return r.out.result; } @@ -101,27 +101,27 @@ NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli, TALL { struct eventlog_DeregisterEventSource r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_DeregisterEventSource, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_DEREGISTEREVENTSOURCE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_DeregisterEventSource, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -130,29 +130,29 @@ NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli, TALLOC_CTX * { struct eventlog_GetNumRecords r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_GetNumRecords, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_GETNUMRECORDS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_GetNumRecords, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *number = *r.out.number; - + /* Return result */ return r.out.result; } @@ -161,27 +161,27 @@ NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli, TALLOC_CTX { struct eventlog_GetOldestRecord r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_GetOldestRecord, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_GETOLDESTRECORD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_GetOldestRecord, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -190,27 +190,27 @@ NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct eventlog_ChangeNotify r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_ChangeNotify, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CHANGENOTIFY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_ChangeNotify, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -219,33 +219,33 @@ NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX * { struct eventlog_OpenEventLogW r; NTSTATUS status; - + /* In parameters */ r.in.unknown0 = unknown0; r.in.logname = logname; r.in.servername = servername; r.in.unknown2 = unknown2; r.in.unknown3 = unknown3; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENEVENTLOGW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ return r.out.result; } @@ -254,27 +254,27 @@ NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli, TALLO { struct eventlog_RegisterEventSourceW r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REGISTEREVENTSOURCEW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -283,27 +283,27 @@ NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli, TALLOC { struct eventlog_OpenBackupEventLogW r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENBACKUPEVENTLOGW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -312,34 +312,34 @@ NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX * { struct eventlog_ReadEventLogW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.flags = flags; r.in.offset = offset; r.in.number_of_bytes = number_of_bytes; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_READEVENTLOGW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(data, r.out.data, r.in.number_of_bytes); *sent_size = *r.out.sent_size; *real_size = *r.out.real_size; - + /* Return result */ return r.out.result; } @@ -348,27 +348,27 @@ NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct eventlog_ReportEventW r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_ReportEventW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REPORTEVENTW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_ReportEventW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -377,27 +377,27 @@ NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX { struct eventlog_ClearEventLogA r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CLEAREVENTLOGA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -406,27 +406,27 @@ NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX { struct eventlog_BackupEventLogA r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_BACKUPEVENTLOGA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -435,27 +435,27 @@ NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX * { struct eventlog_OpenEventLogA r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENEVENTLOGA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -464,27 +464,27 @@ NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli, TALLO { struct eventlog_RegisterEventSourceA r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REGISTEREVENTSOURCEA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -493,27 +493,27 @@ NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli, TALLOC { struct eventlog_OpenBackupEventLogA r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENBACKUPEVENTLOGA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -522,27 +522,27 @@ NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX * { struct eventlog_ReadEventLogA r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_READEVENTLOGA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -551,27 +551,27 @@ NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct eventlog_ReportEventA r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_ReportEventA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REPORTEVENTA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_ReportEventA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -580,27 +580,27 @@ NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_ { struct eventlog_RegisterClusterSvc r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_RegisterClusterSvc, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REGISTERCLUSTERSVC, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_RegisterClusterSvc, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -609,27 +609,27 @@ NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli, TALLO { struct eventlog_DeregisterClusterSvc r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_DeregisterClusterSvc, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_DEREGISTERCLUSTERSVC, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_DeregisterClusterSvc, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -638,27 +638,27 @@ NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli, TALLOC_ { struct eventlog_WriteClusterEvents r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_WriteClusterEvents, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_WRITECLUSTEREVENTS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_WriteClusterEvents, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -667,27 +667,27 @@ NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli, TALLOC_C { struct eventlog_GetLogIntormation r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_GetLogIntormation, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_GETLOGINTORMATION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_GetLogIntormation, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -696,28 +696,28 @@ NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli, TALLOC_CTX * { struct eventlog_FlushEventLog r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(eventlog_FlushEventLog, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_FLUSHEVENTLOG, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(eventlog_FlushEventLog, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } diff --git a/source3/librpc/gen_ndr/cli_initshutdown.c b/source3/librpc/gen_ndr/cli_initshutdown.c index 57c5e60226..a549c94ce5 100644 --- a/source3/librpc/gen_ndr/cli_initshutdown.c +++ b/source3/librpc/gen_ndr/cli_initshutdown.c @@ -10,37 +10,37 @@ NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct initshutdown_Init r; NTSTATUS status; - + /* In parameters */ r.in.hostname = hostname; r.in.message = message; r.in.timeout = timeout; r.in.force_apps = force_apps; r.in.reboot = reboot; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(initshutdown_Init, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, &ndr_table_initshutdown, NDR_INITSHUTDOWN_INIT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(initshutdown_Init, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -48,33 +48,33 @@ NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct initshutdown_Abort r; NTSTATUS status; - + /* In parameters */ r.in.server = server; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(initshutdown_Abort, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, &ndr_table_initshutdown, NDR_INITSHUTDOWN_ABORT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(initshutdown_Abort, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -82,7 +82,7 @@ NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct initshutdown_InitEx r; NTSTATUS status; - + /* In parameters */ r.in.hostname = hostname; r.in.message = message; @@ -90,30 +90,30 @@ NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.force_apps = force_apps; r.in.reboot = reboot; r.in.reason = reason; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(initshutdown_InitEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, &ndr_table_initshutdown, NDR_INITSHUTDOWN_INITEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(initshutdown_InitEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } diff --git a/source3/librpc/gen_ndr/cli_lsa.c b/source3/librpc/gen_ndr/cli_lsa.c index 50186360f6..49bb44880a 100644 --- a/source3/librpc/gen_ndr/cli_lsa.c +++ b/source3/librpc/gen_ndr/cli_lsa.c @@ -10,29 +10,29 @@ NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, stru { struct lsa_Close r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_Close, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CLOSE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_Close, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ return r.out.result; } @@ -41,28 +41,28 @@ NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, str { struct lsa_Delete r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_Delete, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_DELETE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_Delete, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -71,32 +71,32 @@ NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct lsa_EnumPrivs r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.resume_handle = resume_handle; r.in.max_count = max_count; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_EnumPrivs, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMPRIVS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_EnumPrivs, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *resume_handle = *r.out.resume_handle; *privs = *r.out.privs; - + /* Return result */ return r.out.result; } @@ -105,32 +105,32 @@ NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct lsa_QuerySecurity r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sec_info = sec_info; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_QuerySecurity, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYSECURITY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_QuerySecurity, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (sdbuf && r.out.sdbuf) { *sdbuf = *r.out.sdbuf; } - + /* Return result */ return r.out.result; } @@ -139,27 +139,27 @@ NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) { struct lsa_SetSecObj r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetSecObj, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETSECOBJ, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetSecObj, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -168,27 +168,27 @@ NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct lsa_ChangePassword r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_ChangePassword, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CHANGEPASSWORD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_ChangePassword, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -197,31 +197,31 @@ NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct lsa_OpenPolicy r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.attr = attr; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_OpenPolicy, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENPOLICY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ return r.out.result; } @@ -230,32 +230,32 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct lsa_QueryInfoPolicy r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYINFOPOLICY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ return r.out.result; } @@ -264,27 +264,27 @@ NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct lsa_SetInfoPolicy r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETINFOPOLICY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -293,27 +293,27 @@ NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct lsa_ClearAuditLog r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_ClearAuditLog, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CLEARAUDITLOG, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_ClearAuditLog, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -322,31 +322,31 @@ NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct lsa_CreateAccount r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sid = sid; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CreateAccount, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATEACCOUNT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CreateAccount, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *acct_handle = *r.out.acct_handle; - + /* Return result */ return r.out.result; } @@ -355,32 +355,32 @@ NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct lsa_EnumAccounts r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.resume_handle = resume_handle; r.in.num_entries = num_entries; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_EnumAccounts, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMACCOUNTS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_EnumAccounts, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *resume_handle = *r.out.resume_handle; *sids = *r.out.sids; - + /* Return result */ return r.out.result; } @@ -389,31 +389,31 @@ NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_CreateTrustedDomain r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.info = info; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomain, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATETRUSTEDDOMAIN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomain, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *trustdom_handle = *r.out.trustdom_handle; - + /* Return result */ return r.out.result; } @@ -422,32 +422,32 @@ NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct lsa_EnumTrustDom r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.resume_handle = resume_handle; r.in.max_size = max_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_EnumTrustDom, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMTRUSTDOM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_EnumTrustDom, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *resume_handle = *r.out.resume_handle; *domains = *r.out.domains; - + /* Return result */ return r.out.result; } @@ -456,7 +456,7 @@ NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct lsa_LookupNames r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.num_names = num_names; @@ -464,30 +464,30 @@ NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.sids = sids; r.in.level = level; r.in.count = count; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupNames, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupNames, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (domains && r.out.domains) { *domains = *r.out.domains; } *sids = *r.out.sids; *count = *r.out.count; - + /* Return result */ return r.out.result; } @@ -496,37 +496,37 @@ NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct lsa_LookupSids r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sids = sids; r.in.names = names; r.in.level = level; r.in.count = count; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupSids, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPSIDS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupSids, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (domains && r.out.domains) { *domains = *r.out.domains; } *names = *r.out.names; *count = *r.out.count; - + /* Return result */ return r.out.result; } @@ -535,31 +535,31 @@ NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct lsa_CreateSecret r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.name = name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CreateSecret, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATESECRET, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CreateSecret, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *sec_handle = *r.out.sec_handle; - + /* Return result */ return r.out.result; } @@ -568,31 +568,31 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct lsa_OpenAccount r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sid = sid; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_OpenAccount, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENACCOUNT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_OpenAccount, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *acct_handle = *r.out.acct_handle; - + /* Return result */ return r.out.result; } @@ -601,31 +601,31 @@ NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct lsa_EnumPrivsAccount r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_EnumPrivsAccount, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMPRIVSACCOUNT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_EnumPrivsAccount, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (privs && r.out.privs) { *privs = *r.out.privs; } - + /* Return result */ return r.out.result; } @@ -634,29 +634,29 @@ NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli, TALLOC_C { struct lsa_AddPrivilegesToAccount r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.privs = privs; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_AddPrivilegesToAccount, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ADDPRIVILEGESTOACCOUNT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_AddPrivilegesToAccount, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -665,30 +665,30 @@ NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli, TAL { struct lsa_RemovePrivilegesFromAccount r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.remove_all = remove_all; r.in.privs = privs; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_RemovePrivilegesFromAccount, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_RemovePrivilegesFromAccount, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -697,27 +697,27 @@ NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_GetQuotasForAccount r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_GetQuotasForAccount, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_GETQUOTASFORACCOUNT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_GetQuotasForAccount, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -726,27 +726,27 @@ NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_SetQuotasForAccount r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetQuotasForAccount, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETQUOTASFORACCOUNT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetQuotasForAccount, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -755,27 +755,27 @@ NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_C { struct lsa_GetSystemAccessAccount r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_GETSYSTEMACCESSACCOUNT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_GetSystemAccessAccount, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -784,27 +784,27 @@ NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_C { struct lsa_SetSystemAccessAccount r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetSystemAccessAccount, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETSYSTEMACCESSACCOUNT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetSystemAccessAccount, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -813,31 +813,31 @@ NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct lsa_OpenTrustedDomain r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sid = sid; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomain, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENTRUSTEDDOMAIN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomain, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *trustdom_handle = *r.out.trustdom_handle; - + /* Return result */ return r.out.result; } @@ -846,32 +846,32 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_C { struct lsa_QueryTrustedDomainInfo r; NTSTATUS status; - + /* In parameters */ r.in.trustdom_handle = trustdom_handle; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYTRUSTEDDOMAININFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ return r.out.result; } @@ -880,27 +880,27 @@ NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli, TAL { struct lsa_SetInformationTrustedDomain r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetInformationTrustedDomain, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetInformationTrustedDomain, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -909,31 +909,31 @@ NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct lsa_OpenSecret r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.name = name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_OpenSecret, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENSECRET, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_OpenSecret, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *sec_handle = *r.out.sec_handle; - + /* Return result */ return r.out.result; } @@ -942,30 +942,30 @@ NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct lsa_SetSecret r; NTSTATUS status; - + /* In parameters */ r.in.sec_handle = sec_handle; r.in.new_val = new_val; r.in.old_val = old_val; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetSecret, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETSECRET, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetSecret, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -974,30 +974,30 @@ NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct lsa_QuerySecret r; NTSTATUS status; - + /* In parameters */ r.in.sec_handle = sec_handle; r.in.new_val = new_val; r.in.new_mtime = new_mtime; r.in.old_val = old_val; r.in.old_mtime = old_mtime; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_QuerySecret, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYSECRET, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_QuerySecret, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (new_val && r.out.new_val) { *new_val = *r.out.new_val; @@ -1011,7 +1011,7 @@ NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx if (old_mtime && r.out.old_mtime) { *old_mtime = *r.out.old_mtime; } - + /* Return result */ return r.out.result; } @@ -1020,30 +1020,30 @@ NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct lsa_LookupPrivValue r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.name = name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupPrivValue, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPPRIVVALUE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupPrivValue, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *luid = *r.out.luid; - + /* Return result */ return r.out.result; } @@ -1052,32 +1052,32 @@ NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct lsa_LookupPrivName r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.luid = luid; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupPrivName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPPRIVNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupPrivName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (name && r.out.name) { *name = *r.out.name; } - + /* Return result */ return r.out.result; } @@ -1086,35 +1086,35 @@ NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli, TALLOC_CT { struct lsa_LookupPrivDisplayName r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.name = name; r.in.language_id = language_id; r.in.unknown = unknown; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupPrivDisplayName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPPRIVDISPLAYNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupPrivDisplayName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (disp_name && r.out.disp_name) { *disp_name = *r.out.disp_name; } *language_id = *r.out.language_id; - + /* Return result */ return r.out.result; } @@ -1123,27 +1123,27 @@ NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct lsa_DeleteObject r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_DeleteObject, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_DELETEOBJECT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_DeleteObject, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1152,30 +1152,30 @@ NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli, TALLO { struct lsa_EnumAccountsWithUserRight r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.name = name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_EnumAccountsWithUserRight, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_EnumAccountsWithUserRight, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *sids = *r.out.sids; - + /* Return result */ return r.out.result; } @@ -1184,30 +1184,30 @@ NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct lsa_EnumAccountRights r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sid = sid; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_EnumAccountRights, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMACCOUNTRIGHTS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_EnumAccountRights, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *rights = *r.out.rights; - + /* Return result */ return r.out.result; } @@ -1216,30 +1216,30 @@ NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct lsa_AddAccountRights r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sid = sid; r.in.rights = rights; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_AddAccountRights, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ADDACCOUNTRIGHTS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_AddAccountRights, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1248,31 +1248,31 @@ NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_RemoveAccountRights r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sid = sid; r.in.unknown = unknown; r.in.rights = rights; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_RemoveAccountRights, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_REMOVEACCOUNTRIGHTS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_RemoveAccountRights, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1281,33 +1281,33 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli, TAL { struct lsa_QueryTrustedDomainInfoBySid r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.dom_sid = dom_sid; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoBySid, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoBySid, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ return r.out.result; } @@ -1316,27 +1316,27 @@ NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_SetTrustedDomainInfo r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETTRUSTEDDOMAININFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1345,29 +1345,29 @@ NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_DeleteTrustedDomain r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.dom_sid = dom_sid; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_DeleteTrustedDomain, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_DELETETRUSTEDDOMAIN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_DeleteTrustedDomain, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1376,27 +1376,27 @@ NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct lsa_StorePrivateData r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_StorePrivateData, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_STOREPRIVATEDATA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_StorePrivateData, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1405,27 +1405,27 @@ NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_RetrievePrivateData r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_RETRIEVEPRIVATEDATA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_RetrievePrivateData, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1434,31 +1434,31 @@ NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct lsa_OpenPolicy2 r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.attr = attr; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_OpenPolicy2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENPOLICY2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ return r.out.result; } @@ -1467,28 +1467,28 @@ NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct lsa_GetUserName r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.account_name = account_name; r.in.authority_name = authority_name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_GetUserName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_GETUSERNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_GetUserName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (account_name && r.out.account_name) { *account_name = *r.out.account_name; @@ -1496,7 +1496,7 @@ NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx if (authority_name && r.out.authority_name) { *authority_name = *r.out.authority_name; } - + /* Return result */ return r.out.result; } @@ -1505,32 +1505,32 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct lsa_QueryInfoPolicy2 r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYINFOPOLICY2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ return r.out.result; } @@ -1539,27 +1539,27 @@ NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct lsa_SetInfoPolicy2 r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETINFOPOLICY2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1568,33 +1568,33 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TA { struct lsa_QueryTrustedDomainInfoByName r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.trusted_domain = trusted_domain; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoByName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoByName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ return r.out.result; } @@ -1603,31 +1603,31 @@ NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALL { struct lsa_SetTrustedDomainInfoByName r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.trusted_domain = trusted_domain; r.in.level = level; r.in.info = info; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfoByName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETTRUSTEDDOMAININFOBYNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfoByName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1636,32 +1636,32 @@ NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_EnumTrustedDomainsEx r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.resume_handle = resume_handle; r.in.max_size = max_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_EnumTrustedDomainsEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMTRUSTEDDOMAINSEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_EnumTrustedDomainsEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *resume_handle = *r.out.resume_handle; *domains = *r.out.domains; - + /* Return result */ return r.out.result; } @@ -1670,27 +1670,27 @@ NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CT { struct lsa_CreateTrustedDomainEx r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATETRUSTEDDOMAINEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1699,29 +1699,29 @@ NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_CloseTrustedDomainEx r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CloseTrustedDomainEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CLOSETRUSTEDDOMAINEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CloseTrustedDomainEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ return r.out.result; } @@ -1730,32 +1730,32 @@ NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli, TA { struct lsa_QueryDomainInformationPolicy r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_QueryDomainInformationPolicy, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYDOMAININFORMATIONPOLICY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_QueryDomainInformationPolicy, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ return r.out.result; } @@ -1764,30 +1764,30 @@ NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli, TALL { struct lsa_SetDomainInformationPolicy r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.level = level; r.in.info = info; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_SetDomainInformationPolicy, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETDOMAININFORMATIONPOLICY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_SetDomainInformationPolicy, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1796,31 +1796,31 @@ NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli, TALLOC_ { struct lsa_OpenTrustedDomainByName r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.name = name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomainByName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENTRUSTEDDOMAINBYNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomainByName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *trustdom_handle = *r.out.trustdom_handle; - + /* Return result */ return r.out.result; } @@ -1829,27 +1829,27 @@ NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) { struct lsa_TestCall r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_TestCall, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_TESTCALL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_TestCall, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1858,7 +1858,7 @@ NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct lsa_LookupSids2 r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sids = sids; @@ -1867,30 +1867,30 @@ NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.count = count; r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupSids2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPSIDS2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupSids2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (domains && r.out.domains) { *domains = *r.out.domains; } *names = *r.out.names; *count = *r.out.count; - + /* Return result */ return r.out.result; } @@ -1899,7 +1899,7 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct lsa_LookupNames2 r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.num_names = num_names; @@ -1909,30 +1909,30 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.count = count; r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupNames2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupNames2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (domains && r.out.domains) { *domains = *r.out.domains; } *sids = *r.out.sids; *count = *r.out.count; - + /* Return result */ return r.out.result; } @@ -1941,27 +1941,27 @@ NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli, TALLOC_C { struct lsa_CreateTrustedDomainEx2 r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATETRUSTEDDOMAINEX2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1970,27 +1970,27 @@ NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) { struct lsa_CREDRWRITE r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRWRITE, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRWRITE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITE, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -1999,27 +1999,27 @@ NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) { struct lsa_CREDRREAD r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRREAD, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRREAD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRREAD, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2028,27 +2028,27 @@ NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct lsa_CREDRENUMERATE r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRENUMERATE, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRENUMERATE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRENUMERATE, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2057,27 +2057,27 @@ NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TAL { struct lsa_CREDRWRITEDOMAINCREDENTIALS r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRWRITEDOMAINCREDENTIALS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2086,27 +2086,27 @@ NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALL { struct lsa_CREDRREADDOMAINCREDENTIALS r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRREADDOMAINCREDENTIALS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2115,27 +2115,27 @@ NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct lsa_CREDRDELETE r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRDELETE, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRDELETE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRDELETE, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2144,27 +2144,27 @@ NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli, TALLOC_CTX * { struct lsa_CREDRGETTARGETINFO r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRGETTARGETINFO, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRGETTARGETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRGETTARGETINFO, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2173,27 +2173,27 @@ NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli, TALLOC_CTX * { struct lsa_CREDRPROFILELOADED r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRPROFILELOADED, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRPROFILELOADED, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRPROFILELOADED, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2202,7 +2202,7 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct lsa_LookupNames3 r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.num_names = num_names; @@ -2212,30 +2212,30 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.count = count; r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupNames3, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES3, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupNames3, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (domains && r.out.domains) { *domains = *r.out.domains; } *sids = *r.out.sids; *count = *r.out.count; - + /* Return result */ return r.out.result; } @@ -2244,27 +2244,27 @@ NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli, TALLOC_CTX { struct lsa_CREDRGETSESSIONTYPES r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRGETSESSIONTYPES, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRGETSESSIONTYPES, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRGETSESSIONTYPES, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2273,27 +2273,27 @@ NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_C { struct lsa_LSARREGISTERAUDITEVENT r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LSARREGISTERAUDITEVENT, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARREGISTERAUDITEVENT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LSARREGISTERAUDITEVENT, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2302,27 +2302,27 @@ NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct lsa_LSARGENAUDITEVENT r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LSARGENAUDITEVENT, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARGENAUDITEVENT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LSARGENAUDITEVENT, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2331,27 +2331,27 @@ NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC { struct lsa_LSARUNREGISTERAUDITEVENT r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARUNREGISTERAUDITEVENT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2360,27 +2360,27 @@ NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, { struct lsa_LSARQUERYFORESTTRUSTINFORMATION r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2389,27 +2389,27 @@ NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, T { struct lsa_LSARSETFORESTTRUSTINFORMATION r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARSETFORESTTRUSTINFORMATION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2418,27 +2418,27 @@ NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct lsa_CREDRRENAME r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_CREDRRENAME, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRRENAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_CREDRRENAME, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2447,7 +2447,7 @@ NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct lsa_LookupSids3 r; NTSTATUS status; - + /* In parameters */ r.in.sids = sids; r.in.names = names; @@ -2455,30 +2455,30 @@ NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.count = count; r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupSids3, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPSIDS3, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupSids3, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (domains && r.out.domains) { *domains = *r.out.domains; } *names = *r.out.names; *count = *r.out.count; - + /* Return result */ return r.out.result; } @@ -2487,7 +2487,7 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct lsa_LookupNames4 r; NTSTATUS status; - + /* In parameters */ r.in.num_names = num_names; r.in.names = names; @@ -2496,30 +2496,30 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.count = count; r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LookupNames4, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES4, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LookupNames4, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (domains && r.out.domains) { *domains = *r.out.domains; } *sids = *r.out.sids; *count = *r.out.count; - + /* Return result */ return r.out.result; } @@ -2528,27 +2528,27 @@ NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct lsa_LSAROPENPOLICYSCE r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LSAROPENPOLICYSCE, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSAROPENPOLICYSCE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LSAROPENPOLICYSCE, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2557,27 +2557,27 @@ NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *c { struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2586,27 +2586,27 @@ NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client { struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } @@ -2615,27 +2615,27 @@ NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli, TALL { struct lsa_LSARADTREPORTSECURITYEVENT r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARADTREPORTSECURITYEVENT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ return r.out.result; } diff --git a/source3/librpc/gen_ndr/cli_netlogon.c b/source3/librpc/gen_ndr/cli_netlogon.c index e53254efa5..addf9f80d1 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.c +++ b/source3/librpc/gen_ndr/cli_netlogon.c @@ -10,38 +10,38 @@ NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct netr_LogonUasLogon r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.account_name = account_name; r.in.workstation = workstation; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonUasLogon, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONUASLOGON, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -49,36 +49,36 @@ NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct netr_LogonUasLogoff r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.account_name = account_name; r.in.workstation = workstation; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonUasLogoff, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONUASLOGOFF, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -86,7 +86,7 @@ NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct netr_LogonSamLogon r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.computer_name = computer_name; @@ -95,30 +95,30 @@ NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.logon_level = logon_level; r.in.logon = logon; r.in.validation_level = validation_level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonSamLogon, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGON, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (return_authenticator && r.out.return_authenticator) { *return_authenticator = *r.out.return_authenticator; } *validation = *r.out.validation; *authoritative = *r.out.authoritative; - + /* Return result */ return r.out.result; } @@ -127,7 +127,7 @@ NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct netr_LogonSamLogoff r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.computer_name = computer_name; @@ -135,28 +135,28 @@ NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.return_authenticator = return_authenticator; r.in.logon_level = logon_level; r.in.logon = logon; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonSamLogoff, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGOFF, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (return_authenticator && r.out.return_authenticator) { *return_authenticator = *r.out.return_authenticator; } - + /* Return result */ return r.out.result; } @@ -165,31 +165,31 @@ NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli, TALLOC_CTX { struct netr_ServerReqChallenge r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.computer_name = computer_name; r.in.credentials = credentials; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_ServerReqChallenge, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERREQCHALLENGE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_ServerReqChallenge, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *credentials = *r.out.credentials; - + /* Return result */ return r.out.result; } @@ -198,33 +198,33 @@ NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli, TALLOC_CTX { struct netr_ServerAuthenticate r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.account_name = account_name; r.in.secure_channel_type = secure_channel_type; r.in.computer_name = computer_name; r.in.credentials = credentials; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERAUTHENTICATE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *credentials = *r.out.credentials; - + /* Return result */ return r.out.result; } @@ -233,7 +233,7 @@ NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, TALLOC_CTX * { struct netr_ServerPasswordSet r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.account_name = account_name; @@ -241,26 +241,26 @@ NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.computer_name = computer_name; r.in.credential = credential; r.in.new_password = new_password; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERPASSWORDSET, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *return_authenticator = *r.out.return_authenticator; - + /* Return result */ return r.out.result; } @@ -269,7 +269,7 @@ NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct netr_DatabaseDeltas r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.computername = computername; @@ -278,30 +278,30 @@ NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.database_id = database_id; r.in.sequence_num = sequence_num; r.in.preferredmaximumlength = preferredmaximumlength; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DatabaseDeltas, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASEDELTAS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *return_authenticator = *r.out.return_authenticator; *sequence_num = *r.out.sequence_num; if (delta_enum_array && r.out.delta_enum_array) { *delta_enum_array = *r.out.delta_enum_array; } - + /* Return result */ return r.out.result; } @@ -310,7 +310,7 @@ NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct netr_DatabaseSync r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.computername = computername; @@ -319,30 +319,30 @@ NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.database_id = database_id; r.in.sync_context = sync_context; r.in.preferredmaximumlength = preferredmaximumlength; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DatabaseSync, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASESYNC, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *return_authenticator = *r.out.return_authenticator; *sync_context = *r.out.sync_context; if (delta_enum_array && r.out.delta_enum_array) { *delta_enum_array = *r.out.delta_enum_array; } - + /* Return result */ return r.out.result; } @@ -351,7 +351,7 @@ NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct netr_AccountDeltas r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.computername = computername; @@ -361,30 +361,30 @@ NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.count = count; r.in.level = level; r.in.buffersize = buffersize; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_AccountDeltas, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_ACCOUNTDELTAS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *return_authenticator = *r.out.return_authenticator; *buffer = *r.out.buffer; *count_returned = *r.out.count_returned; *total_entries = *r.out.total_entries; *recordid = *r.out.recordid; - + /* Return result */ return r.out.result; } @@ -393,7 +393,7 @@ NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct netr_AccountSync r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.computername = computername; @@ -403,23 +403,23 @@ NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.level = level; r.in.buffersize = buffersize; r.in.recordid = recordid; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_AccountSync, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_ACCOUNTSYNC, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_AccountSync, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *return_authenticator = *r.out.return_authenticator; *buffer = *r.out.buffer; @@ -427,7 +427,7 @@ NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct *total_entries = *r.out.total_entries; *next_reference = *r.out.next_reference; *recordid = *r.out.recordid; - + /* Return result */ return r.out.result; } @@ -436,30 +436,30 @@ NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct netr_GetDcName r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.domainname = domainname; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_GetDcName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_GETDCNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_GetDcName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *dcname = *r.out.dcname; - + /* Return result */ return r.out.result; } @@ -468,36 +468,36 @@ NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct netr_LogonControl r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.function_code = function_code; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonControl, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONCONTROL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonControl, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -505,35 +505,35 @@ NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct netr_GetAnyDCName r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.domainname = domainname; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_GetAnyDCName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_GETANYDCNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *dcname = *r.out.dcname; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -541,37 +541,37 @@ NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct netr_LogonControl2 r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.function_code = function_code; r.in.level = level; r.in.data = data; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonControl2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONCONTROL2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonControl2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *query = *r.out.query; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -579,7 +579,7 @@ NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, TALLOC_CTX { struct netr_ServerAuthenticate2 r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.account_name = account_name; @@ -587,27 +587,27 @@ NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, TALLOC_CTX r.in.computer_name = computer_name; r.in.credentials = credentials; r.in.negotiate_flags = negotiate_flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERAUTHENTICATE2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *credentials = *r.out.credentials; *negotiate_flags = *r.out.negotiate_flags; - + /* Return result */ return r.out.result; } @@ -616,7 +616,7 @@ NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct netr_DatabaseSync2 r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.computername = computername; @@ -626,30 +626,30 @@ NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.restart_state = restart_state; r.in.sync_context = sync_context; r.in.preferredmaximumlength = preferredmaximumlength; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DatabaseSync2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASESYNC2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *return_authenticator = *r.out.return_authenticator; *sync_context = *r.out.sync_context; if (delta_enum_array && r.out.delta_enum_array) { *delta_enum_array = *r.out.delta_enum_array; } - + /* Return result */ return r.out.result; } @@ -658,7 +658,7 @@ NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct netr_DatabaseRedo r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.computername = computername; @@ -666,29 +666,29 @@ NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.return_authenticator = return_authenticator; r.in.change_log_entry = change_log_entry; r.in.change_log_entry_size = change_log_entry_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DatabaseRedo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASEREDO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *return_authenticator = *r.out.return_authenticator; if (delta_enum_array && r.out.delta_enum_array) { *delta_enum_array = *r.out.delta_enum_array; } - + /* Return result */ return r.out.result; } @@ -697,37 +697,37 @@ NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct netr_LogonControl2Ex r; NTSTATUS status; - + /* In parameters */ r.in.logon_server = logon_server; r.in.function_code = function_code; r.in.level = level; r.in.data = data; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonControl2Ex, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONCONTROL2EX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *query = *r.out.query; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -735,32 +735,32 @@ NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, TA { struct netr_NETRENUMERATETRUSTEDDOMAINS r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -768,40 +768,40 @@ NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct netr_DsRGetDCName r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.domain_name = domain_name; r.in.domain_guid = domain_guid; r.in.site_guid = site_guid; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DsRGetDCName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -809,32 +809,32 @@ NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, TALLOC_ { struct netr_NETRLOGONDUMMYROUTINE1 r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRLOGONDUMMYROUTINE1, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONDUMMYROUTINE1, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRLOGONDUMMYROUTINE1, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -842,32 +842,32 @@ NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, TALLOC { struct netr_NETRLOGONSETSERVICEBITS r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONSETSERVICEBITS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -875,32 +875,32 @@ NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, TALLOC_CT { struct netr_NETRLOGONGETTRUSTRID r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONGETTRUSTRID, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -908,32 +908,32 @@ NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, T { struct netr_NETRLOGONCOMPUTESERVERDIGEST r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -941,32 +941,32 @@ NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli, T { struct netr_NETRLOGONCOMPUTECLIENTDIGEST r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -974,7 +974,7 @@ NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, TALLOC_CTX { struct netr_ServerAuthenticate3 r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.account_name = account_name; @@ -982,28 +982,28 @@ NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, TALLOC_CTX r.in.computer_name = computer_name; r.in.credentials = credentials; r.in.negotiate_flags = negotiate_flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERAUTHENTICATE3, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *credentials = *r.out.credentials; *negotiate_flags = *r.out.negotiate_flags; *rid = *r.out.rid; - + /* Return result */ return r.out.result; } @@ -1012,40 +1012,40 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct netr_DsRGetDCNameEx r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.domain_name = domain_name; r.in.domain_guid = domain_guid; r.in.site_name = site_name; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCNAMEEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1053,34 +1053,34 @@ NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct netr_DsRGetSiteName r; NTSTATUS status; - + /* In parameters */ r.in.computer_name = computer_name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETSITENAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *site = *r.out.site; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1088,7 +1088,7 @@ NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX { struct netr_LogonGetDomainInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.computer_name = computer_name; @@ -1096,27 +1096,27 @@ NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX r.in.return_authenticator = return_authenticator; r.in.level = level; r.in.query = query; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONGETDOMAININFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *return_authenticator = *r.out.return_authenticator; *info = *r.out.info; - + /* Return result */ return r.out.result; } @@ -1125,7 +1125,7 @@ NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, TALLOC_CTX { struct netr_ServerPasswordSet2 r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.account_name = account_name; @@ -1133,26 +1133,26 @@ NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, TALLOC_CTX r.in.computer_name = computer_name; r.in.credential = credential; r.in.new_password = new_password; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERPASSWORDSET2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *return_authenticator = *r.out.return_authenticator; - + /* Return result */ return r.out.result; } @@ -1161,32 +1161,32 @@ NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, TALLOC_C { struct netr_NETRSERVERPASSWORDGET r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRSERVERPASSWORDGET, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRSERVERPASSWORDGET, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRSERVERPASSWORDGET, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1194,32 +1194,32 @@ NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, TALLOC_CTX { struct netr_NETRLOGONSENDTOSAM r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONSENDTOSAM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1227,32 +1227,32 @@ NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, TALLOC_ { struct netr_DSRADDRESSTOSITENAMESW r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRADDRESSTOSITENAMESW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1260,7 +1260,7 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct netr_DsRGetDCNameEx2 r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.client_account = client_account; @@ -1269,33 +1269,33 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.domain_guid = domain_guid; r.in.site_name = site_name; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCNAMEEX2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1303,32 +1303,32 @@ NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client { struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1336,32 +1336,32 @@ NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, { struct netr_NETRENUMERATETRUSTEDDOMAINSEX r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1369,32 +1369,32 @@ NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, TALLO { struct netr_DSRADDRESSTOSITENAMESEXW r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRADDRESSTOSITENAMESEXW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1402,32 +1402,32 @@ NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, TALLOC_C { struct netr_DSRGETDCSITECOVERAGEW r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DSRGETDCSITECOVERAGEW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCSITECOVERAGEW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DSRGETDCSITECOVERAGEW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1435,7 +1435,7 @@ NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct netr_LogonSamLogonEx r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.computer_name = computer_name; @@ -1443,28 +1443,28 @@ NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.logon = logon; r.in.validation_level = validation_level; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGONEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *validation = *r.out.validation; *authoritative = *r.out.authoritative; *flags = *r.out.flags; - + /* Return result */ return r.out.result; } @@ -1473,36 +1473,36 @@ NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLO { struct netr_DsrEnumerateDomainTrusts r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.trust_flags = trust_flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRENUMERATEDOMAINTRUSTS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *count = *r.out.count; memcpy(trusts, r.out.trusts, count); - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1510,32 +1510,32 @@ NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, TA { struct netr_DSRDEREGISTERDNSHOSTRECORDS r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1543,32 +1543,32 @@ NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, TA { struct netr_NETRSERVERTRUSTPASSWORDSGET r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRSERVERTRUSTPASSWORDSGET, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1576,32 +1576,32 @@ NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, T { struct netr_DSRGETFORESTTRUSTINFORMATION r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETFORESTTRUSTINFORMATION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1609,32 +1609,32 @@ NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, { struct netr_NETRGETFORESTTRUSTINFORMATION r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRGETFORESTTRUSTINFORMATION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1642,7 +1642,7 @@ NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_ { struct netr_LogonSamLogonWithFlags r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.computer_name = computer_name; @@ -1652,23 +1652,23 @@ NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_ r.in.logon = logon; r.in.validation_level = validation_level; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGONWITHFLAGS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (return_authenticator && r.out.return_authenticator) { *return_authenticator = *r.out.return_authenticator; @@ -1676,7 +1676,7 @@ NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_ *validation = *r.out.validation; *authoritative = *r.out.authoritative; *flags = *r.out.flags; - + /* Return result */ return r.out.result; } @@ -1685,32 +1685,32 @@ NTSTATUS rpccli_netr_NETRSERVERGETTRUSTINFO(struct rpc_pipe_client *cli, TALLOC_ { struct netr_NETRSERVERGETTRUSTINFO r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(netr_NETRSERVERGETTRUSTINFO, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRSERVERGETTRUSTINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(netr_NETRSERVERGETTRUSTINFO, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } diff --git a/source3/librpc/gen_ndr/cli_srvsvc.c b/source3/librpc/gen_ndr/cli_srvsvc.c index b7f1521dd3..9353390e96 100644 --- a/source3/librpc/gen_ndr/cli_srvsvc.c +++ b/source3/librpc/gen_ndr/cli_srvsvc.c @@ -10,30 +10,30 @@ NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct srvsvc_NetCharDevEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; r.in.ctr = ctr; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *level = *r.out.level; *ctr = *r.out.ctr; @@ -41,12 +41,12 @@ NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *m if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -54,36 +54,36 @@ NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NetCharDevGetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.device_name = device_name; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevGetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVGETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevGetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -91,35 +91,35 @@ NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NetCharDevControl r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.device_name = device_name; r.in.opcode = opcode; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevControl, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVCONTROL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevControl, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -127,7 +127,7 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX * { struct srvsvc_NetCharDevQEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.user = user; @@ -135,23 +135,23 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.ctr = ctr; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *level = *r.out.level; *ctr = *r.out.ctr; @@ -159,12 +159,12 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX * if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -172,37 +172,37 @@ NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli, TALLOC_CT { struct srvsvc_NetCharDevQGetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.queue_name = queue_name; r.in.user = user; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQGetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQGETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQGetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -210,40 +210,40 @@ NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli, TALLOC_CT { struct srvsvc_NetCharDevQSetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.queue_name = queue_name; r.in.level = level; r.in.info = info; r.in.parm_error = parm_error; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQSetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQSETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQSetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (parm_error && r.out.parm_error) { *parm_error = *r.out.parm_error; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -251,34 +251,34 @@ NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NetCharDevQPurge r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.queue_name = queue_name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurge, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQPURGE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurge, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -286,35 +286,35 @@ NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli, TALLOC_ { struct srvsvc_NetCharDevQPurgeSelf r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.queue_name = queue_name; r.in.computer_name = computer_name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurgeSelf, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQPURGESELF, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurgeSelf, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -322,7 +322,7 @@ NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct srvsvc_NetConnEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.path = path; @@ -330,23 +330,23 @@ NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.ctr = ctr; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetConnEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCONNENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetConnEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *level = *r.out.level; *ctr = *r.out.ctr; @@ -354,12 +354,12 @@ NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -367,7 +367,7 @@ NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct srvsvc_NetFileEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.path = path; @@ -376,23 +376,23 @@ NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.ctr = ctr; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetFileEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETFILEENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetFileEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *level = *r.out.level; *ctr = *r.out.ctr; @@ -400,12 +400,12 @@ NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -413,36 +413,36 @@ NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct srvsvc_NetFileGetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.fid = fid; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetFileGetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETFILEGETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetFileGetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -450,34 +450,34 @@ NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct srvsvc_NetFileClose r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.fid = fid; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetFileClose, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETFILECLOSE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetFileClose, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -485,7 +485,7 @@ NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct srvsvc_NetSessEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.client = client; @@ -494,23 +494,23 @@ NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.ctr = ctr; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetSessEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSESSENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetSessEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *level = *r.out.level; *ctr = *r.out.ctr; @@ -518,12 +518,12 @@ NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -531,35 +531,35 @@ NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct srvsvc_NetSessDel r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.client = client; r.in.user = user; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetSessDel, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSESSDEL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetSessDel, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -567,39 +567,39 @@ NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct srvsvc_NetShareAdd r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; r.in.info = info; r.in.parm_error = parm_error; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareAdd, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREADD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareAdd, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (parm_error && r.out.parm_error) { *parm_error = *r.out.parm_error; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -607,30 +607,30 @@ NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, TALLOC_CTX * { struct srvsvc_NetShareEnumAll r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; r.in.ctr = ctr; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnumAll, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREENUMALL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnumAll, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *level = *r.out.level; *ctr = *r.out.ctr; @@ -638,12 +638,12 @@ NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, TALLOC_CTX * if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -651,36 +651,36 @@ NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * { struct srvsvc_NetShareGetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.share_name = share_name; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareGetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREGETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareGetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -688,40 +688,40 @@ NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * { struct srvsvc_NetShareSetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.share_name = share_name; r.in.level = level; r.in.info = info; r.in.parm_error = parm_error; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareSetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHARESETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareSetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (parm_error && r.out.parm_error) { *parm_error = *r.out.parm_error; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -729,35 +729,35 @@ NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct srvsvc_NetShareDel r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.share_name = share_name; r.in.reserved = reserved; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareDel, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDEL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDel, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -765,35 +765,35 @@ NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NetShareDelSticky r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.share_name = share_name; r.in.reserved = reserved; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelSticky, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDELSTICKY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelSticky, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -801,35 +801,35 @@ NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct srvsvc_NetShareCheck r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.device_name = device_name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareCheck, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHARECHECK, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareCheck, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *type = *r.out.type; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -837,35 +837,35 @@ NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct srvsvc_NetSrvGetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetSrvGetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSRVGETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvGetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -873,39 +873,39 @@ NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct srvsvc_NetSrvSetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; r.in.info = info; r.in.parm_error = parm_error; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetSrvSetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSRVSETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvSetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (parm_error && r.out.parm_error) { *parm_error = *r.out.parm_error; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -913,42 +913,42 @@ NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct srvsvc_NetDiskEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; r.in.info = info; r.in.maxlen = maxlen; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetDiskEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETDISKENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetDiskEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; *totalentries = *r.out.totalentries; if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -956,37 +956,37 @@ NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, TALLO { struct srvsvc_NetServerStatisticsGet r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.service = service; r.in.level = level; r.in.options = options; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetServerStatisticsGet, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSERVERSTATISTICSGET, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetServerStatisticsGet, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *stats = *r.out.stats; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -994,35 +994,35 @@ NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX * { struct srvsvc_NetTransportAdd r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; r.in.info = info; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetTransportAdd, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETTRANSPORTADD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportAdd, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1030,30 +1030,30 @@ NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NetTransportEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; r.in.transports = transports; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetTransportEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETTRANSPORTENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *level = *r.out.level; *transports = *r.out.transports; @@ -1061,12 +1061,12 @@ NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1074,35 +1074,35 @@ NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX * { struct srvsvc_NetTransportDel r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.unknown = unknown; r.in.transport = transport; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetTransportDel, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETTRANSPORTDEL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportDel, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1110,36 +1110,36 @@ NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct srvsvc_NetRemoteTOD r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetRemoteTOD, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETREMOTETOD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetRemoteTOD, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (info && r.out.info) { *info = *r.out.info; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1147,36 +1147,36 @@ NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NetSetServiceBits r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.transport = transport; r.in.servicebits = servicebits; r.in.updateimmediately = updateimmediately; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetSetServiceBits, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSETSERVICEBITS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetSetServiceBits, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1184,36 +1184,36 @@ NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct srvsvc_NetPathType r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.path = path; r.in.pathflags = pathflags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetPathType, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPATHTYPE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetPathType, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *pathtype = *r.out.pathtype; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1221,7 +1221,7 @@ NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, TALLOC_C { struct srvsvc_NetPathCanonicalize r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.path = path; @@ -1229,32 +1229,32 @@ NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, TALLOC_C r.in.prefix = prefix; r.in.pathtype = pathtype; r.in.pathflags = pathflags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetPathCanonicalize, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPATHCANONICALIZE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCanonicalize, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(can_path, r.out.can_path, r.in.maxbuf); *pathtype = *r.out.pathtype; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1262,37 +1262,37 @@ NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct srvsvc_NetPathCompare r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.path1 = path1; r.in.path2 = path2; r.in.pathtype = pathtype; r.in.pathflags = pathflags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetPathCompare, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPATHCOMPARE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCompare, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1300,36 +1300,36 @@ NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli, TALLOC_CTX * { struct srvsvc_NetNameValidate r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.name = name; r.in.name_type = name_type; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetNameValidate, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETNAMEVALIDATE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetNameValidate, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1337,32 +1337,32 @@ NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli, TALLO { struct srvsvc_NETRPRNAMECANONICALIZE r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRPRNAMECANONICALIZE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1370,37 +1370,37 @@ NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NetPRNameCompare r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.name1 = name1; r.in.name2 = name2; r.in.name_type = name_type; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetPRNameCompare, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPRNAMECOMPARE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetPRNameCompare, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1408,30 +1408,30 @@ NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct srvsvc_NetShareEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; r.in.ctr = ctr; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *level = *r.out.level; *ctr = *r.out.ctr; @@ -1439,12 +1439,12 @@ NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1452,38 +1452,38 @@ NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NetShareDelStart r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.share = share; r.in.reserved = reserved; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelStart, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDELSTART, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelStart, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (hnd && r.out.hnd) { *hnd = *r.out.hnd; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1491,36 +1491,36 @@ NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NetShareDelCommit r; NTSTATUS status; - + /* In parameters */ r.in.hnd = hnd; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelCommit, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDELCOMMIT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelCommit, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (hnd && r.out.hnd) { *hnd = *r.out.hnd; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1528,39 +1528,39 @@ NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CT { struct srvsvc_NetGetFileSecurity r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.share = share; r.in.file = file; r.in.securityinformation = securityinformation; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetGetFileSecurity, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETGETFILESECURITY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetGetFileSecurity, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (sd_buf && r.out.sd_buf) { *sd_buf = *r.out.sd_buf; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1568,37 +1568,37 @@ NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CT { struct srvsvc_NetSetFileSecurity r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.share = share; r.in.file = file; r.in.securityinformation = securityinformation; r.in.sd_buf = sd_buf; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetSetFileSecurity, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSETFILESECURITY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetSetFileSecurity, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1606,35 +1606,35 @@ NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli, TALL { struct srvsvc_NetServerTransportAddEx r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.level = level; r.in.info = info; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetServerTransportAddEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSERVERTRANSPORTADDEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetServerTransportAddEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1642,7 +1642,7 @@ NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, TA { struct srvsvc_NetServerSetServiceBitsEx r; NTSTATUS status; - + /* In parameters */ r.in.server_unc = server_unc; r.in.emulated_server_unc = emulated_server_unc; @@ -1650,30 +1650,30 @@ NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, TA r.in.servicebitsofinterest = servicebitsofinterest; r.in.servicebits = servicebits; r.in.updateimmediately = updateimmediately; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NetServerSetServiceBitsEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSERVERSETSERVICEBITSEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NetServerSetServiceBitsEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1681,32 +1681,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli, TALLOC_CTX { struct srvsvc_NETRDFSGETVERSION r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSGETVERSION, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSGETVERSION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSGETVERSION, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1714,32 +1714,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli, { struct srvsvc_NETRDFSCREATELOCALPARTITION r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSCREATELOCALPARTITION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1747,32 +1747,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli, { struct srvsvc_NETRDFSDELETELOCALPARTITION r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSDELETELOCALPARTITION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1780,32 +1780,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli, T { struct srvsvc_NETRDFSSETLOCALVOLUMESTATE r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSSETLOCALVOLUMESTATE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1813,32 +1813,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli, TALLOC_ { struct srvsvc_NETRDFSSETSERVERINFO r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETSERVERINFO, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSSETSERVERINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETSERVERINFO, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1846,32 +1846,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli, TALLO { struct srvsvc_NETRDFSCREATEEXITPOINT r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSCREATEEXITPOINT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1879,32 +1879,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli, TALLO { struct srvsvc_NETRDFSDELETEEXITPOINT r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSDELETEEXITPOINT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1912,32 +1912,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli, TALLOC_C { struct srvsvc_NETRDFSMODIFYPREFIX r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSMODIFYPREFIX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1945,32 +1945,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli, TALLOC { struct srvsvc_NETRDFSFIXLOCALVOLUME r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSFIXLOCALVOLUME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1978,32 +1978,32 @@ NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli, { struct srvsvc_NETRDFSMANAGERREPORTSITEINFO r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSMANAGERREPORTSITEINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -2011,32 +2011,32 @@ NTSTATUS rpccli_srvsvc_NETRSERVERTRANSPORTDELEX(struct rpc_pipe_client *cli, TAL { struct srvsvc_NETRSERVERTRANSPORTDELEX r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRSERVERTRANSPORTDELEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } diff --git a/source3/librpc/gen_ndr/cli_svcctl.c b/source3/librpc/gen_ndr/cli_svcctl.c index 8010d20919..3266e0c3c5 100644 --- a/source3/librpc/gen_ndr/cli_svcctl.c +++ b/source3/librpc/gen_ndr/cli_svcctl.c @@ -10,34 +10,34 @@ NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli, TALLOC_CT { struct svcctl_CloseServiceHandle r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CLOSESERVICEHANDLE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -45,35 +45,35 @@ NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct svcctl_ControlService r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.control = control; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_ControlService, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CONTROLSERVICE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_ControlService, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *service_status = *r.out.service_status; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -81,33 +81,33 @@ NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct svcctl_DeleteService r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_DeleteService, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_DELETESERVICE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -115,34 +115,34 @@ NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_C { struct svcctl_LockServiceDatabase r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_LOCKSERVICEDATABASE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *lock = *r.out.lock; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -150,32 +150,32 @@ NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli, T { struct svcctl_QueryServiceObjectSecurity r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -183,32 +183,32 @@ NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli, TAL { struct svcctl_SetServiceObjectSecurity r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SETSERVICEOBJECTSECURITY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -216,34 +216,34 @@ NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli, TALLOC_CT { struct svcctl_QueryServiceStatus r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICESTATUS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *service_status = *r.out.service_status; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -251,32 +251,32 @@ NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX { struct svcctl_SetServiceStatus r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SETSERVICESTATUS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -284,34 +284,34 @@ NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli, TALLOC { struct svcctl_UnlockServiceDatabase r; NTSTATUS status; - + /* In parameters */ r.in.lock = lock; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_UNLOCKSERVICEDATABASE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *lock = *r.out.lock; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -319,32 +319,32 @@ NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli, TALLO { struct svcctl_NotifyBootConfigStatus r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -352,36 +352,36 @@ NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli, TALLOC_CTX { struct svcctl_SCSetServiceBitsW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.bits = bits; r.in.bitson = bitson; r.in.immediate = immediate; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SCSETSERVICEBITSW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -389,7 +389,7 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, TALLOC_ { struct svcctl_ChangeServiceConfigW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.type = type; @@ -401,31 +401,31 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, TALLOC_ r.in.service_start_name = service_start_name; r.in.password = password; r.in.display_name = display_name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIGW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *tag_id = *r.out.tag_id; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -433,7 +433,7 @@ NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct svcctl_CreateServiceW r; NTSTATUS status; - + /* In parameters */ r.in.scmanager_handle = scmanager_handle; r.in.ServiceName = ServiceName; @@ -450,34 +450,34 @@ NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.service_start_name = service_start_name; r.in.password = password; r.in.password_size = password_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CREATESERVICEW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (TagId && r.out.TagId) { *TagId = *r.out.TagId; } *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -485,40 +485,40 @@ NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli, TALLO { struct svcctl_EnumDependentServicesW r; NTSTATUS status; - + /* In parameters */ r.in.service = service; r.in.state = state; r.in.buf_size = buf_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMDEPENDENTSERVICESW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (service_status && r.out.service_status) { *service_status = *r.out.service_status; } *bytes_needed = *r.out.bytes_needed; *services_returned = *r.out.services_returned; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -526,30 +526,30 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, TALLOC_C { struct svcctl_EnumServicesStatusW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.type = type; r.in.state = state; r.in.buf_size = buf_size; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMSERVICESSTATUSW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(service, r.out.service, r.in.buf_size); *bytes_needed = *r.out.bytes_needed; @@ -557,12 +557,12 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, TALLOC_C if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -570,36 +570,36 @@ NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct svcctl_OpenSCManagerW r; NTSTATUS status; - + /* In parameters */ r.in.MachineName = MachineName; r.in.DatabaseName = DatabaseName; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSCMANAGERW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -607,36 +607,36 @@ NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct svcctl_OpenServiceW r; NTSTATUS status; - + /* In parameters */ r.in.scmanager_handle = scmanager_handle; r.in.ServiceName = ServiceName; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSERVICEW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -644,36 +644,36 @@ NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli, TALLOC_C { struct svcctl_QueryServiceConfigW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.buf_size = buf_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIGW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(query, r.out.query, r.in.buf_size); *bytes_needed = *r.out.bytes_needed; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -681,36 +681,36 @@ NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli, TALL { struct svcctl_QueryServiceLockStatusW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.buf_size = buf_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICELOCKSTATUSW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *lock_status = *r.out.lock_status; *required_buf_size = *r.out.required_buf_size; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -718,35 +718,35 @@ NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct svcctl_StartServiceW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.NumArgs = NumArgs; r.in.Arguments = Arguments; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_STARTSERVICEW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -754,39 +754,39 @@ NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli, TALLO { struct svcctl_GetServiceDisplayNameW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.service_name = service_name; r.in.display_name_length = display_name_length; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEDISPLAYNAMEW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *display_name = *r.out.display_name; if (display_name_length && r.out.display_name_length) { *display_name_length = *r.out.display_name_length; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -794,39 +794,39 @@ NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli, TALLOC_CT { struct svcctl_GetServiceKeyNameW r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.service_name = service_name; r.in.display_name_length = display_name_length; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEKEYNAMEW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *key_name = *r.out.key_name; if (display_name_length && r.out.display_name_length) { *display_name_length = *r.out.display_name_length; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -834,36 +834,36 @@ NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli, TALLOC_CTX { struct svcctl_SCSetServiceBitsA r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.bits = bits; r.in.bitson = bitson; r.in.immediate = immediate; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SCSETSERVICEBITSA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -871,7 +871,7 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, TALLOC_ { struct svcctl_ChangeServiceConfigA r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.type = type; @@ -883,31 +883,31 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, TALLOC_ r.in.service_start_name = service_start_name; r.in.password = password; r.in.display_name = display_name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIGA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *tag_id = *r.out.tag_id; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -915,7 +915,7 @@ NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct svcctl_CreateServiceA r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.ServiceName = ServiceName; @@ -929,33 +929,33 @@ NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.dependencies = dependencies; r.in.service_start_name = service_start_name; r.in.password = password; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CREATESERVICEA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (TagId && r.out.TagId) { *TagId = *r.out.TagId; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -963,40 +963,40 @@ NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli, TALLO { struct svcctl_EnumDependentServicesA r; NTSTATUS status; - + /* In parameters */ r.in.service = service; r.in.state = state; r.in.buf_size = buf_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMDEPENDENTSERVICESA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (service_status && r.out.service_status) { *service_status = *r.out.service_status; } *bytes_needed = *r.out.bytes_needed; *services_returned = *r.out.services_returned; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1004,30 +1004,30 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, TALLOC_C { struct svcctl_EnumServicesStatusA r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.type = type; r.in.state = state; r.in.buf_size = buf_size; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMSERVICESSTATUSA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(service, r.out.service, r.in.buf_size); *bytes_needed = *r.out.bytes_needed; @@ -1035,12 +1035,12 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, TALLOC_C if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1048,36 +1048,36 @@ NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct svcctl_OpenSCManagerA r; NTSTATUS status; - + /* In parameters */ r.in.MachineName = MachineName; r.in.DatabaseName = DatabaseName; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSCMANAGERA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1085,35 +1085,35 @@ NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct svcctl_OpenServiceA r; NTSTATUS status; - + /* In parameters */ r.in.scmanager_handle = scmanager_handle; r.in.ServiceName = ServiceName; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSERVICEA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1121,36 +1121,36 @@ NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli, TALLOC_C { struct svcctl_QueryServiceConfigA r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.buf_size = buf_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIGA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(query, r.out.query, r.in.buf_size); *bytes_needed = *r.out.bytes_needed; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1158,36 +1158,36 @@ NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli, TALL { struct svcctl_QueryServiceLockStatusA r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.buf_size = buf_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICELOCKSTATUSA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *lock_status = *r.out.lock_status; *required_buf_size = *r.out.required_buf_size; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1195,35 +1195,35 @@ NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *me { struct svcctl_StartServiceA r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.NumArgs = NumArgs; r.in.Arguments = Arguments; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_STARTSERVICEA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1231,39 +1231,39 @@ NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli, TALLO { struct svcctl_GetServiceDisplayNameA r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.service_name = service_name; r.in.display_name_length = display_name_length; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEDISPLAYNAMEA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *display_name = *r.out.display_name; if (display_name_length && r.out.display_name_length) { *display_name_length = *r.out.display_name_length; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1271,39 +1271,39 @@ NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli, TALLOC_CT { struct svcctl_GetServiceKeyNameA r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.service_name = service_name; r.in.display_name_length = display_name_length; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEKEYNAMEA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *key_name = *r.out.key_name; if (display_name_length && r.out.display_name_length) { *display_name_length = *r.out.display_name_length; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1311,32 +1311,32 @@ NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli, TALLO { struct svcctl_GetCurrentGroupeStateW r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETCURRENTGROUPESTATEW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1344,32 +1344,32 @@ NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli, TALLOC_CTX { struct svcctl_EnumServiceGroupW r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMSERVICEGROUPW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1377,35 +1377,35 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli, TALLOC { struct svcctl_ChangeServiceConfig2A r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.info_level = info_level; r.in.info = info; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIG2A, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1413,35 +1413,35 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli, TALLOC { struct svcctl_ChangeServiceConfig2W r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.info_level = info_level; r.in.info = info; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIG2W, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1449,37 +1449,37 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_ { struct svcctl_QueryServiceConfig2A r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.info_level = info_level; r.in.buf_size = buf_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIG2A, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(buffer, r.out.buffer, r.in.buf_size); *bytes_needed = *r.out.bytes_needed; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1487,37 +1487,37 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_ { struct svcctl_QueryServiceConfig2W r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.info_level = info_level; r.in.buf_size = buf_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIG2W, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(buffer, r.out.buffer, r.in.buf_size); *bytes_needed = *r.out.bytes_needed; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1525,37 +1525,37 @@ NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli, TALLOC_ { struct svcctl_QueryServiceStatusEx r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.info_level = info_level; r.in.buf_size = buf_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICESTATUSEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(buffer, r.out.buffer, r.in.buf_size); *bytes_needed = *r.out.bytes_needed; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1563,7 +1563,7 @@ NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct EnumServicesStatusExA r; NTSTATUS status; - + /* In parameters */ r.in.scmanager = scmanager; r.in.info_level = info_level; @@ -1571,23 +1571,23 @@ NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.state = state; r.in.buf_size = buf_size; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_ENUMSERVICESSTATUSEXA, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(services, r.out.services, r.in.buf_size); *bytes_needed = *r.out.bytes_needed; @@ -1596,12 +1596,12 @@ NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *m *resume_handle = *r.out.resume_handle; } *group_name = *r.out.group_name; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1609,7 +1609,7 @@ NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct EnumServicesStatusExW r; NTSTATUS status; - + /* In parameters */ r.in.scmanager = scmanager; r.in.info_level = info_level; @@ -1617,23 +1617,23 @@ NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.state = state; r.in.buf_size = buf_size; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_ENUMSERVICESSTATUSEXW, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(services, r.out.services, r.in.buf_size); *bytes_needed = *r.out.bytes_needed; @@ -1642,12 +1642,12 @@ NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *m *resume_handle = *r.out.resume_handle; } *group_name = *r.out.group_name; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1655,32 +1655,32 @@ NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli, TALLOC_CTX * { struct svcctl_SCSendTSMessage r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SCSENDTSMESSAGE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } diff --git a/source3/librpc/gen_ndr/cli_unixinfo.c b/source3/librpc/gen_ndr/cli_unixinfo.c index 4a48ac2c43..c8b9a01f3d 100644 --- a/source3/librpc/gen_ndr/cli_unixinfo.c +++ b/source3/librpc/gen_ndr/cli_unixinfo.c @@ -10,29 +10,29 @@ NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct unixinfo_SidToUid r; NTSTATUS status; - + /* In parameters */ r.in.sid = sid; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(unixinfo_SidToUid, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_SIDTOUID, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(unixinfo_SidToUid, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *uid = *r.out.uid; - + /* Return result */ return r.out.result; } @@ -41,29 +41,29 @@ NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct unixinfo_UidToSid r; NTSTATUS status; - + /* In parameters */ r.in.uid = uid; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(unixinfo_UidToSid, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_UIDTOSID, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(unixinfo_UidToSid, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *sid = *r.out.sid; - + /* Return result */ return r.out.result; } @@ -72,29 +72,29 @@ NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct unixinfo_SidToGid r; NTSTATUS status; - + /* In parameters */ r.in.sid = sid; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(unixinfo_SidToGid, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_SIDTOGID, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(unixinfo_SidToGid, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *gid = *r.out.gid; - + /* Return result */ return r.out.result; } @@ -103,29 +103,29 @@ NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct unixinfo_GidToSid r; NTSTATUS status; - + /* In parameters */ r.in.gid = gid; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(unixinfo_GidToSid, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_GIDTOSID, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(unixinfo_GidToSid, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *sid = *r.out.sid; - + /* Return result */ return r.out.result; } @@ -134,31 +134,31 @@ NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct unixinfo_GetPWUid r; NTSTATUS status; - + /* In parameters */ r.in.count = count; r.in.uids = uids; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(unixinfo_GetPWUid, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_GETPWUID, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(unixinfo_GetPWUid, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *count = *r.out.count; memcpy(infos, r.out.infos, *r.in.count); - + /* Return result */ return r.out.result; } diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c index d89f306b17..934dfc17b6 100644 --- a/source3/librpc/gen_ndr/cli_winreg.c +++ b/source3/librpc/gen_ndr/cli_winreg.c @@ -10,35 +10,35 @@ NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_OpenHKCR r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKCR, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -46,35 +46,35 @@ NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_OpenHKCU r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKCU, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -82,35 +82,35 @@ NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_OpenHKLM r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKLM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -118,35 +118,35 @@ NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_OpenHKPD r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKPD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -154,35 +154,35 @@ NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct winreg_OpenHKU r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenHKU, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKU, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -190,34 +190,34 @@ NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_CloseKey r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_CloseKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_CLOSEKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_CloseKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -225,7 +225,7 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct winreg_CreateKey r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.name = name; @@ -234,34 +234,34 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.access_mask = access_mask; r.in.secdesc = secdesc; r.in.action_taken = action_taken; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_CreateKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_CREATEKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_CreateKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *new_handle = *r.out.new_handle; if (action_taken && r.out.action_taken) { *action_taken = *r.out.action_taken; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -269,34 +269,34 @@ NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct winreg_DeleteKey r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.key = key; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_DeleteKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_DELETEKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -304,34 +304,34 @@ NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct winreg_DeleteValue r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.value = value; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_DeleteValue, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_DELETEVALUE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -339,30 +339,30 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct winreg_EnumKey r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.enum_index = enum_index; r.in.name = name; r.in.keyclass = keyclass; r.in.last_changed_time = last_changed_time; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_EnumKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_ENUMKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_EnumKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *name = *r.out.name; if (keyclass && r.out.keyclass) { @@ -371,12 +371,12 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, if (last_changed_time && r.out.last_changed_time) { *last_changed_time = *r.out.last_changed_time; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -384,7 +384,7 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct winreg_EnumValue r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.enum_index = enum_index; @@ -393,23 +393,23 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.value = value; r.in.size = size; r.in.length = length; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_EnumValue, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_ENUMVALUE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_EnumValue, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *name = *r.out.name; if (type && r.out.type) { @@ -424,12 +424,12 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct if (length && r.out.length) { *length = *r.out.length; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -437,33 +437,33 @@ NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_FlushKey r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_FlushKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_FLUSHKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_FlushKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -471,36 +471,36 @@ NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct winreg_GetKeySecurity r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.sec_info = sec_info; r.in.sd = sd; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_GETKEYSECURITY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *sd = *r.out.sd; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -508,35 +508,35 @@ NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct winreg_LoadKey r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.keyname = keyname; r.in.filename = filename; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_LoadKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_LOADKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_LoadKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -544,7 +544,7 @@ NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_ { struct winreg_NotifyChangeKeyValue r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.watch_subtree = watch_subtree; @@ -553,30 +553,30 @@ NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_ r.in.string1 = string1; r.in.string2 = string2; r.in.unknown2 = unknown2; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_NOTIFYCHANGEKEYVALUE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -584,37 +584,37 @@ NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct winreg_OpenKey r; NTSTATUS status; - + /* In parameters */ r.in.parent_handle = parent_handle; r.in.keyname = keyname; r.in.unknown = unknown; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -622,27 +622,27 @@ NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem { struct winreg_QueryInfoKey r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.classname = classname; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYINFOKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *classname = *r.out.classname; *num_subkeys = *r.out.num_subkeys; @@ -653,12 +653,12 @@ NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem *max_valbufsize = *r.out.max_valbufsize; *secdescsize = *r.out.secdescsize; *last_changed_time = *r.out.last_changed_time; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -666,7 +666,7 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct winreg_QueryValue r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.value_name = value_name; @@ -674,23 +674,23 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.data = data; r.in.data_size = data_size; r.in.value_length = value_length; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYVALUE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_QueryValue, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (type && r.out.type) { *type = *r.out.type; @@ -704,12 +704,12 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c if (value_length && r.out.value_length) { *value_length = *r.out.value_length; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -717,32 +717,32 @@ NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct winreg_ReplaceKey r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_REPLACEKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -750,35 +750,35 @@ NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct winreg_RestoreKey r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.filename = filename; r.in.flags = flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_RESTOREKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -786,35 +786,35 @@ NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, { struct winreg_SaveKey r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.filename = filename; r.in.sec_attrib = sec_attrib; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SAVEKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -822,35 +822,35 @@ NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct winreg_SetKeySecurity r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.access_mask = access_mask; r.in.sd = sd; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SETKEYSECURITY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -858,37 +858,37 @@ NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_SetValue r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; r.in.name = name; r.in.type = type; r.in.data = data; r.in.size = size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_SetValue, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SETVALUE, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_SetValue, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -896,32 +896,32 @@ NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct winreg_UnLoadKey r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_UNLOADKEY, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -929,37 +929,37 @@ NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, TALLO { struct winreg_InitiateSystemShutdown r; NTSTATUS status; - + /* In parameters */ r.in.hostname = hostname; r.in.message = message; r.in.timeout = timeout; r.in.force_apps = force_apps; r.in.reboot = reboot; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_INITIATESYSTEMSHUTDOWN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -967,33 +967,33 @@ NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_C { struct winreg_AbortSystemShutdown r; NTSTATUS status; - + /* In parameters */ r.in.server = server; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_ABORTSYSTEMSHUTDOWN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1001,34 +1001,34 @@ NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct winreg_GetVersion r; NTSTATUS status; - + /* In parameters */ r.in.handle = handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_GetVersion, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_GETVERSION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_GetVersion, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *version = *r.out.version; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1036,35 +1036,35 @@ NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_OpenHKCC r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKCC, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1072,35 +1072,35 @@ NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_OpenHKDD r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKDD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1108,42 +1108,42 @@ NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_C { struct winreg_QueryMultipleValues r; NTSTATUS status; - + /* In parameters */ r.in.key_handle = key_handle; r.in.values = values; r.in.num_values = num_values; r.in.buffer = buffer; r.in.buffer_size = buffer_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYMULTIPLEVALUES, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ memcpy(values, r.out.values, r.in.num_values); if (buffer && r.out.buffer) { memcpy(buffer, r.out.buffer, *r.in.buffer_size); } *buffer_size = *r.out.buffer_size; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1151,7 +1151,7 @@ NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TAL { struct winreg_InitiateSystemShutdownEx r; NTSTATUS status; - + /* In parameters */ r.in.hostname = hostname; r.in.message = message; @@ -1159,30 +1159,30 @@ NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TAL r.in.force_apps = force_apps; r.in.reboot = reboot; r.in.reason = reason; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_INITIATESYSTEMSHUTDOWNEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1190,32 +1190,32 @@ NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct { struct winreg_SaveKeyEx r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SAVEKEYEX, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1223,35 +1223,35 @@ NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_OpenHKPT r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKPT, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1259,35 +1259,35 @@ NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx { struct winreg_OpenHKPN r; NTSTATUS status; - + /* In parameters */ r.in.system_name = system_name; r.in.access_mask = access_mask; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKPN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *handle = *r.out.handle; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1295,32 +1295,32 @@ NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli, TALLOC_ { struct winreg_QueryMultipleValues2 r; NTSTATUS status; - + /* In parameters */ - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYMULTIPLEVALUES2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } diff --git a/source3/librpc/gen_ndr/cli_wkssvc.c b/source3/librpc/gen_ndr/cli_wkssvc.c index fbdc93ed2a..f0a35c701c 100644 --- a/source3/librpc/gen_ndr/cli_wkssvc.c +++ b/source3/librpc/gen_ndr/cli_wkssvc.c @@ -10,35 +10,35 @@ NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * { struct wkssvc_NetWkstaGetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaGetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTAGETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaGetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -46,37 +46,37 @@ NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * { struct wkssvc_NetWkstaSetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.level = level; r.in.info = info; r.in.parm_error = parm_error; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaSetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTASETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaSetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *parm_error = *r.out.parm_error; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -84,41 +84,41 @@ NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli, TALLOC_CTX { struct wkssvc_NetWkstaEnumUsers r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.info = info; r.in.prefmaxlen = prefmaxlen; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaEnumUsers, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTAENUMUSERS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaEnumUsers, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; *entries_read = *r.out.entries_read; if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -126,35 +126,35 @@ NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli, TALLOC_ { struct wkssvc_NetrWkstaUserGetInfo r; NTSTATUS status; - + /* In parameters */ r.in.unknown = unknown; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserGetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTAUSERGETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserGetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -162,39 +162,39 @@ NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli, TALLOC_ { struct wkssvc_NetrWkstaUserSetInfo r; NTSTATUS status; - + /* In parameters */ r.in.unknown = unknown; r.in.level = level; r.in.info = info; r.in.parm_err = parm_err; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserSetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTAUSERSETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserSetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (parm_err && r.out.parm_err) { *parm_err = *r.out.parm_err; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -202,41 +202,41 @@ NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli, TALLOC { struct wkssvc_NetWkstaTransportEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.info = info; r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaTransportEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTATRANSPORTENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaTransportEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; *total_entries = *r.out.total_entries; if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -244,39 +244,39 @@ NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli, TALLOC { struct wkssvc_NetrWkstaTransportAdd r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.level = level; r.in.info0 = info0; r.in.parm_err = parm_err; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportAdd, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTATRANSPORTADD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportAdd, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (parm_err && r.out.parm_err) { *parm_err = *r.out.parm_err; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -284,35 +284,35 @@ NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli, TALLOC { struct wkssvc_NetrWkstaTransportDel r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.transport_name = transport_name; r.in.unknown3 = unknown3; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportDel, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTATRANSPORTDEL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportDel, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -320,39 +320,39 @@ NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct wkssvc_NetrUseAdd r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.level = level; r.in.ctr = ctr; r.in.parm_err = parm_err; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrUseAdd, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEADD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseAdd, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ if (parm_err && r.out.parm_err) { *parm_err = *r.out.parm_err; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -360,36 +360,36 @@ NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct wkssvc_NetrUseGetInfo r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.use_name = use_name; r.in.level = level; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrUseGetInfo, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEGETINFO, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseGetInfo, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *ctr = *r.out.ctr; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -397,35 +397,35 @@ NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c { struct wkssvc_NetrUseDel r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.use_name = use_name; r.in.force_cond = force_cond; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrUseDel, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEDEL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseDel, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -433,41 +433,41 @@ NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ { struct wkssvc_NetrUseEnum r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.info = info; r.in.prefmaxlen = prefmaxlen; r.in.resume_handle = resume_handle; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrUseEnum, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEENUM, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseEnum, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; *entries_read = *r.out.entries_read; if (resume_handle && r.out.resume_handle) { *resume_handle = *r.out.resume_handle; } - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -475,37 +475,37 @@ NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli, TALLOC { struct wkssvc_NetrMessageBufferSend r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.message_name = message_name; r.in.message_sender_name = message_sender_name; r.in.message_buffer = message_buffer; r.in.message_size = message_size; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrMessageBufferSend, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRMESSAGEBUFFERSEND, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrMessageBufferSend, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -513,37 +513,37 @@ NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli, { struct wkssvc_NetrWorkstationStatisticsGet r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.unknown2 = unknown2; r.in.unknown3 = unknown3; r.in.unknown4 = unknown4; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrWorkstationStatisticsGet, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrWorkstationStatisticsGet, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *info = *r.out.info; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -551,33 +551,33 @@ NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli, TALLO { struct wkssvc_NetrLogonDomainNameAdd r; NTSTATUS status; - + /* In parameters */ r.in.domain_name = domain_name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameAdd, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRLOGONDOMAINNAMEADD, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameAdd, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -585,33 +585,33 @@ NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli, TALLO { struct wkssvc_NetrLogonDomainNameDel r; NTSTATUS status; - + /* In parameters */ r.in.domain_name = domain_name; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameDel, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameDel, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -619,7 +619,7 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *m { struct wkssvc_NetrJoinDomain r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.domain_name = domain_name; @@ -627,30 +627,30 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.Account = Account; r.in.password = password; r.in.join_flags = join_flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRJOINDOMAIN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -658,36 +658,36 @@ NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX { struct wkssvc_NetrUnjoinDomain r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.Account = Account; r.in.password = password; r.in.unjoin_flags = unjoin_flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUNJOINDOMAIN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -695,37 +695,37 @@ NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli, TA { struct wkssvc_NetrRenameMachineInDomain r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.NewMachineName = NewMachineName; r.in.Account = Account; r.in.password = password; r.in.RenameOptions = RenameOptions; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -733,37 +733,37 @@ NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli, TALLOC_CTX { struct wkssvc_NetrValidateName r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.name = name; r.in.Account = Account; r.in.Password = Password; r.in.name_type = name_type; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRVALIDATENAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -771,36 +771,36 @@ NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli, TALLO { struct wkssvc_NetrGetJoinInformation r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.name_buffer = name_buffer; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinInformation, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRGETJOININFORMATION, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinInformation, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *name_buffer = *r.out.name_buffer; *name_type = *r.out.name_type; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -808,39 +808,39 @@ NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli, TALLOC_CT { struct wkssvc_NetrGetJoinableOus r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.domain_name = domain_name; r.in.Account = Account; r.in.unknown = unknown; r.in.num_ous = num_ous; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRGETJOINABLEOUS, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *num_ous = *r.out.num_ous; memcpy(ous, r.out.ous, *r.in.num_ous); - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -848,7 +848,7 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX * { struct wkssvc_NetrJoinDomain2 r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.domain_name = domain_name; @@ -856,30 +856,30 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.admin_account = admin_account; r.in.encrypted_password = encrypted_password; r.in.join_flags = join_flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRJOINDOMAIN2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -887,36 +887,36 @@ NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX { struct wkssvc_NetrUnjoinDomain2 r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.account = account; r.in.encrypted_password = encrypted_password; r.in.unjoin_flags = unjoin_flags; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUNJOINDOMAIN2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -924,37 +924,37 @@ NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli, T { struct wkssvc_NetrRenameMachineInDomain2 r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.NewMachineName = NewMachineName; r.in.Account = Account; r.in.EncryptedPassword = EncryptedPassword; r.in.RenameOptions = RenameOptions; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -962,37 +962,37 @@ NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli, TALLOC_CTX { struct wkssvc_NetrValidateName2 r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.name = name; r.in.Account = Account; r.in.EncryptedPassword = EncryptedPassword; r.in.name_type = name_type; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRVALIDATENAME2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1000,39 +1000,39 @@ NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli, TALLOC_C { struct wkssvc_NetrGetJoinableOus2 r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.domain_name = domain_name; r.in.Account = Account; r.in.EncryptedPassword = EncryptedPassword; r.in.num_ous = num_ous; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus2, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRGETJOINABLEOUS2, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus2, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *num_ous = *r.out.num_ous; memcpy(ous, r.out.ous, *r.in.num_ous); - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1040,37 +1040,37 @@ NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli, { struct wkssvc_NetrAddAlternateComputerName r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.NewAlternateMachineName = NewAlternateMachineName; r.in.Account = Account; r.in.EncryptedPassword = EncryptedPassword; r.in.Reserved = Reserved; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrAddAlternateComputerName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrAddAlternateComputerName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1078,37 +1078,37 @@ NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *c { struct wkssvc_NetrRemoveAlternateComputerName r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.AlternateMachineNameToRemove = AlternateMachineNameToRemove; r.in.Account = Account; r.in.EncryptedPassword = EncryptedPassword; r.in.Reserved = Reserved; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrRemoveAlternateComputerName, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrRemoveAlternateComputerName, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1116,37 +1116,37 @@ NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli, T { struct wkssvc_NetrSetPrimaryComputername r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.primary_name = primary_name; r.in.Account = Account; r.in.EncryptedPassword = EncryptedPassword; r.in.Reserved = Reserved; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrSetPrimaryComputername, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrSetPrimaryComputername, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } @@ -1154,36 +1154,36 @@ NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli, T { struct wkssvc_NetrEnumerateComputerNames r; NTSTATUS status; - + /* In parameters */ r.in.server_name = server_name; r.in.name_type = name_type; r.in.Reserved = Reserved; - + if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(wkssvc_NetrEnumerateComputerNames, &r); - + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES, &r); - + if (!NT_STATUS_IS_OK(status)) { return status; } - + if (DEBUGLEVEL >= 10) NDR_PRINT_OUT_DEBUG(wkssvc_NetrEnumerateComputerNames, &r); - + if (NT_STATUS_IS_ERR(status)) { return status; } - + /* Return variables */ *ctr = *r.out.ctr; - + /* Return result */ if (werror) { *werror = r.out.result; } - + return werror_to_ntstatus(r.out.result); } -- cgit From 7ca33d1112f415a41ed48be02a7f732a2c640ff7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 8 Jan 2008 13:11:12 -0800 Subject: Move the DNS tsig update to using struct sockaddr_storage from struct in_addr. Still only does IPv4 updates but now it'll be easy to add IPv6 when we have time. Jeremy. (This used to be commit ac3a433befca2c6b674fc7e7f2f2c700d78b0a0c) --- source3/libaddns/dns.h | 8 ++++---- source3/libaddns/dnsrecord.c | 35 +++++++++++++++++++++-------------- source3/utils/net_dns.c | 37 ++++++++++++++++++++++--------------- 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/source3/libaddns/dns.h b/source3/libaddns/dns.h index b901acf4cc..a83c0b4f8e 100644 --- a/source3/libaddns/dns.h +++ b/source3/libaddns/dns.h @@ -411,7 +411,7 @@ DNS_ERROR dns_create_update( TALLOC_CTX *mem_ctx, const char *name, struct dns_update_request **preq ); DNS_ERROR dns_create_probe(TALLOC_CTX *mem_ctx, const char *zone, const char *host, int num_ips, - const struct in_addr *iplist, + const struct sockaddr_storage *sslist, struct dns_update_request **preq); DNS_ERROR dns_create_rrec(TALLOC_CTX *mem_ctx, const char *name, uint16 type, uint16 r_class, uint32 ttl, @@ -426,7 +426,7 @@ DNS_ERROR dns_create_tkey_record(TALLOC_CTX *mem_ctx, const char *keyname, struct dns_rrec **prec); DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx, const char *name, - const struct in_addr *ip, + const struct sockaddr_storage *ip, struct dns_rrec **prec); DNS_ERROR dns_create_delete_record(TALLOC_CTX *mem_ctx, const char *name, uint16 type, uint16 r_class, @@ -435,7 +435,7 @@ DNS_ERROR dns_create_name_not_in_use_record(TALLOC_CTX *mem_ctx, const char *name, uint32 type, struct dns_rrec **prec); DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host, - uint32 ttl, struct in_addr ip, + uint32 ttl, const struct sockaddr_storage *pss, struct dns_rrec **prec); DNS_ERROR dns_unmarshall_tkey_record(TALLOC_CTX *mem_ctx, struct dns_rrec *rec, struct dns_tkey_record **ptkey); @@ -517,7 +517,7 @@ DNS_ERROR dns_sign_update(struct dns_update_request *req, DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx, const char *domainname, const char *hostname, - const struct in_addr *ip_addr, + const struct sockaddr_storage *ip_addr, size_t num_adds, struct dns_update_request **preq); diff --git a/source3/libaddns/dnsrecord.c b/source3/libaddns/dnsrecord.c index cb8a7c1a95..500cbd6681 100644 --- a/source3/libaddns/dnsrecord.c +++ b/source3/libaddns/dnsrecord.c @@ -119,12 +119,19 @@ DNS_ERROR dns_create_rrec(TALLOC_CTX *mem_ctx, const char *name, } DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host, - uint32 ttl, struct in_addr ip, + uint32 ttl, const struct sockaddr_storage *pss, struct dns_rrec **prec) { uint8 *data; DNS_ERROR err; + struct in_addr ip; + if (pss->ss_family != AF_INET) { + /* Silently ignore this. */ + return ERROR_DNS_SUCCESS; + } + + ip = ((struct sockaddr_in *)pss)->sin_addr; if (!(data = (uint8 *)TALLOC_MEMDUP(mem_ctx, (const void *)&ip.s_addr, sizeof(ip.s_addr)))) { return ERROR_DNS_NO_MEMORY; @@ -142,11 +149,11 @@ DNS_ERROR dns_create_a_record(TALLOC_CTX *mem_ctx, const char *host, DNS_ERROR dns_create_name_in_use_record(TALLOC_CTX *mem_ctx, const char *name, - const struct in_addr *ip, + const struct sockaddr_storage *ss, struct dns_rrec **prec) { - if (ip != NULL) { - return dns_create_a_record(mem_ctx, name, 0, *ip, prec); + if (ss != NULL) { + return dns_create_a_record(mem_ctx, name, 0, ss, prec); } return dns_create_rrec(mem_ctx, name, QTYPE_ANY, DNS_CLASS_IN, 0, 0, @@ -321,7 +328,7 @@ DNS_ERROR dns_add_rrec(TALLOC_CTX *mem_ctx, struct dns_rrec *rec, DNS_ERROR dns_create_probe(TALLOC_CTX *mem_ctx, const char *zone, const char *host, int num_ips, - const struct in_addr *iplist, + const struct sockaddr_storage *sslist, struct dns_update_request **preq) { struct dns_update_request *req; @@ -340,7 +347,7 @@ DNS_ERROR dns_create_probe(TALLOC_CTX *mem_ctx, const char *zone, for (i=0; inum_preqs, &req->preqs); @@ -358,14 +365,14 @@ DNS_ERROR dns_create_probe(TALLOC_CTX *mem_ctx, const char *zone, DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx, const char *domainname, const char *hostname, - const struct in_addr *ip_addrs, + const struct sockaddr_storage *ss_addrs, size_t num_addrs, struct dns_update_request **preq) { struct dns_update_request *req; struct dns_rrec *rec; DNS_ERROR err; - size_t i; + size_t i; err = dns_create_update(mem_ctx, domainname, &req); if (!ERR_DNS_IS_OK(err)) return err; @@ -388,7 +395,7 @@ DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx, err = dns_create_delete_record(req, hostname, QTYPE_A, DNS_CLASS_ANY, &rec); if (!ERR_DNS_IS_OK(err)) goto error; - + err = dns_add_rrec(req, rec, &req->num_updates, &req->updates); if (!ERR_DNS_IS_OK(err)) goto error; @@ -396,15 +403,15 @@ DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx, * .. and add our IPs */ - for ( i=0; inum_updates, &req->updates); - if (!ERR_DNS_IS_OK(err)) + if (!ERR_DNS_IS_OK(err)) goto error; - } + } *preq = req; return ERROR_DNS_SUCCESS; diff --git a/source3/utils/net_dns.c b/source3/utils/net_dns.c index 8b82a96892..c661c77ce6 100644 --- a/source3/utils/net_dns.c +++ b/source3/utils/net_dns.c @@ -32,14 +32,14 @@ DNS_ERROR DoDNSUpdate(char *pszServerName, const char *pszDomainName, const char *pszHostName, - const struct in_addr *iplist, size_t num_addrs ); + const struct sockaddr_storage *sslist, size_t num_addrs ); /********************************************************************* *********************************************************************/ DNS_ERROR DoDNSUpdate(char *pszServerName, const char *pszDomainName, const char *pszHostName, - const struct in_addr *iplist, size_t num_addrs ) + const struct sockaddr_storage *sslist, size_t num_addrs ) { DNS_ERROR err; struct dns_connection *conn; @@ -65,7 +65,7 @@ DNS_ERROR DoDNSUpdate(char *pszServerName, */ err = dns_create_probe(mem_ctx, pszDomainName, pszHostName, - num_addrs, iplist, &req); + num_addrs, sslist, &req); if (!ERR_DNS_IS_OK(err)) goto error; err = dns_update_transaction(mem_ctx, conn, req, &resp); @@ -81,7 +81,7 @@ DNS_ERROR DoDNSUpdate(char *pszServerName, */ err = dns_create_update_request(mem_ctx, pszDomainName, pszHostName, - iplist, num_addrs, &req); + sslist, num_addrs, &req); if (!ERR_DNS_IS_OK(err)) goto error; err = dns_update_transaction(mem_ctx, conn, req, &resp); @@ -141,30 +141,37 @@ error: /********************************************************************* *********************************************************************/ -int get_my_ip_address( struct in_addr **ips ) +int get_my_ip_address( struct sockaddr_storage **pp_ss ) + { struct iface_struct nics[MAX_INTERFACES]; int i, n; - struct in_addr *list; + struct sockaddr_storage *list = NULL; int count = 0; /* find the first non-loopback address from our list of interfaces */ n = get_interfaces(nics, MAX_INTERFACES); - - if ( (list = SMB_MALLOC_ARRAY( struct in_addr, n )) == NULL ) { + + if (n <= 0) { + return -1; + } + + if ( (list = SMB_MALLOC_ARRAY( struct sockaddr_storage, n )) == NULL ) { return -1; } for ( i=0; isin_addr; - - if (!is_loopback_ip_v4(ifip)) { - memcpy(&list[count++], &ifip, sizeof(struct in_addr)); - } + memcpy(&list[count++], &nics[i].ip); + } else +#endif + if ((nics[i].ip.ss_family == AF_INET)) { + memcpy(&list[count++], &nics[i].ip); } } *ips = list; -- cgit From 35c256226f7cbf1125ad7b6370eecdf09b3cfbc6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 8 Jan 2008 21:45:21 +0100 Subject: Allocate dirp->name_cache on demand only (This used to be commit 1a15778331393f9ece9aac9450828e799b20a058) --- source3/smbd/dir.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index ab6e12f20f..04e3167e77 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1139,16 +1139,6 @@ struct smb_Dir *OpenDir(connection_struct *conn, const char *name, const char *m goto fail; } - if (dirp->name_cache_size) { - dirp->name_cache = SMB_CALLOC_ARRAY(struct name_cache_entry, - dirp->name_cache_size); - if (!dirp->name_cache) { - goto fail; - } - } else { - dirp->name_cache = NULL; - } - dirhandles_open++; return dirp; @@ -1295,10 +1285,19 @@ void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset) { struct name_cache_entry *e; - if (!dirp->name_cache_size || !dirp->name_cache) { + if (dirp->name_cache_size == 0) { return; } + if (dirp->name_cache == NULL) { + dirp->name_cache = SMB_CALLOC_ARRAY(struct name_cache_entry, + dirp->name_cache_size); + + if (dirp->name_cache == NULL) { + return; + } + } + dirp->name_cache_index = (dirp->name_cache_index+1) % dirp->name_cache_size; e = &dirp->name_cache[dirp->name_cache_index]; -- cgit From 5274d8cda30f712f01a048862d0fdc532878eba5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 8 Jan 2008 22:12:35 +0100 Subject: Only realloc the talloc stack if necessary (This used to be commit c7cb98d486ef8af1dc7111c2316fd73db9fef9f8) --- source3/lib/talloc_stack.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/source3/lib/talloc_stack.c b/source3/lib/talloc_stack.c index cc7ce3a518..d887b2d415 100644 --- a/source3/lib/talloc_stack.c +++ b/source3/lib/talloc_stack.c @@ -39,6 +39,7 @@ #include "includes.h" static int talloc_stacksize; +static int talloc_stack_arraysize; static TALLOC_CTX **talloc_stack; static int talloc_pop(TALLOC_CTX *frame) @@ -67,21 +68,25 @@ TALLOC_CTX *talloc_stackframe(void) { TALLOC_CTX **tmp, *top; - if (!(tmp = TALLOC_REALLOC_ARRAY(NULL, talloc_stack, TALLOC_CTX *, - talloc_stacksize + 1))) { - goto fail; - } + if (talloc_stack_arraysize < talloc_stacksize + 1) { + tmp = TALLOC_REALLOC_ARRAY(NULL, talloc_stack, TALLOC_CTX *, + talloc_stacksize + 1); + if (tmp == NULL) { + goto fail; + } + talloc_stack = tmp; + talloc_stack_arraysize = talloc_stacksize + 1; + } - talloc_stack = tmp; + top = talloc_new(talloc_stack); - if (!(top = talloc_new(talloc_stack))) { + if (top == NULL) { goto fail; } talloc_set_destructor(top, talloc_pop); talloc_stack[talloc_stacksize++] = top; - return top; fail: -- cgit From 89f1fec4e57255fc511eeee0b18cbe19e8c22297 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 22:13:25 +0100 Subject: Fix examples/VFS after VFS API changes. Michael (This used to be commit c88555ce45aa2998037d316f3a8edccd04be04a4) --- examples/VFS/skel_opaque.c | 24 +++++++++++------------ examples/VFS/skel_transparent.c | 42 ++++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index d5cedaf5d2..c095a15794 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -246,9 +246,9 @@ static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_ return vfswrap_lock(NULL, fsp, op, offset, count, type); } -static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) +static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) { - return vfswrap_getlock(NULL, fsp, fd, poffset, pcount, ptype, ppid); + return vfswrap_getlock(NULL, fsp, poffset, pcount, ptype, ppid); } static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) @@ -334,7 +334,7 @@ static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t m return -1; } -static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { errno = ENOSYS; return -1; @@ -370,7 +370,7 @@ static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *p return NULL; } -static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { errno = ENOSYS; return NULL; @@ -436,7 +436,7 @@ static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, S return -1; } -static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl) +static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl) { errno = ENOSYS; return -1; @@ -485,7 +485,7 @@ size) return -1; } -static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size) { errno = ENOSYS; return -1; @@ -503,7 +503,7 @@ static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char return -1; } -static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size) +static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) { errno = ENOSYS; return -1; @@ -521,7 +521,7 @@ static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const return -1; } -static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name) { errno = ENOSYS; return -1; @@ -539,7 +539,7 @@ static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const cha return -1; } -static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) { errno = ENOSYS; return -1; @@ -560,9 +560,9 @@ static ssize_t skel_aio_return(struct vfs_handle_struct *handle, struct files_st return vfswrap_aio_return(NULL, fsp, aiocb); } -static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb) +static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) { - return vfswrap_aio_cancel(NULL, fsp, fd, aiocb); + return vfswrap_aio_cancel(NULL, fsp, aiocb); } static int skel_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) @@ -615,7 +615,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_pwrite), SMB_VFS_OP_PWRITE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_lseek), SMB_VFS_OP_LSEEK, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_sendfile), SMB_VFS_OP_SENDFILE, SMB_VFS_LAYER_OPAQUE}, - {SMB_VFS_OP(skel_recvfile), SMB_VFS_OP_RECVFLE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_recvfile), SMB_VFS_OP_RECVFILE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_fsync), SMB_VFS_OP_FSYNC, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_OPAQUE}, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 37570b8ab0..f15cdfdb70 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -239,9 +239,9 @@ static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_ return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type); } -static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) +static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) { - return SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid); + return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid); } static int skel_symlink(vfs_handle_struct *handle, const char *oldpath, const char *newpath) @@ -289,16 +289,16 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle, return SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode); } -static size_t skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, +static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) { return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc); } -static size_t skel_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp, +static NTSTATUS skel_get_nt_acl(vfs_handle_struct *handle, const char *name, uint32 security_info, SEC_DESC **ppdesc) { - return SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info, ppdesc); + return SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc); } static NTSTATUS skel_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, @@ -323,14 +323,14 @@ static int skel_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t m return SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode); } -static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode) +static int skel_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { /* If the underlying VFS doesn't have ACL support... */ if (!handle->vfs_next.ops.fchmod_acl) { errno = ENOSYS; return -1; } - return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, fd, mode); + return SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode); } static int skel_sys_acl_get_entry(vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p) @@ -358,9 +358,9 @@ static SMB_ACL_T skel_sys_acl_get_file(vfs_handle_struct *handle, const char *p return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type); } -static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, int fd) +static SMB_ACL_T skel_sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp) { - return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, fd); + return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp); } static int skel_sys_acl_clear_perms(vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset) @@ -413,9 +413,9 @@ static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name, S return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl); } -static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_ACL_T theacl) +static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl) { - return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, fd, theacl); + return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl); } static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle, const char *path) @@ -454,9 +454,9 @@ size) return SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size); } -static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size) +static ssize_t skel_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size) { - return SMB_VFS_NEXT_FGETXATTR(handle, fsp, fd, name, value, size); + return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size); } static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size) @@ -469,9 +469,9 @@ static ssize_t skel_llistxattr(vfs_handle_struct *handle, const char *path, char return SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size); } -static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size) +static ssize_t skel_flistxattr(vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size) { - return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, fd, list, size); + return SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size); } static int skel_removexattr(vfs_handle_struct *handle, const char *path, const char *name) @@ -484,9 +484,9 @@ static int skel_lremovexattr(vfs_handle_struct *handle, const char *path, const return SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name); } -static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name) +static int skel_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name) { - return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, fd, name); + return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name); } static int skel_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags) @@ -499,9 +499,9 @@ static int skel_lsetxattr(vfs_handle_struct *handle, const char *path, const cha return SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size, flags); } -static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, const void *value, size_t size, int flags) +static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags) { - return SMB_VFS_NEXT_FSETXATTR(handle, fsp, fd, name, value, size, flags); + return SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags); } static int skel_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) @@ -519,9 +519,9 @@ static ssize_t skel_aio_return(struct vfs_handle_struct *handle, struct files_st return SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb); } -static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb) +static int skel_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) { - return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, fd, aiocb); + return SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb); } static int skel_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) -- cgit From e09316ed789accc77b1812e8da4f9aa20330e2ea Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 22:51:21 +0100 Subject: Fix returns in void functions. Michael (This used to be commit ef7c9a765bcdb1c774ff4f6d14053c4aa3815f31) --- examples/VFS/skel_opaque.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index c095a15794..8c05479a62 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -92,7 +92,7 @@ static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, SMB_STRUCT_DI static void skel_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset) { - return vfswrap_seekdir(NULL, dirp, offset); + vfswrap_seekdir(NULL, dirp, offset); } static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) @@ -102,7 +102,7 @@ static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) static void skel_rewinddir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp) { - return vfswrap_rewinddir(NULL, dirp); + vfswrap_rewinddir(NULL, dirp); } static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) -- cgit From 0af2efcdc4cd669db2a2ee582674dc030c6371a9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 8 Jan 2008 22:42:27 +0100 Subject: Don't shrink a talloc area if we have less than 1k to gain (This used to be commit 28a72ebd4541fb54f284da49081345e54130c75a) --- source3/lib/talloc/talloc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c index 4d72c0e871..6dbe21bbf1 100644 --- a/source3/lib/talloc/talloc.c +++ b/source3/lib/talloc/talloc.c @@ -787,6 +787,11 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n tc = talloc_chunk_from_ptr(ptr); + if ((size < tc->size) && ((tc->size - size) < 1024)) { + tc->size = size; + return ptr; + } + /* don't allow realloc on referenced pointers */ if (unlikely(tc->refs)) { return NULL; -- cgit From 148f1eee4338bbe485f9b9bcf9569f76f906b665 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 8 Jan 2008 23:18:03 +0100 Subject: Save one popular malloc (This used to be commit 2150663d9eaf5cdab08de2ad1fcc952d7e85936c) --- source3/lib/ms_fnmatch.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/source3/lib/ms_fnmatch.c b/source3/lib/ms_fnmatch.c index a839b42588..8b69f1c2d2 100644 --- a/source3/lib/ms_fnmatch.c +++ b/source3/lib/ms_fnmatch.c @@ -152,6 +152,8 @@ int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern, smb_ucs2_t *s = NULL; int ret, count, i; struct max_n *max_n = NULL; + struct max_n *max_n_free = NULL; + struct max_n one_max_n; if (ISDOTDOT(string)) { string = "."; @@ -201,17 +203,27 @@ int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern, } if (count != 0) { - max_n = SMB_CALLOC_ARRAY(struct max_n, count); - if (!max_n) { - SAFE_FREE(p); - SAFE_FREE(s); - return -1; + if (count == 1) { + /* + * We're doing this a LOT, so save the effort to allocate + */ + ZERO_STRUCT(one_max_n); + max_n = &one_max_n; + } + else { + max_n = SMB_CALLOC_ARRAY(struct max_n, count); + if (!max_n) { + SAFE_FREE(p); + SAFE_FREE(s); + return -1; + } + max_n_free = max_n; } } ret = ms_fnmatch_core(p, s, max_n, strrchr_w(s, UCS2_CHAR('.')), is_case_sensitive); - SAFE_FREE(max_n); + SAFE_FREE(max_n_free); SAFE_FREE(p); SAFE_FREE(s); return ret; -- cgit From 80158198eee90cf05396989df068f77f8bb7e064 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 8 Jan 2008 15:57:08 -0800 Subject: Correctly identify enc/non-enc packets. Jeremy. (This used to be commit 647f13d0f1a270a68263b3b0403436f9d6cf1a0e) --- source3/smbd/seal.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source3/smbd/seal.c b/source3/smbd/seal.c index 21fca73fea..51a5f23f03 100644 --- a/source3/smbd/seal.c +++ b/source3/smbd/seal.c @@ -53,8 +53,8 @@ bool is_encrypted_packet(const uint8_t *inbuf) NTSTATUS status; uint16_t enc_num; - /* Ignore non-session messages. */ - if(CVAL(inbuf,0)) { + /* Ignore non-session messages or 0xFF'SMB' messages. */ + if(CVAL(inbuf,0) || IVAL(inbuf,4) == 0x424d53ff) { return false; } @@ -63,7 +63,9 @@ bool is_encrypted_packet(const uint8_t *inbuf) return false; } - if (srv_trans_enc_ctx && enc_num == srv_enc_ctx()) { + if (SVAL(inbuf,4) == 0x45FF && + srv_trans_enc_ctx && + enc_num == srv_enc_ctx()) { return true; } return false; -- cgit From 7febec3c58bebb20d7866ea98c43bb41f0c09db4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 8 Jan 2008 16:08:39 -0800 Subject: Simplify... plus add a debug message. Jeremy. (This used to be commit bedc493874adaf783362ba7b821e2a6d985b96ea) --- source3/smbd/seal.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/smbd/seal.c b/source3/smbd/seal.c index 51a5f23f03..ea017e08d8 100644 --- a/source3/smbd/seal.c +++ b/source3/smbd/seal.c @@ -53,8 +53,8 @@ bool is_encrypted_packet(const uint8_t *inbuf) NTSTATUS status; uint16_t enc_num; - /* Ignore non-session messages or 0xFF'SMB' messages. */ - if(CVAL(inbuf,0) || IVAL(inbuf,4) == 0x424d53ff) { + /* Ignore non-session messages or non 0xFF'E' messages. */ + if(CVAL(inbuf,0) || !(inbuf[4] == 0xFF && inbuf[5] == 'E')) { return false; } @@ -63,9 +63,8 @@ bool is_encrypted_packet(const uint8_t *inbuf) return false; } - if (SVAL(inbuf,4) == 0x45FF && - srv_trans_enc_ctx && - enc_num == srv_enc_ctx()) { + /* Encrypted messages are 0xFF'E' */ + if (srv_trans_enc_ctx && enc_num == srv_enc_ctx()) { return true; } return false; @@ -714,6 +713,7 @@ NTSTATUS srv_encryption_start(connection_struct *conn) partial_srv_trans_enc_ctx = NULL; + DEBUG(1,("srv_encryption_start: context negotiated\n")); return NT_STATUS_OK; } -- cgit From ebb21268df233933938e64e83ed315313aedd544 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 01:34:21 +0100 Subject: Fix talloctort: move size check after referenced ptr check. Michael (This used to be commit 45b219642c529865a898625eeb0433c60b233867) --- source3/lib/talloc/talloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c index 6dbe21bbf1..476d765104 100644 --- a/source3/lib/talloc/talloc.c +++ b/source3/lib/talloc/talloc.c @@ -787,16 +787,16 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n tc = talloc_chunk_from_ptr(ptr); - if ((size < tc->size) && ((tc->size - size) < 1024)) { - tc->size = size; - return ptr; - } - /* don't allow realloc on referenced pointers */ if (unlikely(tc->refs)) { return NULL; } + if ((size < tc->size) && ((tc->size - size) < 1024)) { + tc->size = size; + return ptr; + } + /* by resetting magic we catch users of the old memory */ tc->flags |= TALLOC_FLAG_FREE; -- cgit From 2e3ac4d3fe65ee72111c03a9b6fabf06f8192a69 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 01:35:43 +0100 Subject: Add a comment. Michael (This used to be commit 3a4bf4b7c3081048f0d5491dae6610388c268c2f) --- source3/lib/talloc/talloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c index 476d765104..3e976bc0fc 100644 --- a/source3/lib/talloc/talloc.c +++ b/source3/lib/talloc/talloc.c @@ -792,6 +792,7 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n return NULL; } + /* don't shrink if we have less than 1k to gain */ if ((size < tc->size) && ((tc->size - size) < 1024)) { tc->size = size; return ptr; -- cgit From 3ff1fc3932a019abfb1fd475d68477c16379b10d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 15:21:08 +0100 Subject: Extend a comment. Michael (This used to be commit 081435250709af734ec1e49e2539b091f2d92dfb) --- source3/param/loadparm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 29166cf02e..358fabfb2a 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -3514,7 +3514,9 @@ done: /* * this is process_registry_globals as it _should_ be (roughly) * using the reg_api functions... - * + * + * We are *not* currently doing it like this due to the large + * linker dependecies of the registry code (see above). */ static bool process_registry_globals(bool (*pfunc)(const char *, const char *)) { -- cgit From f168fac54c971286940f7471e45fa2c6eac76142 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 21:51:07 +0100 Subject: Don't leak data.dptr on error path. Michael (This used to be commit d14de0692c623ff07dada45a3d7bec03ceca2b7e) --- source3/groupdb/mapping_tdb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c index cf9f9058af..9adde40426 100644 --- a/source3/groupdb/mapping_tdb.c +++ b/source3/groupdb/mapping_tdb.c @@ -394,6 +394,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, char *string_sid; TDB_DATA dbuf; const char *p; + NTSTATUS status; TALLOC_CTX *frame; slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX, @@ -414,14 +415,15 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, continue; if (!add_sid_to_array_unique(NULL, &alias, sids, num)) { - TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; + status = NT_STATUS_NO_MEMORY; + goto done; } } +done: TALLOC_FREE(frame); SAFE_FREE(dbuf.dptr); - return NT_STATUS_OK; + return status; } static NTSTATUS alias_memberships(const DOM_SID *members, size_t num_members, -- cgit From de53e47c76cc6dfdc8056be1e376549b9e8a94a4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Jan 2008 23:02:50 +0100 Subject: Fix prototype: Add a void to an empty function parameter list. Michael (This used to be commit 3f89aea8e4df3a2de8c5e4c6f4e417567adb2d67) --- source3/winbindd/winbindd_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index fc71868517..c293861492 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -2360,7 +2360,7 @@ bool initialize_winbindd_cache(void) return true; } -void close_winbindd_cache() +void close_winbindd_cache(void) { if (!wcache) { return; -- cgit From f3603d5a5ab878d45b67bf0f33e2beca50d0af2d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 00:11:31 +0100 Subject: Convert add_sid_to_array() add_sid_to_array_unique() to return NTSTATUS. Michael (This used to be commit 6b2b9a60ef857ec31da5fea631535205fbdede4a) --- source3/auth/auth_util.c | 23 +++++++------ source3/auth/token_util.c | 63 +++++++++++++++++++++-------------- source3/groupdb/mapping_ldb.c | 16 +++++---- source3/groupdb/mapping_tdb.c | 9 +++-- source3/lib/privileges.c | 6 ++-- source3/lib/util_reg_smbconf.c | 9 +++-- source3/lib/util_sid.c | 70 +++++++++++++++++++++++---------------- source3/libgpo/gpo_ldap.c | 18 ++++++---- source3/passdb/pdb_ldap.c | 18 ++++++---- source3/rpcclient/cmd_samr.c | 5 +-- source3/winbindd/winbindd_ads.c | 39 ++++++++++++---------- source3/winbindd/winbindd_async.c | 20 +++++++---- source3/winbindd/winbindd_group.c | 15 ++++----- source3/winbindd/winbindd_pam.c | 9 ++--- source3/winbindd/winbindd_util.c | 21 +++++++----- 15 files changed, 203 insertions(+), 138 deletions(-) diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index fea1b2d761..ce47e94eb5 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -549,11 +549,13 @@ NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info, "for gid %d!\n", gids[i])); continue; } - if (!add_sid_to_array_unique( result, &unix_group_sid, - &result->sids, &result->num_sids )) { + status = add_sid_to_array_unique(result, &unix_group_sid, + &result->sids, + &result->num_sids); + if (!NT_STATUS_IS_OK(status)) { result->sam_account = NULL; /* Don't free on error exit. */ TALLOC_FREE(result); - return NT_STATUS_NO_MEMORY; + return status; } } @@ -895,9 +897,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, "for gid %d!\n", gids[i])); continue; } - if (!add_sid_to_array_unique(tmp_ctx, &unix_group_sid, - &group_sids, &num_group_sids )) { - result = NT_STATUS_NO_MEMORY; + result = add_sid_to_array_unique(tmp_ctx, &unix_group_sid, + &group_sids, &num_group_sids); + if (!NT_STATUS_IS_OK(result)) { goto done; } } @@ -1074,11 +1076,12 @@ NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info, return NT_STATUS_NO_SUCH_USER; } - if (!add_sid_to_array_unique(result, &u_sid, - &result->sids, - &result->num_sids)) { + status = add_sid_to_array_unique(result, &u_sid, + &result->sids, + &result->num_sids); + if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(result); - return NT_STATUS_NO_MEMORY; + return status; } /* For now we throw away the gids and convert via sid_to_gid diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c index 9ca5216af0..fc93060fc6 100644 --- a/source3/auth/token_util.c +++ b/source3/auth/token_util.c @@ -140,22 +140,22 @@ NTSTATUS add_aliases(const DOM_SID *domain_sid, if (!NT_STATUS_IS_OK(status)) { DEBUG(10, ("pdb_enum_alias_memberships failed: %s\n", nt_errstr(status))); - TALLOC_FREE(tmp_ctx); - return status; + goto done; } for (i=0; iuser_sids, - &token->num_sids)) { + status = add_sid_to_array_unique(token, &alias_sid, + &token->user_sids, + &token->num_sids); + if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("add_sid_to_array failed\n")); - TALLOC_FREE(tmp_ctx); - return NT_STATUS_NO_MEMORY; + goto done; } } +done: TALLOC_FREE(tmp_ctx); return NT_STATUS_OK; } @@ -166,6 +166,7 @@ NTSTATUS add_aliases(const DOM_SID *domain_sid, static NTSTATUS add_builtin_administrators( struct nt_user_token *token ) { DOM_SID domadm; + NTSTATUS status; /* nothing to do if we aren't in a domain */ @@ -186,9 +187,11 @@ static NTSTATUS add_builtin_administrators( struct nt_user_token *token ) /* Add Administrators if the user beloongs to Domain Admins */ if ( nt_token_check_sid( &domadm, token ) ) { - if (!add_sid_to_array(token, &global_sid_Builtin_Administrators, - &token->user_sids, &token->num_sids)) { - return NT_STATUS_NO_MEMORY; + status = add_sid_to_array(token, + &global_sid_Builtin_Administrators, + &token->user_sids, &token->num_sids); + if (!NT_STATUS_IS_OK(status)) { + return status; } } @@ -303,38 +306,48 @@ struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx, /* Add the user and primary group sid */ - if (!add_sid_to_array(result, user_sid, - &result->user_sids, &result->num_sids)) { + status = add_sid_to_array(result, user_sid, + &result->user_sids, &result->num_sids); + if (!NT_STATUS_IS_OK(status)) { return NULL; } /* For guest, num_groupsids may be zero. */ if (num_groupsids) { - if (!add_sid_to_array(result, &groupsids[0], - &result->user_sids, &result->num_sids)) { + status = add_sid_to_array(result, &groupsids[0], + &result->user_sids, + &result->num_sids); + if (!NT_STATUS_IS_OK(status)) { return NULL; } } /* Add in BUILTIN sids */ - if (!add_sid_to_array(result, &global_sid_World, - &result->user_sids, &result->num_sids)) { + status = add_sid_to_array(result, &global_sid_World, + &result->user_sids, &result->num_sids); + if (!NT_STATUS_IS_OK(status)) { return NULL; } - if (!add_sid_to_array(result, &global_sid_Network, - &result->user_sids, &result->num_sids)) { + status = add_sid_to_array(result, &global_sid_Network, + &result->user_sids, &result->num_sids); + if (!NT_STATUS_IS_OK(status)) { return NULL; } if (is_guest) { - if (!add_sid_to_array(result, &global_sid_Builtin_Guests, - &result->user_sids, &result->num_sids)) { + status = add_sid_to_array(result, &global_sid_Builtin_Guests, + &result->user_sids, + &result->num_sids); + if (!NT_STATUS_IS_OK(status)) { return NULL; } } else { - if (!add_sid_to_array(result, &global_sid_Authenticated_Users, - &result->user_sids, &result->num_sids)) { + status = add_sid_to_array(result, + &global_sid_Authenticated_Users, + &result->user_sids, + &result->num_sids); + if (!NT_STATUS_IS_OK(status)) { return NULL; } } @@ -346,8 +359,10 @@ struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx, * first group sid as primary above. */ for (i=1; iuser_sids, &result->num_sids)) { + status = add_sid_to_array_unique(result, &groupsids[i], + &result->user_sids, + &result->num_sids); + if (!NT_STATUS_IS_OK(status)) { return NULL; } } diff --git a/source3/groupdb/mapping_ldb.c b/source3/groupdb/mapping_ldb.c index ea46777598..05056eabd2 100644 --- a/source3/groupdb/mapping_ldb.c +++ b/source3/groupdb/mapping_ldb.c @@ -398,8 +398,8 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, goto failed; } string_to_sid(&alias, (char *)el->values[0].data); - if (!add_sid_to_array_unique(NULL, &alias, sids, num)) { - status = NT_STATUS_NO_MEMORY; + status = add_sid_to_array_unique(NULL, &alias, sids, num); + if (!NT_STATUS_IS_OK(status)) { goto failed; } } @@ -492,6 +492,7 @@ static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num) NULL }; int ret, i; + NTSTATUS status; struct ldb_result *res=NULL; struct ldb_dn *dn; struct ldb_message_element *el; @@ -524,14 +525,15 @@ static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num) for (i=0;inum_values;i++) { DOM_SID sid; string_to_sid(&sid, (const char *)el->values[i].data); - if (!add_sid_to_array_unique(NULL, &sid, sids, num)) { - talloc_free(dn); - return NT_STATUS_NO_MEMORY; + status = add_sid_to_array_unique(NULL, &sid, sids, num); + if (!NT_STATUS_IS_OK(status)) { + goto done; } } - talloc_free(dn); - return NT_STATUS_OK; +done: + talloc_free(dn); + return status; } /* diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c index 9adde40426..21a4f95383 100644 --- a/source3/groupdb/mapping_tdb.c +++ b/source3/groupdb/mapping_tdb.c @@ -414,8 +414,8 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, if (!string_to_sid(&alias, string_sid)) continue; - if (!add_sid_to_array_unique(NULL, &alias, sids, num)) { - status = NT_STATUS_NO_MEMORY; + status= add_sid_to_array_unique(NULL, &alias, sids, num); + if (!NT_STATUS_IS_OK(status)) { goto done; } } @@ -560,7 +560,10 @@ static int collect_aliasmem(TDB_CONTEXT *tdb_ctx, TDB_DATA key, TDB_DATA data, if (!string_to_sid(&member, member_string)) continue; - if (!add_sid_to_array(NULL, &member, closure->sids, closure->num)) { + if (!NT_STATUS_IS_OK(add_sid_to_array(NULL, &member, + closure->sids, + closure->num))) + { /* talloc fail. */ break; } diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c index 63fb462e32..509da80785 100644 --- a/source3/lib/privileges.c +++ b/source3/lib/privileges.c @@ -184,8 +184,10 @@ static int priv_traverse_fn(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *s return 0; } - if (!add_sid_to_array( priv->mem_ctx, &sid, &priv->sids.list, - &priv->sids.count )) { + if (!NT_STATUS_IS_OK(add_sid_to_array(priv->mem_ctx, &sid, + &priv->sids.list, + &priv->sids.count))) + { return 0; } diff --git a/source3/lib/util_reg_smbconf.c b/source3/lib/util_reg_smbconf.c index fa58f28d03..472fef7a2d 100644 --- a/source3/lib/util_reg_smbconf.c +++ b/source3/lib/util_reg_smbconf.c @@ -30,18 +30,21 @@ extern REGISTRY_OPS smbconf_reg_ops; */ NT_USER_TOKEN *registry_create_admin_token(TALLOC_CTX *mem_ctx) { + NTSTATUS status; NT_USER_TOKEN *token = NULL; /* fake a user token: builtin administrators sid and the * disk operators privilege is all we need to access the * registry... */ - if (!(token = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN))) { + token = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN); + if (token == NULL) { DEBUG(1, ("talloc failed\n")); goto done; } token->privileges = se_disk_operators; - if (!add_sid_to_array(token, &global_sid_Builtin_Administrators, - &token->user_sids, &token->num_sids)) { + status = add_sid_to_array(token, &global_sid_Builtin_Administrators, + &token->user_sids, &token->num_sids); + if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Error adding builtin administrators sid " "to fake token.\n")); goto done; diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index 222b32ed3a..37865238a5 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -573,20 +573,20 @@ DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src) Add SID to an array SIDs ********************************************************************/ -bool add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, - DOM_SID **sids, size_t *num) +NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + DOM_SID **sids, size_t *num) { *sids = TALLOC_REALLOC_ARRAY(mem_ctx, *sids, DOM_SID, (*num)+1); if (*sids == NULL) { *num = 0; - return False; + return NT_STATUS_NO_MEMORY; } sid_copy(&((*sids)[*num]), sid); *num += 1; - return True; + return NT_STATUS_OK; } @@ -594,14 +594,14 @@ bool add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, Add SID to an array SIDs ensuring that it is not already there ********************************************************************/ -bool add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid, - DOM_SID **sids, size_t *num_sids) +NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + DOM_SID **sids, size_t *num_sids) { size_t i; for (i=0; i<(*num_sids); i++) { if (sid_compare(sid, &(*sids)[i]) == 0) - return True; + return NT_STATUS_OK; } return add_sid_to_array(mem_ctx, sid, sids, num_sids); @@ -670,6 +670,7 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx, size_t *num_user_sids, bool include_user_group_rid) { + NTSTATUS status; DOM_SID sid; DOM_SID *sid_array = NULL; size_t num_sids = 0; @@ -677,35 +678,47 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx, if (include_user_group_rid) { - if (!sid_compose(&sid, &(info3->dom_sid.sid), - info3->user_rid) - || !add_sid_to_array(mem_ctx, &sid, - &sid_array, &num_sids)) { - DEBUG(3,("could not add user SID from rid 0x%x\n", - info3->user_rid)); + if (!sid_compose(&sid, &(info3->dom_sid.sid), info3->user_rid)) + { + DEBUG(3, ("could not compose user SID from rid 0x%x\n", + info3->user_rid)); return NT_STATUS_INVALID_PARAMETER; } + status = add_sid_to_array(mem_ctx, &sid, &sid_array, &num_sids); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(3, ("could not append user SID from rid 0x%x\n", + info3->user_rid)); + return status; + } - if (!sid_compose(&sid, &(info3->dom_sid.sid), - info3->group_rid) - || !add_sid_to_array(mem_ctx, &sid, - &sid_array, &num_sids)) { - DEBUG(3,("could not append additional group rid 0x%x\n", - info3->group_rid)); - + if (!sid_compose(&sid, &(info3->dom_sid.sid), info3->group_rid)) + { + DEBUG(3, ("could not compose group SID from rid 0x%x\n", + info3->group_rid)); return NT_STATUS_INVALID_PARAMETER; } + status = add_sid_to_array(mem_ctx, &sid, &sid_array, &num_sids); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(3, ("could not append group SID from rid 0x%x\n", + info3->group_rid)); + return status; + } } for (i = 0; i < info3->num_groups2; i++) { if (!sid_compose(&sid, &(info3->dom_sid.sid), - info3->gids[i].g_rid) - || !add_sid_to_array(mem_ctx, &sid, - &sid_array, &num_sids)) { - DEBUG(3,("could not append additional group rid 0x%x\n", - info3->gids[i].g_rid)); + info3->gids[i].g_rid)) + { + DEBUG(3, ("could not compose SID from additional group " + "rid 0x%x\n", info3->gids[i].g_rid)); return NT_STATUS_INVALID_PARAMETER; } + status = add_sid_to_array(mem_ctx, &sid, &sid_array, &num_sids); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(3, ("could not append SID from additional group " + "rid 0x%x\n", info3->gids[i].g_rid)); + return status; + } } /* Copy 'other' sids. We need to do sid filtering here to @@ -715,11 +728,12 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx, */ for (i = 0; i < info3->num_other_sids; i++) { - if (!add_sid_to_array(mem_ctx, &info3->other_sids[i].sid, - &sid_array, &num_sids)) { + status = add_sid_to_array(mem_ctx, &info3->other_sids[i].sid, + &sid_array, &num_sids); + if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("could not add SID to array: %s\n", sid_string_dbg(&info3->other_sids[i].sid))); - return NT_STATUS_NO_MEMORY; + return status; } } diff --git a/source3/libgpo/gpo_ldap.c b/source3/libgpo/gpo_ldap.c index 7c59e8e5dc..4e63b92e4e 100644 --- a/source3/libgpo/gpo_ldap.c +++ b/source3/libgpo/gpo_ldap.c @@ -643,9 +643,12 @@ ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads, token_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, 1); ADS_ERROR_HAVE_NO_MEMORY(token_sids); - if (!add_sid_to_array_unique(mem_ctx, &primary_group_sid, &token_sids, - &num_token_sids)) { - return ADS_ERROR(LDAP_NO_MEMORY); + status = ADS_ERROR_NT(add_sid_to_array_unique(mem_ctx, + &primary_group_sid, + &token_sids, + &num_token_sids)); + if (!ADS_ERR_OK(status)) { + return status; } for (i = 0; i < num_ad_token_sids; i++) { @@ -654,9 +657,12 @@ ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads, continue; } - if (!add_sid_to_array_unique(mem_ctx, &ad_token_sids[i], - &token_sids, &num_token_sids)) { - return ADS_ERROR(LDAP_NO_MEMORY); + status = ADS_ERROR_NT(add_sid_to_array_unique(mem_ctx, + &ad_token_sids[i], + &token_sids, + &num_token_sids)); + if (!ADS_ERR_OK(status)) { + return status; } } diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 205b178a93..28df56bdb1 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -2886,8 +2886,9 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods, /* This sid will be replaced later */ - if (!add_sid_to_array_unique(mem_ctx, &global_sid_NULL, pp_sids, &num_sids)) { - ret = NT_STATUS_NO_MEMORY; + ret = add_sid_to_array_unique(mem_ctx, &global_sid_NULL, pp_sids, + &num_sids); + if (!NT_STATUS_IS_OK(ret)) { goto done; } @@ -2926,9 +2927,9 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods, ret = NT_STATUS_NO_MEMORY; goto done; } - if (!add_sid_to_array_unique(mem_ctx, &sid, pp_sids, - &num_sids)) { - ret = NT_STATUS_NO_MEMORY; + ret = add_sid_to_array_unique(mem_ctx, &sid, pp_sids, + &num_sids); + if (!NT_STATUS_IS_OK(ret)) { goto done; } } @@ -3646,14 +3647,17 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods *methods, for (i=0; isid); sid_append_rid(&sid, alias_rids[i]); - if (!add_sid_to_array(state->mem_ctx, &sid, &sids, &num_sids)) { + result = add_sid_to_array(state->mem_ctx, &sid, &sids, + &num_sids); + if (!NT_STATUS_IS_OK(result)) { return WINBINDD_ERROR; } } @@ -832,8 +836,9 @@ static void gettoken_recvdomgroups(TALLOC_CTX *mem_ctx, bool success, state->sids = NULL; state->num_sids = 0; - if (!add_sid_to_array(mem_ctx, &state->user_sid, &state->sids, - &state->num_sids)) { + if (!NT_STATUS_IS_OK(add_sid_to_array(mem_ctx, &state->user_sid, + &state->sids, &state->num_sids))) + { DEBUG(0, ("Out of memory\n")); state->cont(state->private_data, False, NULL, 0); return; @@ -874,8 +879,11 @@ static void gettoken_recvaliases(void *private_data, bool success, } for (i=0; imem_ctx, &aliases[i], - &state->sids, &state->num_sids)) { + if (!NT_STATUS_IS_OK(add_sid_to_array(state->mem_ctx, + &aliases[i], + &state->sids, + &state->num_sids))) + { DEBUG(0, ("Out of memory\n")); state->cont(state->private_data, False, NULL, 0); return; diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c index 62e8d1c40b..6a704cf290 100644 --- a/source3/winbindd/winbindd_group.c +++ b/source3/winbindd/winbindd_group.c @@ -438,18 +438,15 @@ static NTSTATUS expand_groups( TALLOC_CTX *ctx, if ( name_types[j] == SID_NAME_DOM_GRP || name_types[j] == SID_NAME_ALIAS ) { - bool ret; - - ret = add_sid_to_array_unique( ctx, - &sid_mem[j], - &new_groups, - &new_groups_size ); - if ( !ret ) { - status = NT_STATUS_NO_MEMORY; + status = add_sid_to_array_unique(ctx, + &sid_mem[j], + &new_groups, + &new_groups_size); + if (NT_STATUS_IS_OK(status)) { goto out; } - continue; + continue; } } diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index 7a9014a82f..525096b0a2 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -273,12 +273,13 @@ static NTSTATUS check_info3_in_group(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - if (!add_sid_to_array(mem_ctx, &sid, - &require_membership_of_sid, - &num_require_membership_of_sid)) { + status = add_sid_to_array(mem_ctx, &sid, + &require_membership_of_sid, + &num_require_membership_of_sid); + if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("add_sid_to_array failed\n")); TALLOC_FREE(frame); - return NT_STATUS_NO_MEMORY; + return status; } } diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index cc12d4b7ea..dc48fdef8b 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -1304,19 +1304,22 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain, /* always add the primary group to the sid array */ sid_compose(&primary_group, &info3->dom_sid.sid, info3->user_rid); - if (!add_sid_to_array(mem_ctx, &primary_group, user_sids, &num_groups)) { + status = add_sid_to_array(mem_ctx, &primary_group, user_sids, + &num_groups); + if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(info3); - return NT_STATUS_NO_MEMORY; + return status; } for (i=0; inum_groups; i++) { sid_copy(&group_sid, &info3->dom_sid.sid); sid_append_rid(&group_sid, info3->gids[i].g_rid); - if (!add_sid_to_array(mem_ctx, &group_sid, user_sids, - &num_groups)) { + status = add_sid_to_array(mem_ctx, &group_sid, user_sids, + &num_groups); + if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(info3); - return NT_STATUS_NO_MEMORY; + return status; } } @@ -1328,11 +1331,11 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain, if (info3->other_sids_attrib[i] & SE_GROUP_RESOURCE) continue; - if (!add_sid_to_array(mem_ctx, &info3->other_sids[i].sid, - user_sids, &num_groups)) - { + status = add_sid_to_array(mem_ctx, &info3->other_sids[i].sid, + user_sids, &num_groups); + if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(info3); - return NT_STATUS_NO_MEMORY; + return status; } } -- cgit From f269ed866d01b9924264941268d902b893fbac83 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 00:25:27 +0100 Subject: Move content of comment. Michael (This used to be commit ed4dd00c5ae8e4995ace9326f915ae4bd15d96b3) --- source3/lib/util_reg_smbconf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/lib/util_reg_smbconf.c b/source3/lib/util_reg_smbconf.c index 472fef7a2d..5fb862ac35 100644 --- a/source3/lib/util_reg_smbconf.c +++ b/source3/lib/util_reg_smbconf.c @@ -26,16 +26,16 @@ extern REGISTRY_OPS smbconf_reg_ops; /* * create a fake token just with enough rights to - * locally access the registry. + * locally access the registry: + * + * - builtin administrators sid + * - disk operators privilege */ NT_USER_TOKEN *registry_create_admin_token(TALLOC_CTX *mem_ctx) { NTSTATUS status; NT_USER_TOKEN *token = NULL; - /* fake a user token: builtin administrators sid and the - * disk operators privilege is all we need to access the - * registry... */ token = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN); if (token == NULL) { DEBUG(1, ("talloc failed\n")); -- cgit From 22068a0c167b27cf1d74a32ac516df25dce0f70a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 01:17:13 +0100 Subject: Change registry_create_admin_token() to return NTSTATUS. Michael (This used to be commit 9cd30fb25c42e79946b5140994d0bf2ef4c62f90) --- source3/lib/util_reg_smbconf.c | 13 +++++++++++-- source3/libnet/libnet_conf.c | 8 +++----- source3/param/loadparm.c | 7 ++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/source3/lib/util_reg_smbconf.c b/source3/lib/util_reg_smbconf.c index 5fb862ac35..6452b0b15b 100644 --- a/source3/lib/util_reg_smbconf.c +++ b/source3/lib/util_reg_smbconf.c @@ -31,14 +31,20 @@ extern REGISTRY_OPS smbconf_reg_ops; * - builtin administrators sid * - disk operators privilege */ -NT_USER_TOKEN *registry_create_admin_token(TALLOC_CTX *mem_ctx) +NTSTATUS registry_create_admin_token(TALLOC_CTX *mem_ctx, + NT_USER_TOKEN **ptoken) { NTSTATUS status; NT_USER_TOKEN *token = NULL; + if (ptoken == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + token = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN); if (token == NULL) { DEBUG(1, ("talloc failed\n")); + status = NT_STATUS_NO_MEMORY; goto done; } token->privileges = se_disk_operators; @@ -49,8 +55,11 @@ NT_USER_TOKEN *registry_create_admin_token(TALLOC_CTX *mem_ctx) "to fake token.\n")); goto done; } + + *ptoken = token; + done: - return token; + return status; } /* diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index c8e55a70b2..d0ef6eb0e6 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -87,7 +87,7 @@ static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx, struct registry_key **key) { WERROR werr = WERR_OK; - NT_USER_TOKEN *token; + NT_USER_TOKEN *token = NULL; TALLOC_CTX *tmp_ctx = NULL; if (path == NULL) { @@ -109,11 +109,9 @@ static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx, goto done; } - token = registry_create_admin_token(tmp_ctx); - if (token == NULL) { + werr = ntstatus_to_werror(registry_create_admin_token(tmp_ctx, &token)); + if (W_ERROR_IS_OK(werr)) { DEBUG(1, ("Error creating admin token\n")); - /* what is the appropriate error code here? */ - werr = WERR_CAN_NOT_COMPLETE; goto done; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 358fabfb2a..9700cd1320 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -3529,7 +3529,7 @@ static bool process_registry_globals(bool (*pfunc)(const char *, const char *)) char *valname = NULL; char *valstr = NULL; uint32 idx = 0; - NT_USER_TOKEN *token; + NT_USER_TOKEN *token = NULL; ctx = talloc_init("process_registry_globals"); if (!ctx) { @@ -3543,8 +3543,9 @@ static bool process_registry_globals(bool (*pfunc)(const char *, const char *)) goto done; } - if (!(token = registry_create_admin_token(ctx))) { - DEBUG(1, ("Error creating admin token\n")); + werr = ntstatus_to_werror(registry_create_admin_token(ctx, &token)); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, ("Error creating admin token: %s\n",dos_errstr(werr))); goto done; } -- cgit From 2371d31f64e8b1238e86d86c5b6f20ac5a842799 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 8 Jan 2008 18:44:19 -0800 Subject: Fix resource leak found by coverity (CID 521). Jeremy. (This used to be commit acfb233acc7324b8d431d5cb777a1933d173b3dc) --- source3/smbd/reply.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 27f380a627..a796a3193b 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -6355,6 +6355,7 @@ void reply_copy(struct smb_request *req) directory, dname); if (!fname) { + CloseDir(dir_hnd); reply_nterror(req, NT_STATUS_NO_MEMORY); END_PROFILE(SMBcopy); return; @@ -6365,6 +6366,7 @@ void reply_copy(struct smb_request *req) continue; } if (!destname) { + CloseDir(dir_hnd); reply_nterror(req, NT_STATUS_NO_MEMORY); END_PROFILE(SMBcopy); return; @@ -6372,6 +6374,7 @@ void reply_copy(struct smb_request *req) status = check_name(conn, fname); if (!NT_STATUS_IS_OK(status)) { + CloseDir(dir_hnd); reply_nterror(req, status); END_PROFILE(SMBcopy); return; @@ -6379,6 +6382,7 @@ void reply_copy(struct smb_request *req) status = check_name(conn, destname); if (!NT_STATUS_IS_OK(status)) { + CloseDir(dir_hnd); reply_nterror(req, status); END_PROFILE(SMBcopy); return; -- cgit From b47d491489ae6161f0c04378ed15dc1a54a166e1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 8 Jan 2008 18:48:04 -0800 Subject: Fix CID 460 - resource leak on error. Jeremy. (This used to be commit d61831164b482d02e0eef3c28aeed93d3e44433f) --- source3/auth/auth_server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c index 9f90ef8ccd..095f0b9fb8 100644 --- a/source3/auth/auth_server.c +++ b/source3/auth/auth_server.c @@ -75,6 +75,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx) connection (tridge) */ if (!grab_server_mutex(desthost)) { + cli_shutdown(cli); return NULL; } -- cgit From 3eb2cfc1ad3e7592ce3711265507a6a1c4253280 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 8 Jan 2008 18:51:55 -0800 Subject: Fix CID 461 - resource leak on error. Jeremy. (This used to be commit eea07b0c83985af60395f8a31de5bac4e5398cff) --- source3/libsmb/clidfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 77419b4a1a..16582f8049 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -156,6 +156,9 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx, /* have to open a new connection */ if (!(c=cli_initialise()) || (cli_set_port(c, port) != port)) { d_printf("Connection to %s failed\n", server_n); + if (c) { + cli_shutdown(c); + } return NULL; } status = cli_connect(c, server_n, &ss); @@ -163,6 +166,7 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx, d_printf("Connection to %s failed (Error %s)\n", server_n, nt_errstr(status)); + cli_shutdown(c); return NULL; } -- cgit From 3f55798be06af3923820aa047b21b9f7a030a2c3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 8 Jan 2008 22:48:22 -0800 Subject: ensure uni_name.buffer is initialised merge from http://samba.org/~tridge/3_0-ctdb Jeremy. (This used to be commit dec77b387cd9024eb33bb0617c7543814e9c9212) --- source3/smbd/notify.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 7287210802..5c26cac219 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -65,6 +65,8 @@ static bool notify_marshall_changes(int num_changes, int i; UNISTR uni_name; + uni_name.buffer = NULL; + for (i=0; i Date: Wed, 9 Jan 2008 07:59:12 +0100 Subject: ensure uni_name.buffer is initialised merge from http://samba.org/~tridge/3_0-ctdb (This used to be commit 2938e74dea1695c813d6220a839b248dbc3b1d8f) --- source3/smbd/notify.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 7287210802..5c26cac219 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -65,6 +65,8 @@ static bool notify_marshall_changes(int num_changes, int i; UNISTR uni_name; + uni_name.buffer = NULL; + for (i=0; i Date: Wed, 9 Jan 2008 02:32:56 +0100 Subject: Ignore test directory. Michael (This used to be commit 0aef0e38c26c59b779b5d7b48ef41e4aaa2fa729) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 00ad9c82c0..71177b6c80 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ source/winbindd/winbindd_proto.h source/cscope.out source/torture.tdb source/pkgconfig/*.pc +source/st -- cgit From bf08d19c23a9646c741329190f497ae247ffa376 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 02:35:34 +0100 Subject: git-ignore generated files under examples/VFS/ Michael (This used to be commit 7b3724fe861408c393e94260f8a8cc504f2a48d0) --- .gitignore | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 71177b6c80..f11de08838 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,12 @@ source/cscope.out source/torture.tdb source/pkgconfig/*.pc source/st +examples/VFS/Makefile +examples/VFS/config.log +examples/VFS/config.status +examples/VFS/configure +examples/VFS/module_config.h +examples/VFS/module_config.h.in +examples/VFS/shadow_copy_test.so +examples/VFS/skel_opaque.so +examples/VFS/skel_transparent.so -- cgit From af02de700da25c964ef54968b89c6a0b11489b27 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 16:57:16 +0100 Subject: Fix build warning for libsmbclient example. Guenther (This used to be commit 8f411753b2130e9c1f260a15d031f57ba07b62a1) --- examples/libsmbclient/tree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/libsmbclient/tree.c b/examples/libsmbclient/tree.c index d5a71e2868..6e34cd0562 100644 --- a/examples/libsmbclient/tree.c +++ b/examples/libsmbclient/tree.c @@ -24,6 +24,8 @@ #include #include +#include +#include #include #include "libsmbclient.h" -- cgit From ba922343dbfbdcc9a43e540051853c7877b21de1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 8 Jan 2008 18:59:57 +0100 Subject: Add libnet_join_derive_salting_principal(). Guenther (This used to be commit 95129a28cfa57d8e5bd767b92f065abd1d32a569) --- source3/libnet/libnet_join.c | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 454c1f29fb..d139fa04a1 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -438,6 +438,57 @@ static bool libnet_join_create_keytab(TALLOC_CTX *mem_ctx, return true; } +#ifdef HAVE_LDAP + +/**************************************************************** +****************************************************************/ + +static bool libnet_join_derive_salting_principal(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + uint32_t domain_func; + ADS_STATUS status; + const char *salt = NULL; + char *std_salt = NULL; + + status = ads_domain_func_level(r->in.ads, &domain_func); + if (!ADS_ERR_OK(status)) { + libnet_join_set_error_string(mem_ctx, r, + "Failed to determine domain functional level!\n"); + return false; + } + + std_salt = kerberos_standard_des_salt(); + if (!std_salt) { + libnet_join_set_error_string(mem_ctx, r, + "failed to obtain standard DES salt\n"); + return false; + } + + salt = talloc_strdup(mem_ctx, std_salt); + if (!salt) { + return false; + } + + SAFE_FREE(std_salt); + + if (domain_func == DS_DOMAIN_FUNCTION_2000) { + char *upn; + + upn = ads_get_upn(r->in.ads, mem_ctx, + r->in.machine_name); + if (upn) { + salt = talloc_strdup(mem_ctx, upn); + if (!salt) { + return false; + } + } + } + + return kerberos_secrets_store_des_salt(salt); +} +#endif + /**************************************************************** ****************************************************************/ @@ -1020,6 +1071,10 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, ads_errstr(ads_status)); return WERR_GENERAL_FAILURE; } + + if (!libnet_join_derive_salting_principal(mem_ctx, r)) { + return WERR_GENERAL_FAILURE; + } #endif if (!libnet_join_create_keytab(mem_ctx, r)) { libnet_join_set_error_string(mem_ctx, r, -- cgit From c16a00b0af1fe1268dd798254ffd2a9501cf0e17 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Jan 2008 10:29:34 +0100 Subject: Replace an uninitialized variable Reported by the IBM checker (This used to be commit 48f61e4b9fce5ea4f4bc3cf55530bb757c0def07) --- source3/smbd/open.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 4abe017380..6aef99ff0e 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2845,6 +2845,8 @@ NTSTATUS create_file(connection_struct *conn, goto fail; } + SET_STAT_INVALID(sbuf); + goto done; } } -- cgit From 059be4dda06b51d04ed33c752d688ce46018fbdd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 8 Jan 2008 10:17:05 +0100 Subject: Reduce stat cache size default Now that we have a LRU scheme for the stat cache we can live with a lot less (This used to be commit 9e736aab07b91744d4c14a55f6f7c55f51dd80f6) --- source3/param/loadparm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 9700cd1320..eaf19b746a 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1588,7 +1588,7 @@ static void init_globals(bool first_time_only) Globals.bNTPipeSupport = True; /* Do NT pipes by default. */ Globals.bNTStatusSupport = True; /* Use NT status by default. */ Globals.bStatCache = True; /* use stat cache by default */ - Globals.iMaxStatCacheSize = 1024; /* one Meg by default. */ + Globals.iMaxStatCacheSize = 256; /* 256k by default */ Globals.restrict_anonymous = 0; Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */ Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */ -- cgit From 79180e65639e1ddf8aa0f55688de98a51c8dcbfa Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 11:22:29 +0100 Subject: Fix memory handling in torture/cmd_vfs.c:cmd_open and don't leak fsp_name. Michael (This used to be commit f93fc818143a7442a6e8a90f16f60c536a5b8f9e) --- source3/torture/cmd_vfs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index fbf9c3c9e3..e349df6061 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -279,14 +279,27 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c } fsp = SMB_MALLOC_P(struct files_struct); + if (fsp == NULL) { + return NT_STATUS_NO_MEMORY; + } fsp->fsp_name = SMB_STRDUP(argv[1]); + if (fsp->fsp_name == NULL) { + SAFE_FREE(fsp); + return NT_STATUS_NO_MEMORY; + } fsp->fh = SMB_MALLOC_P(struct fd_handle); + if (fsp->fh == NULL) { + SAFE_FREE(fsp->fsp_name); + SAFE_FREE(fsp); + return NT_STATUS_NO_MEMORY; + } fsp->conn = vfs->conn; fsp->fh->fd = SMB_VFS_OPEN(vfs->conn, argv[1], fsp, flags, mode); if (fsp->fh->fd == -1) { printf("open: error=%d (%s)\n", errno, strerror(errno)); SAFE_FREE(fsp->fh); + SAFE_FREE(fsp->fsp_name); SAFE_FREE(fsp); return NT_STATUS_UNSUCCESSFUL; } -- cgit From 28ac552381e1e9e115fa08cd6743ec764ca84124 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 9 Jan 2008 11:59:11 +0100 Subject: Re-run make idl. The pidl generated code now fully complies to coding standards. Guenther (This used to be commit 3d34c87612138e4457e824e1a6e3981d1c3fe238) --- source3/librpc/gen_ndr/cli_dfs.c | 448 +++++++-- source3/librpc/gen_ndr/cli_dfs.h | 149 ++- source3/librpc/gen_ndr/cli_echo.c | 179 +++- source3/librpc/gen_ndr/cli_echo.h | 49 +- source3/librpc/gen_ndr/cli_epmapper.c | 152 ++- source3/librpc/gen_ndr/cli_epmapper.h | 48 +- source3/librpc/gen_ndr/cli_eventlog.c | 403 ++++++-- source3/librpc/gen_ndr/cli_eventlog.h | 91 +- source3/librpc/gen_ndr/cli_initshutdown.c | 63 +- source3/librpc/gen_ndr/cli_initshutdown.h | 24 +- source3/librpc/gen_ndr/cli_lsa.c | 1495 ++++++++++++++++++++++------- source3/librpc/gen_ndr/cli_lsa.h | 429 +++++++-- source3/librpc/gen_ndr/cli_netlogon.c | 966 +++++++++++++++---- source3/librpc/gen_ndr/cli_netlogon.h | 355 ++++++- source3/librpc/gen_ndr/cli_srvsvc.c | 1104 ++++++++++++++++----- source3/librpc/gen_ndr/cli_srvsvc.h | 402 ++++++-- source3/librpc/gen_ndr/cli_svcctl.c | 939 ++++++++++++++---- source3/librpc/gen_ndr/cli_svcctl.h | 367 ++++++- source3/librpc/gen_ndr/cli_unixinfo.c | 91 +- source3/librpc/gen_ndr/cli_unixinfo.h | 26 +- source3/librpc/gen_ndr/cli_winreg.c | 715 +++++++++++--- source3/librpc/gen_ndr/cli_winreg.h | 260 ++++- source3/librpc/gen_ndr/cli_wkssvc.c | 660 ++++++++++--- source3/librpc/gen_ndr/cli_wkssvc.h | 257 ++++- 24 files changed, 7842 insertions(+), 1830 deletions(-) diff --git a/source3/librpc/gen_ndr/cli_dfs.c b/source3/librpc/gen_ndr/cli_dfs.c index 1cd085eaec..9078ce7bba 100644 --- a/source3/librpc/gen_ndr/cli_dfs.c +++ b/source3/librpc/gen_ndr/cli_dfs.c @@ -6,24 +6,33 @@ #include "includes.h" #include "librpc/gen_ndr/cli_dfs.h" -NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum dfs_ManagerVersion *version) +NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + enum dfs_ManagerVersion *version) { struct dfs_GetManagerVersion r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_GetManagerVersion, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_GETMANAGERVERSION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_GETMANAGERVERSION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_GetManagerVersion, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -36,7 +45,14 @@ NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, TALLOC_CTX *m return NT_STATUS_OK; } -NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share, const char *comment, uint32_t flags, WERROR *werror) +NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *path, + const char *server, + const char *share, + const char *comment, + uint32_t flags, + WERROR *werror) { struct dfs_Add r; NTSTATUS status; @@ -48,17 +64,24 @@ NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const r.in.comment = comment; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Add, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_ADD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Add, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -74,7 +97,12 @@ NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, WERROR *werror) +NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *dfs_entry_path, + const char *servername, + const char *sharename, + WERROR *werror) { struct dfs_Remove r; NTSTATUS status; @@ -84,17 +112,24 @@ NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, con r.in.servername = servername; r.in.sharename = sharename; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Remove, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_REMOVE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Remove, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -110,7 +145,14 @@ NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, con return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, uint32_t level, union dfs_Info *info, WERROR *werror) +NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *dfs_entry_path, + const char *servername, + const char *sharename, + uint32_t level, + union dfs_Info *info, + WERROR *werror) { struct dfs_SetInfo r; NTSTATUS status; @@ -122,17 +164,24 @@ NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co r.in.level = level; r.in.info = info; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_SetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_SETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_SETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_SetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -148,7 +197,14 @@ NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, uint32_t level, union dfs_Info *info, WERROR *werror) +NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *dfs_entry_path, + const char *servername, + const char *sharename, + uint32_t level, + union dfs_Info *info, + WERROR *werror) { struct dfs_GetInfo r; NTSTATUS status; @@ -159,17 +215,24 @@ NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co r.in.sharename = sharename; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_GetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_GETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_GETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_GetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -186,7 +249,13 @@ NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, co return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total, WERROR *werror) +NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t level, + uint32_t bufsize, + struct dfs_EnumStruct *info, + uint32_t *total, + WERROR *werror) { struct dfs_Enum r; NTSTATUS status; @@ -197,17 +266,24 @@ NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint3 r.in.info = info; r.in.total = total; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Enum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_ENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Enum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -229,24 +305,33 @@ NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint3 return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct dfs_Rename r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Rename, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_RENAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_RENAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Rename, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -262,24 +347,33 @@ NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WER return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct dfs_Move r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Move, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MOVE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_MOVE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Move, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -295,24 +389,33 @@ NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERRO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct dfs_ManagerGetConfigInfo r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_ManagerGetConfigInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MANAGERGETCONFIGINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_MANAGERGETCONFIGINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_ManagerGetConfigInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -328,24 +431,33 @@ NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct dfs_ManagerSendSiteInfo r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_ManagerSendSiteInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MANAGERSENDSITEINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_MANAGERSENDSITEINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_ManagerSendSiteInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -361,7 +473,18 @@ NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *dns_servername, const char *dfsname, const char *rootshare, const char *comment, const char *dfs_config_dn, uint8_t unknown1, uint32_t flags, struct dfs_UnknownStruct **unknown2, WERROR *werror) +NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *dns_servername, + const char *dfsname, + const char *rootshare, + const char *comment, + const char *dfs_config_dn, + uint8_t unknown1, + uint32_t flags, + struct dfs_UnknownStruct **unknown2, + WERROR *werror) { struct dfs_AddFtRoot r; NTSTATUS status; @@ -377,17 +500,24 @@ NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.flags = flags; r.in.unknown2 = unknown2; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_AddFtRoot, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADDFTROOT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_ADDFTROOT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_AddFtRoot, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -406,7 +536,15 @@ NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *dns_servername, const char *dfsname, const char *rootshare, uint32_t flags, struct dfs_UnknownStruct **unknown, WERROR *werror) +NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *dns_servername, + const char *dfsname, + const char *rootshare, + uint32_t flags, + struct dfs_UnknownStruct **unknown, + WERROR *werror) { struct dfs_RemoveFtRoot r; NTSTATUS status; @@ -419,17 +557,24 @@ NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.flags = flags; r.in.unknown = unknown; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_RemoveFtRoot, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVEFTROOT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_REMOVEFTROOT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_RemoveFtRoot, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -448,7 +593,13 @@ NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, const char *comment, uint32_t flags, WERROR *werror) +NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *rootshare, + const char *comment, + uint32_t flags, + WERROR *werror) { struct dfs_AddStdRoot r; NTSTATUS status; @@ -459,17 +610,24 @@ NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.comment = comment; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_AddStdRoot, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADDSTDROOT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_ADDSTDROOT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_AddStdRoot, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -485,7 +643,12 @@ NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, uint32_t flags, WERROR *werror) +NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *rootshare, + uint32_t flags, + WERROR *werror) { struct dfs_RemoveStdRoot r; NTSTATUS status; @@ -495,17 +658,24 @@ NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.rootshare = rootshare; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_RemoveStdRoot, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVESTDROOT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_REMOVESTDROOT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_RemoveStdRoot, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -521,7 +691,11 @@ NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, uint32_t flags, WERROR *werror) +NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + uint32_t flags, + WERROR *werror) { struct dfs_ManagerInitialize r; NTSTATUS status; @@ -530,17 +704,24 @@ NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.servername = servername; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_ManagerInitialize, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_MANAGERINITIALIZE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_MANAGERINITIALIZE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_ManagerInitialize, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -556,7 +737,13 @@ NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, const char *comment, const char *store, WERROR *werror) +NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *rootshare, + const char *comment, + const char *store, + WERROR *werror) { struct dfs_AddStdRootForced r; NTSTATUS status; @@ -567,17 +754,24 @@ NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.comment = comment; r.in.store = store; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_AddStdRootForced, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADDSTDROOTFORCED, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_ADDSTDROOTFORCED, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_AddStdRootForced, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -593,24 +787,33 @@ NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, TALLOC_CTX *me return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct dfs_GetDcAddress r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_GetDcAddress, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_GETDCADDRESS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_GETDCADDRESS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_GetDcAddress, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -626,24 +829,33 @@ NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct dfs_SetDcAddress r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_SetDcAddress, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_SETDCADDRESS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_SETDCADDRESS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_SetDcAddress, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -659,7 +871,11 @@ NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, WERROR *werror) +NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *rootshare, + WERROR *werror) { struct dfs_FlushFtTable r; NTSTATUS status; @@ -668,17 +884,24 @@ NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.servername = servername; r.in.rootshare = rootshare; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_FlushFtTable, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_FLUSHFTTABLE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_FLUSHFTTABLE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_FlushFtTable, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -694,24 +917,33 @@ NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct dfs_Add2 r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Add2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ADD2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_ADD2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Add2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -727,24 +959,33 @@ NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERRO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct dfs_Remove2 r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Remove2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_REMOVE2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_REMOVE2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Remove2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -760,7 +1001,14 @@ NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WE return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_name, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total, WERROR *werror) +NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *dfs_name, + uint32_t level, + uint32_t bufsize, + struct dfs_EnumStruct *info, + uint32_t *total, + WERROR *werror) { struct dfs_EnumEx r; NTSTATUS status; @@ -772,17 +1020,24 @@ NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, con r.in.info = info; r.in.total = total; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_EnumEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_ENUMEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_ENUMEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_EnumEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -804,24 +1059,33 @@ NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, con return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct dfs_SetInfo2 r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_SetInfo2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETDFS, &ndr_table_netdfs, NDR_DFS_SETINFO2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETDFS, + &ndr_table_netdfs, + NDR_DFS_SETINFO2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_SetInfo2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_dfs.h b/source3/librpc/gen_ndr/cli_dfs.h index 1b03fbf070..cdd0978bb4 100644 --- a/source3/librpc/gen_ndr/cli_dfs.h +++ b/source3/librpc/gen_ndr/cli_dfs.h @@ -1,27 +1,130 @@ #include "librpc/gen_ndr/ndr_dfs.h" #ifndef __CLI_NETDFS__ #define __CLI_NETDFS__ -NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum dfs_ManagerVersion *version); -NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *path, const char *server, const char *share, const char *comment, uint32_t flags, WERROR *werror); -NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, WERROR *werror); -NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, uint32_t level, union dfs_Info *info, WERROR *werror); -NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_entry_path, const char *servername, const char *sharename, uint32_t level, union dfs_Info *info, WERROR *werror); -NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total, WERROR *werror); -NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *dns_servername, const char *dfsname, const char *rootshare, const char *comment, const char *dfs_config_dn, uint8_t unknown1, uint32_t flags, struct dfs_UnknownStruct **unknown2, WERROR *werror); -NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *dns_servername, const char *dfsname, const char *rootshare, uint32_t flags, struct dfs_UnknownStruct **unknown, WERROR *werror); -NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, const char *comment, uint32_t flags, WERROR *werror); -NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, uint32_t flags, WERROR *werror); -NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, uint32_t flags, WERROR *werror); -NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, const char *comment, const char *store, WERROR *werror); -NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *servername, const char *rootshare, WERROR *werror); -NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *dfs_name, uint32_t level, uint32_t bufsize, struct dfs_EnumStruct *info, uint32_t *total, WERROR *werror); -NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); +NTSTATUS rpccli_dfs_GetManagerVersion(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + enum dfs_ManagerVersion *version); +NTSTATUS rpccli_dfs_Add(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *path, + const char *server, + const char *share, + const char *comment, + uint32_t flags, + WERROR *werror); +NTSTATUS rpccli_dfs_Remove(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *dfs_entry_path, + const char *servername, + const char *sharename, + WERROR *werror); +NTSTATUS rpccli_dfs_SetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *dfs_entry_path, + const char *servername, + const char *sharename, + uint32_t level, + union dfs_Info *info, + WERROR *werror); +NTSTATUS rpccli_dfs_GetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *dfs_entry_path, + const char *servername, + const char *sharename, + uint32_t level, + union dfs_Info *info, + WERROR *werror); +NTSTATUS rpccli_dfs_Enum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t level, + uint32_t bufsize, + struct dfs_EnumStruct *info, + uint32_t *total, + WERROR *werror); +NTSTATUS rpccli_dfs_Rename(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dfs_Move(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dfs_ManagerGetConfigInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dfs_ManagerSendSiteInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dfs_AddFtRoot(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *dns_servername, + const char *dfsname, + const char *rootshare, + const char *comment, + const char *dfs_config_dn, + uint8_t unknown1, + uint32_t flags, + struct dfs_UnknownStruct **unknown2, + WERROR *werror); +NTSTATUS rpccli_dfs_RemoveFtRoot(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *dns_servername, + const char *dfsname, + const char *rootshare, + uint32_t flags, + struct dfs_UnknownStruct **unknown, + WERROR *werror); +NTSTATUS rpccli_dfs_AddStdRoot(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *rootshare, + const char *comment, + uint32_t flags, + WERROR *werror); +NTSTATUS rpccli_dfs_RemoveStdRoot(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *rootshare, + uint32_t flags, + WERROR *werror); +NTSTATUS rpccli_dfs_ManagerInitialize(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + uint32_t flags, + WERROR *werror); +NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *rootshare, + const char *comment, + const char *store, + WERROR *werror); +NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *servername, + const char *rootshare, + WERROR *werror); +NTSTATUS rpccli_dfs_Add2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dfs_Remove2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_dfs_EnumEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *dfs_name, + uint32_t level, + uint32_t bufsize, + struct dfs_EnumStruct *info, + uint32_t *total, + WERROR *werror); +NTSTATUS rpccli_dfs_SetInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); #endif /* __CLI_NETDFS__ */ diff --git a/source3/librpc/gen_ndr/cli_echo.c b/source3/librpc/gen_ndr/cli_echo.c index 2d6187a937..d2ef574821 100644 --- a/source3/librpc/gen_ndr/cli_echo.c +++ b/source3/librpc/gen_ndr/cli_echo.c @@ -6,7 +6,10 @@ #include "includes.h" #include "librpc/gen_ndr/cli_echo.h" -NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t in_data, uint32_t *out_data) +NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t in_data, + uint32_t *out_data) { struct echo_AddOne r; NTSTATUS status; @@ -14,17 +17,24 @@ NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, ui /* In parameters */ r.in.in_data = in_data; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_AddOne, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_ADDONE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_ADDONE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_AddOne, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -37,7 +47,11 @@ NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, ui return NT_STATUS_OK; } -NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *in_data, uint8_t *out_data) +NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t len, + uint8_t *in_data, + uint8_t *out_data) { struct echo_EchoData r; NTSTATUS status; @@ -46,17 +60,24 @@ NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.len = len; r.in.in_data = in_data; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_EchoData, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_ECHODATA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_ECHODATA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_EchoData, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -69,7 +90,10 @@ NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data) +NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t len, + uint8_t *data) { struct echo_SinkData r; NTSTATUS status; @@ -78,17 +102,24 @@ NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.len = len; r.in.data = data; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_SinkData, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_SINKDATA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_SINKDATA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_SinkData, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -100,7 +131,10 @@ NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data) +NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t len, + uint8_t *data) { struct echo_SourceData r; NTSTATUS status; @@ -108,17 +142,24 @@ NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx /* In parameters */ r.in.len = len; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_SourceData, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_SOURCEDATA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_SOURCEDATA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_SourceData, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -131,7 +172,10 @@ NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return NT_STATUS_OK; } -NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *s1, const char **s2) +NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *s1, + const char **s2) { struct echo_TestCall r; NTSTATUS status; @@ -139,17 +183,24 @@ NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, /* In parameters */ r.in.s1 = s1; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestCall, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTCALL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_TESTCALL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestCall, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -162,7 +213,10 @@ NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t level, union echo_Info *info) +NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t level, + union echo_Info *info) { struct echo_TestCall2 r; NTSTATUS status; @@ -170,17 +224,24 @@ NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, /* In parameters */ r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestCall2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTCALL2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_TESTCALL2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestCall2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -193,7 +254,9 @@ NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return r.out.result; } -NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t seconds) +NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t seconds) { struct echo_TestSleep r; NTSTATUS status; @@ -201,17 +264,24 @@ NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, /* In parameters */ r.in.seconds = seconds; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestSleep, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTSLEEP, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_TESTSLEEP, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestSleep, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -223,7 +293,11 @@ NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3) +NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + enum echo_Enum1 *foo1, + struct echo_Enum2 *foo2, + union echo_Enum3 *foo3) { struct echo_TestEnum r; NTSTATUS status; @@ -233,17 +307,24 @@ NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.foo2 = foo2; r.in.foo3 = foo3; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_TESTENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -258,7 +339,9 @@ NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct echo_Surrounding *data) +NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct echo_Surrounding *data) { struct echo_TestSurrounding r; NTSTATUS status; @@ -266,17 +349,24 @@ NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *me /* In parameters */ r.in.data = data; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestSurrounding, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTSURROUNDING, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_TESTSURROUNDING, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -289,7 +379,9 @@ NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *me return NT_STATUS_OK; } -NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t ***data) +NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t ***data) { struct echo_TestDoublePointer r; NTSTATUS status; @@ -297,17 +389,24 @@ NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX * /* In parameters */ r.in.data = data; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, &ndr_table_rpcecho, NDR_ECHO_TESTDOUBLEPOINTER, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_RPCECHO, + &ndr_table_rpcecho, + NDR_ECHO_TESTDOUBLEPOINTER, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_echo.h b/source3/librpc/gen_ndr/cli_echo.h index d7e7f31704..e682004c16 100644 --- a/source3/librpc/gen_ndr/cli_echo.h +++ b/source3/librpc/gen_ndr/cli_echo.h @@ -1,14 +1,43 @@ #include "librpc/gen_ndr/ndr_echo.h" #ifndef __CLI_RPCECHO__ #define __CLI_RPCECHO__ -NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t in_data, uint32_t *out_data); -NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *in_data, uint8_t *out_data); -NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data); -NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data); -NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *s1, const char **s2); -NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t level, union echo_Info *info); -NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t seconds); -NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3); -NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct echo_Surrounding *data); -NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t ***data); +NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t in_data, + uint32_t *out_data); +NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t len, + uint8_t *in_data, + uint8_t *out_data); +NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t len, + uint8_t *data); +NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t len, + uint8_t *data); +NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *s1, + const char **s2); +NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t level, + union echo_Info *info); +NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t seconds); +NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + enum echo_Enum1 *foo1, + struct echo_Enum2 *foo2, + union echo_Enum3 *foo3); +NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct echo_Surrounding *data); +NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t ***data); #endif /* __CLI_RPCECHO__ */ diff --git a/source3/librpc/gen_ndr/cli_epmapper.c b/source3/librpc/gen_ndr/cli_epmapper.c index 1ac594ddd7..775e349cd2 100644 --- a/source3/librpc/gen_ndr/cli_epmapper.c +++ b/source3/librpc/gen_ndr/cli_epmapper.c @@ -6,7 +6,11 @@ #include "includes.h" #include "librpc/gen_ndr/cli_epmapper.h" -NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_ents, struct epm_entry_t *entries, uint32_t replace) +NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t num_ents, + struct epm_entry_t *entries, + uint32_t replace) { struct epm_Insert r; NTSTATUS status; @@ -16,17 +20,24 @@ NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin r.in.entries = entries; r.in.replace = replace; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_Insert, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_INSERT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EPMAPPER, + &ndr_table_epmapper, + NDR_EPM_INSERT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_Insert, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -38,7 +49,10 @@ NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin return NT_STATUS_OK; } -NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_ents, struct epm_entry_t *entries) +NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t num_ents, + struct epm_entry_t *entries) { struct epm_Delete r; NTSTATUS status; @@ -47,17 +61,24 @@ NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin r.in.num_ents = num_ents; r.in.entries = entries; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_Delete, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_DELETE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EPMAPPER, + &ndr_table_epmapper, + NDR_EPM_DELETE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_Delete, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -69,7 +90,16 @@ NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin return NT_STATUS_OK; } -NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t inquiry_type, struct GUID *object, struct rpc_if_id_t *interface_id, uint32_t vers_option, struct policy_handle *entry_handle, uint32_t max_ents, uint32_t *num_ents, struct epm_entry_t *entries) +NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t inquiry_type, + struct GUID *object, + struct rpc_if_id_t *interface_id, + uint32_t vers_option, + struct policy_handle *entry_handle, + uint32_t max_ents, + uint32_t *num_ents, + struct epm_entry_t *entries) { struct epm_Lookup r; NTSTATUS status; @@ -82,17 +112,24 @@ NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin r.in.entry_handle = entry_handle; r.in.max_ents = max_ents; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_Lookup, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_LOOKUP, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EPMAPPER, + &ndr_table_epmapper, + NDR_EPM_LOOKUP, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_Lookup, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -107,7 +144,14 @@ NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uin return NT_STATUS_OK; } -NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct GUID *object, struct epm_twr_t *map_tower, struct policy_handle *entry_handle, uint32_t max_towers, uint32_t *num_towers, struct epm_twr_p_t *towers) +NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct GUID *object, + struct epm_twr_t *map_tower, + struct policy_handle *entry_handle, + uint32_t max_towers, + uint32_t *num_towers, + struct epm_twr_p_t *towers) { struct epm_Map r; NTSTATUS status; @@ -118,17 +162,24 @@ NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct r.in.entry_handle = entry_handle; r.in.max_towers = max_towers; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_Map, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_MAP, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EPMAPPER, + &ndr_table_epmapper, + NDR_EPM_MAP, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_Map, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -143,7 +194,9 @@ NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct return NT_STATUS_OK; } -NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *entry_handle) +NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *entry_handle) { struct epm_LookupHandleFree r; NTSTATUS status; @@ -151,17 +204,24 @@ NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli, TALLOC_CTX *me /* In parameters */ r.in.entry_handle = entry_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_LookupHandleFree, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_LOOKUPHANDLEFREE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EPMAPPER, + &ndr_table_epmapper, + NDR_EPM_LOOKUPHANDLEFREE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_LookupHandleFree, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -174,7 +234,9 @@ NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli, TALLOC_CTX *me return NT_STATUS_OK; } -NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct GUID *epm_object) +NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct GUID *epm_object) { struct epm_InqObject r; NTSTATUS status; @@ -182,17 +244,24 @@ NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, /* In parameters */ r.in.epm_object = epm_object; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_InqObject, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_INQOBJECT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EPMAPPER, + &ndr_table_epmapper, + NDR_EPM_INQOBJECT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_InqObject, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -204,7 +273,11 @@ NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t object_speced, struct GUID *object, struct epm_twr_t *tower) +NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t object_speced, + struct GUID *object, + struct epm_twr_t *tower) { struct epm_MgmtDelete r; NTSTATUS status; @@ -214,17 +287,24 @@ NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.object = object; r.in.tower = tower; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_MgmtDelete, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_MGMTDELETE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EPMAPPER, + &ndr_table_epmapper, + NDR_EPM_MGMTDELETE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_MgmtDelete, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -236,24 +316,32 @@ NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct epm_MapAuth r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_MapAuth, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EPMAPPER, &ndr_table_epmapper, NDR_EPM_MAPAUTH, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EPMAPPER, + &ndr_table_epmapper, + NDR_EPM_MAPAUTH, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_MapAuth, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_epmapper.h b/source3/librpc/gen_ndr/cli_epmapper.h index 88e05a4600..fe99e6441c 100644 --- a/source3/librpc/gen_ndr/cli_epmapper.h +++ b/source3/librpc/gen_ndr/cli_epmapper.h @@ -1,12 +1,44 @@ #include "librpc/gen_ndr/ndr_epmapper.h" #ifndef __CLI_EPMAPPER__ #define __CLI_EPMAPPER__ -NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_ents, struct epm_entry_t *entries, uint32_t replace); -NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_ents, struct epm_entry_t *entries); -NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t inquiry_type, struct GUID *object, struct rpc_if_id_t *interface_id, uint32_t vers_option, struct policy_handle *entry_handle, uint32_t max_ents, uint32_t *num_ents, struct epm_entry_t *entries); -NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct GUID *object, struct epm_twr_t *map_tower, struct policy_handle *entry_handle, uint32_t max_towers, uint32_t *num_towers, struct epm_twr_p_t *towers); -NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *entry_handle); -NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct GUID *epm_object); -NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t object_speced, struct GUID *object, struct epm_twr_t *tower); -NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_epm_Insert(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t num_ents, + struct epm_entry_t *entries, + uint32_t replace); +NTSTATUS rpccli_epm_Delete(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t num_ents, + struct epm_entry_t *entries); +NTSTATUS rpccli_epm_Lookup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t inquiry_type, + struct GUID *object, + struct rpc_if_id_t *interface_id, + uint32_t vers_option, + struct policy_handle *entry_handle, + uint32_t max_ents, + uint32_t *num_ents, + struct epm_entry_t *entries); +NTSTATUS rpccli_epm_Map(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct GUID *object, + struct epm_twr_t *map_tower, + struct policy_handle *entry_handle, + uint32_t max_towers, + uint32_t *num_towers, + struct epm_twr_p_t *towers); +NTSTATUS rpccli_epm_LookupHandleFree(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *entry_handle); +NTSTATUS rpccli_epm_InqObject(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct GUID *epm_object); +NTSTATUS rpccli_epm_MgmtDelete(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t object_speced, + struct GUID *object, + struct epm_twr_t *tower); +NTSTATUS rpccli_epm_MapAuth(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); #endif /* __CLI_EPMAPPER__ */ diff --git a/source3/librpc/gen_ndr/cli_eventlog.c b/source3/librpc/gen_ndr/cli_eventlog.c index fbcd098538..72cd886cb4 100644 --- a/source3/librpc/gen_ndr/cli_eventlog.c +++ b/source3/librpc/gen_ndr/cli_eventlog.c @@ -6,7 +6,10 @@ #include "includes.h" #include "librpc/gen_ndr/cli_eventlog.h" -NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *unknown) +NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *unknown) { struct eventlog_ClearEventLogW r; NTSTATUS status; @@ -15,17 +18,24 @@ NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX r.in.handle = handle; r.in.unknown = unknown; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CLEAREVENTLOGW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_CLEAREVENTLOGW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -37,24 +47,32 @@ NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_BackupEventLogW r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_BACKUPEVENTLOGW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_BACKUPEVENTLOGW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -66,7 +84,9 @@ NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle) { struct eventlog_CloseEventLog r; NTSTATUS status; @@ -74,17 +94,24 @@ NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli, TALLOC_CTX * /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_CloseEventLog, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CLOSEEVENTLOG, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_CLOSEEVENTLOG, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_CloseEventLog, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -97,24 +124,32 @@ NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli, TALLOC_CTX * return r.out.result; } -NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_DeregisterEventSource r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_DeregisterEventSource, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_DEREGISTEREVENTSOURCE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_DEREGISTEREVENTSOURCE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_DeregisterEventSource, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -126,7 +161,10 @@ NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli, TALL return r.out.result; } -NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *number) +NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *number) { struct eventlog_GetNumRecords r; NTSTATUS status; @@ -134,17 +172,24 @@ NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli, TALLOC_CTX * /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_GetNumRecords, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_GETNUMRECORDS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_GETNUMRECORDS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_GetNumRecords, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -157,24 +202,32 @@ NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli, TALLOC_CTX * return r.out.result; } -NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_GetOldestRecord r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_GetOldestRecord, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_GETOLDESTRECORD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_GETOLDESTRECORD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_GetOldestRecord, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -186,24 +239,32 @@ NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_ChangeNotify r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ChangeNotify, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CHANGENOTIFY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_CHANGENOTIFY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ChangeNotify, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -215,7 +276,14 @@ NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli, TALLOC_CTX *m return r.out.result; } -NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct eventlog_OpenUnknown0 *unknown0, struct lsa_String logname, struct lsa_String servername, uint32_t unknown2, uint32_t unknown3, struct policy_handle *handle) +NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct eventlog_OpenUnknown0 *unknown0, + struct lsa_String logname, + struct lsa_String servername, + uint32_t unknown2, + uint32_t unknown3, + struct policy_handle *handle) { struct eventlog_OpenEventLogW r; NTSTATUS status; @@ -227,17 +295,24 @@ NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.unknown2 = unknown2; r.in.unknown3 = unknown3; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENEVENTLOGW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_OPENEVENTLOGW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -250,24 +325,32 @@ NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX * return r.out.result; } -NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_RegisterEventSourceW r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REGISTEREVENTSOURCEW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_REGISTEREVENTSOURCEW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -279,24 +362,32 @@ NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli, TALLO return r.out.result; } -NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_OpenBackupEventLogW r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENBACKUPEVENTLOGW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_OPENBACKUPEVENTLOGW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -308,7 +399,15 @@ NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli, TALLOC return r.out.result; } -NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t flags, uint32_t offset, uint32_t number_of_bytes, uint8_t *data, uint32_t *sent_size, uint32_t *real_size) +NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t flags, + uint32_t offset, + uint32_t number_of_bytes, + uint8_t *data, + uint32_t *sent_size, + uint32_t *real_size) { struct eventlog_ReadEventLogW r; NTSTATUS status; @@ -319,17 +418,24 @@ NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.offset = offset; r.in.number_of_bytes = number_of_bytes; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_READEVENTLOGW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_READEVENTLOGW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -344,24 +450,32 @@ NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX * return r.out.result; } -NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_ReportEventW r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ReportEventW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REPORTEVENTW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_REPORTEVENTW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ReportEventW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -373,24 +487,32 @@ NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli, TALLOC_CTX *m return r.out.result; } -NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_ClearEventLogA r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_CLEAREVENTLOGA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_CLEAREVENTLOGA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -402,24 +524,32 @@ NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_BackupEventLogA r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_BACKUPEVENTLOGA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_BACKUPEVENTLOGA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -431,24 +561,32 @@ NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_OpenEventLogA r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENEVENTLOGA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_OPENEVENTLOGA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -460,24 +598,32 @@ NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX * return r.out.result; } -NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_RegisterEventSourceA r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REGISTEREVENTSOURCEA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_REGISTEREVENTSOURCEA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -489,24 +635,32 @@ NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli, TALLO return r.out.result; } -NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_OpenBackupEventLogA r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_OPENBACKUPEVENTLOGA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_OPENBACKUPEVENTLOGA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -518,24 +672,32 @@ NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli, TALLOC return r.out.result; } -NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_ReadEventLogA r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_READEVENTLOGA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_READEVENTLOGA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -547,24 +709,32 @@ NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX * return r.out.result; } -NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_ReportEventA r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ReportEventA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REPORTEVENTA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_REPORTEVENTA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ReportEventA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -576,24 +746,32 @@ NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli, TALLOC_CTX *m return r.out.result; } -NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_RegisterClusterSvc r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_RegisterClusterSvc, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_REGISTERCLUSTERSVC, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_REGISTERCLUSTERSVC, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_RegisterClusterSvc, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -605,24 +783,32 @@ NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_ return r.out.result; } -NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_DeregisterClusterSvc r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_DeregisterClusterSvc, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_DEREGISTERCLUSTERSVC, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_DEREGISTERCLUSTERSVC, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_DeregisterClusterSvc, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -634,24 +820,32 @@ NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli, TALLO return r.out.result; } -NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_WriteClusterEvents r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_WriteClusterEvents, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_WRITECLUSTEREVENTS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_WRITECLUSTEREVENTS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_WriteClusterEvents, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -663,24 +857,32 @@ NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli, TALLOC_ return r.out.result; } -NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct eventlog_GetLogIntormation r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_GetLogIntormation, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_GETLOGINTORMATION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_GETLOGINTORMATION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_GetLogIntormation, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -692,7 +894,9 @@ NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli, TALLOC_C return r.out.result; } -NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle) { struct eventlog_FlushEventLog r; NTSTATUS status; @@ -700,17 +904,24 @@ NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli, TALLOC_CTX * /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_FlushEventLog, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_EVENTLOG, &ndr_table_eventlog, NDR_EVENTLOG_FLUSHEVENTLOG, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_EVENTLOG, + &ndr_table_eventlog, + NDR_EVENTLOG_FLUSHEVENTLOG, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_FlushEventLog, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_eventlog.h b/source3/librpc/gen_ndr/cli_eventlog.h index 9024641795..f75355c390 100644 --- a/source3/librpc/gen_ndr/cli_eventlog.h +++ b/source3/librpc/gen_ndr/cli_eventlog.h @@ -1,28 +1,71 @@ #include "librpc/gen_ndr/ndr_eventlog.h" #ifndef __CLI_EVENTLOG__ #define __CLI_EVENTLOG__ -NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *unknown); -NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *number); -NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct eventlog_OpenUnknown0 *unknown0, struct lsa_String logname, struct lsa_String servername, uint32_t unknown2, uint32_t unknown3, struct policy_handle *handle); -NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t flags, uint32_t offset, uint32_t number_of_bytes, uint8_t *data, uint32_t *sent_size, uint32_t *real_size); -NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); +NTSTATUS rpccli_eventlog_ClearEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *unknown); +NTSTATUS rpccli_eventlog_BackupEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_CloseEventLog(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle); +NTSTATUS rpccli_eventlog_DeregisterEventSource(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_GetNumRecords(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *number); +NTSTATUS rpccli_eventlog_GetOldestRecord(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_ChangeNotify(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_OpenEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct eventlog_OpenUnknown0 *unknown0, + struct lsa_String logname, + struct lsa_String servername, + uint32_t unknown2, + uint32_t unknown3, + struct policy_handle *handle); +NTSTATUS rpccli_eventlog_RegisterEventSourceW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_OpenBackupEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_ReadEventLogW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t flags, + uint32_t offset, + uint32_t number_of_bytes, + uint8_t *data, + uint32_t *sent_size, + uint32_t *real_size); +NTSTATUS rpccli_eventlog_ReportEventW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_ClearEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_BackupEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_OpenEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_RegisterEventSourceA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_OpenBackupEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_ReadEventLogA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_ReportEventA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_RegisterClusterSvc(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_eventlog_FlushEventLog(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle); #endif /* __CLI_EVENTLOG__ */ diff --git a/source3/librpc/gen_ndr/cli_initshutdown.c b/source3/librpc/gen_ndr/cli_initshutdown.c index a549c94ce5..10f5c308d5 100644 --- a/source3/librpc/gen_ndr/cli_initshutdown.c +++ b/source3/librpc/gen_ndr/cli_initshutdown.c @@ -6,7 +6,14 @@ #include "includes.h" #include "librpc/gen_ndr/cli_initshutdown.h" -NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, WERROR *werror) +NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *hostname, + struct initshutdown_String *message, + uint32_t timeout, + uint8_t force_apps, + uint8_t reboot, + WERROR *werror) { struct initshutdown_Init r; NTSTATUS status; @@ -18,17 +25,24 @@ NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.force_apps = force_apps; r.in.reboot = reboot; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(initshutdown_Init, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, &ndr_table_initshutdown, NDR_INITSHUTDOWN_INIT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_INITSHUTDOWN, + &ndr_table_initshutdown, + NDR_INITSHUTDOWN_INIT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(initshutdown_Init, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -44,7 +58,10 @@ NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server, WERROR *werror) +NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *server, + WERROR *werror) { struct initshutdown_Abort r; NTSTATUS status; @@ -52,17 +69,24 @@ NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ /* In parameters */ r.in.server = server; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(initshutdown_Abort, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, &ndr_table_initshutdown, NDR_INITSHUTDOWN_ABORT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_INITSHUTDOWN, + &ndr_table_initshutdown, + NDR_INITSHUTDOWN_ABORT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(initshutdown_Abort, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -78,7 +102,15 @@ NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason, WERROR *werror) +NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *hostname, + struct initshutdown_String *message, + uint32_t timeout, + uint8_t force_apps, + uint8_t reboot, + uint32_t reason, + WERROR *werror) { struct initshutdown_InitEx r; NTSTATUS status; @@ -91,17 +123,24 @@ NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.reboot = reboot; r.in.reason = reason; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(initshutdown_InitEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, &ndr_table_initshutdown, NDR_INITSHUTDOWN_INITEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_INITSHUTDOWN, + &ndr_table_initshutdown, + NDR_INITSHUTDOWN_INITEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(initshutdown_InitEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_initshutdown.h b/source3/librpc/gen_ndr/cli_initshutdown.h index e2a35b6d50..624b79f94c 100644 --- a/source3/librpc/gen_ndr/cli_initshutdown.h +++ b/source3/librpc/gen_ndr/cli_initshutdown.h @@ -1,7 +1,25 @@ #include "librpc/gen_ndr/ndr_initshutdown.h" #ifndef __CLI_INITSHUTDOWN__ #define __CLI_INITSHUTDOWN__ -NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, WERROR *werror); -NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server, WERROR *werror); -NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason, WERROR *werror); +NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *hostname, + struct initshutdown_String *message, + uint32_t timeout, + uint8_t force_apps, + uint8_t reboot, + WERROR *werror); +NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *server, + WERROR *werror); +NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *hostname, + struct initshutdown_String *message, + uint32_t timeout, + uint8_t force_apps, + uint8_t reboot, + uint32_t reason, + WERROR *werror); #endif /* __CLI_INITSHUTDOWN__ */ diff --git a/source3/librpc/gen_ndr/cli_lsa.c b/source3/librpc/gen_ndr/cli_lsa.c index 49bb44880a..470ab3e0a5 100644 --- a/source3/librpc/gen_ndr/cli_lsa.c +++ b/source3/librpc/gen_ndr/cli_lsa.c @@ -6,7 +6,9 @@ #include "includes.h" #include "librpc/gen_ndr/cli_lsa.h" -NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle) { struct lsa_Close r; NTSTATUS status; @@ -14,17 +16,24 @@ NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, stru /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_Close, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CLOSE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CLOSE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_Close, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -37,7 +46,9 @@ NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, stru return r.out.result; } -NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle) { struct lsa_Delete r; NTSTATUS status; @@ -45,17 +56,24 @@ NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, str /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_Delete, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_DELETE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_DELETE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_Delete, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -67,7 +85,12 @@ NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, str return r.out.result; } -NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t max_count, struct lsa_PrivArray *privs) +NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *resume_handle, + uint32_t max_count, + struct lsa_PrivArray *privs) { struct lsa_EnumPrivs r; NTSTATUS status; @@ -77,17 +100,24 @@ NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.resume_handle = resume_handle; r.in.max_count = max_count; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumPrivs, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMPRIVS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_ENUMPRIVS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumPrivs, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -101,7 +131,11 @@ NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return r.out.result; } -NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct sec_desc_buf *sdbuf) +NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t sec_info, + struct sec_desc_buf *sdbuf) { struct lsa_QuerySecurity r; NTSTATUS status; @@ -110,17 +144,24 @@ NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.handle = handle; r.in.sec_info = sec_info; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QuerySecurity, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYSECURITY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_QUERYSECURITY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QuerySecurity, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -135,24 +176,32 @@ NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_SetSecObj r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetSecObj, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETSECOBJ, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETSECOBJ, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetSecObj, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -164,24 +213,32 @@ NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) return r.out.result; } -NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_ChangePassword r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_ChangePassword, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CHANGEPASSWORD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CHANGEPASSWORD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_ChangePassword, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -193,7 +250,12 @@ NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return r.out.result; } -NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, struct lsa_ObjectAttribute *attr, uint32_t access_mask, struct policy_handle *handle) +NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + struct lsa_ObjectAttribute *attr, + uint32_t access_mask, + struct policy_handle *handle) { struct lsa_OpenPolicy r; NTSTATUS status; @@ -203,17 +265,24 @@ NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.attr = attr; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenPolicy, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENPOLICY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_OPENPOLICY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -226,7 +295,11 @@ NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return r.out.result; } -NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_PolicyInformation *info) +NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_PolicyInformation *info) { struct lsa_QueryInfoPolicy r; NTSTATUS status; @@ -235,17 +308,24 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.handle = handle; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYINFOPOLICY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_QUERYINFOPOLICY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -260,24 +340,32 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem return r.out.result; } -NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_SetInfoPolicy r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETINFOPOLICY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETINFOPOLICY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -289,24 +377,32 @@ NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_ClearAuditLog r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_ClearAuditLog, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CLEARAUDITLOG, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CLEARAUDITLOG, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_ClearAuditLog, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -318,7 +414,12 @@ NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *acct_handle) +NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + uint32_t access_mask, + struct policy_handle *acct_handle) { struct lsa_CreateAccount r; NTSTATUS status; @@ -328,17 +429,24 @@ NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.sid = sid; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateAccount, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATEACCOUNT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREATEACCOUNT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateAccount, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -351,7 +459,12 @@ NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t num_entries, struct lsa_SidArray *sids) +NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *resume_handle, + uint32_t num_entries, + struct lsa_SidArray *sids) { struct lsa_EnumAccounts r; NTSTATUS status; @@ -361,17 +474,24 @@ NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.resume_handle = resume_handle; r.in.num_entries = num_entries; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumAccounts, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMACCOUNTS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_ENUMACCOUNTS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumAccounts, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -385,7 +505,12 @@ NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return r.out.result; } -NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_DomainInfo *info, uint32_t access_mask, struct policy_handle *trustdom_handle) +NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_DomainInfo *info, + uint32_t access_mask, + struct policy_handle *trustdom_handle) { struct lsa_CreateTrustedDomain r; NTSTATUS status; @@ -395,17 +520,24 @@ NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX r.in.info = info; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomain, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATETRUSTEDDOMAIN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREATETRUSTEDDOMAIN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomain, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -418,7 +550,12 @@ NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t max_size, struct lsa_DomainList *domains) +NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *resume_handle, + uint32_t max_size, + struct lsa_DomainList *domains) { struct lsa_EnumTrustDom r; NTSTATUS status; @@ -428,17 +565,24 @@ NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.resume_handle = resume_handle; r.in.max_size = max_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumTrustDom, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMTRUSTDOM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_ENUMTRUSTDOM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumTrustDom, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -452,7 +596,15 @@ NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return r.out.result; } -NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray *sids, uint16_t level, uint32_t *count) +NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t num_names, + struct lsa_String *names, + struct lsa_RefDomainList *domains, + struct lsa_TransSidArray *sids, + uint16_t level, + uint32_t *count) { struct lsa_LookupNames r; NTSTATUS status; @@ -465,17 +617,24 @@ NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.level = level; r.in.count = count; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupNames, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPNAMES, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupNames, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -492,7 +651,14 @@ NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return r.out.result; } -NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray *names, uint16_t level, uint32_t *count) +NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_SidArray *sids, + struct lsa_RefDomainList *domains, + struct lsa_TransNameArray *names, + uint16_t level, + uint32_t *count) { struct lsa_LookupSids r; NTSTATUS status; @@ -504,17 +670,24 @@ NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.level = level; r.in.count = count; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupSids, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPSIDS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPSIDS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupSids, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -531,7 +704,12 @@ NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return r.out.result; } -NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *sec_handle) +NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String name, + uint32_t access_mask, + struct policy_handle *sec_handle) { struct lsa_CreateSecret r; NTSTATUS status; @@ -541,17 +719,24 @@ NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.name = name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateSecret, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATESECRET, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREATESECRET, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateSecret, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -564,7 +749,12 @@ NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return r.out.result; } -NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *acct_handle) +NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + uint32_t access_mask, + struct policy_handle *acct_handle) { struct lsa_OpenAccount r; NTSTATUS status; @@ -574,17 +764,24 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.sid = sid; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenAccount, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENACCOUNT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_OPENACCOUNT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenAccount, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -597,7 +794,10 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return r.out.result; } -NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_PrivilegeSet *privs) +NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_PrivilegeSet *privs) { struct lsa_EnumPrivsAccount r; NTSTATUS status; @@ -605,17 +805,24 @@ NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, TALLOC_CTX *me /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumPrivsAccount, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMPRIVSACCOUNT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_ENUMPRIVSACCOUNT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumPrivsAccount, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -630,7 +837,10 @@ NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, TALLOC_CTX *me return r.out.result; } -NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_PrivilegeSet *privs) +NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_PrivilegeSet *privs) { struct lsa_AddPrivilegesToAccount r; NTSTATUS status; @@ -639,17 +849,24 @@ NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli, TALLOC_C r.in.handle = handle; r.in.privs = privs; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_AddPrivilegesToAccount, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ADDPRIVILEGESTOACCOUNT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_ADDPRIVILEGESTOACCOUNT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_AddPrivilegesToAccount, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -661,7 +878,11 @@ NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli, TALLOC_C return r.out.result; } -NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t remove_all, struct lsa_PrivilegeSet *privs) +NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint8_t remove_all, + struct lsa_PrivilegeSet *privs) { struct lsa_RemovePrivilegesFromAccount r; NTSTATUS status; @@ -671,17 +892,24 @@ NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli, TAL r.in.remove_all = remove_all; r.in.privs = privs; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_RemovePrivilegesFromAccount, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_RemovePrivilegesFromAccount, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -693,24 +921,32 @@ NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli, TAL return r.out.result; } -NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_GetQuotasForAccount r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_GetQuotasForAccount, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_GETQUOTASFORACCOUNT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_GETQUOTASFORACCOUNT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_GetQuotasForAccount, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -722,24 +958,32 @@ NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_SetQuotasForAccount r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetQuotasForAccount, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETQUOTASFORACCOUNT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETQUOTASFORACCOUNT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetQuotasForAccount, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -751,24 +995,32 @@ NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_GetSystemAccessAccount r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_GETSYSTEMACCESSACCOUNT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_GETSYSTEMACCESSACCOUNT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_GetSystemAccessAccount, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -780,24 +1032,32 @@ NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_C return r.out.result; } -NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_SetSystemAccessAccount r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetSystemAccessAccount, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETSYSTEMACCESSACCOUNT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETSYSTEMACCESSACCOUNT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetSystemAccessAccount, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -809,7 +1069,12 @@ NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_C return r.out.result; } -NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *trustdom_handle) +NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + uint32_t access_mask, + struct policy_handle *trustdom_handle) { struct lsa_OpenTrustedDomain r; NTSTATUS status; @@ -819,17 +1084,24 @@ NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.sid = sid; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomain, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENTRUSTEDDOMAIN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_OPENTRUSTEDDOMAIN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomain, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -842,7 +1114,11 @@ NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *m return r.out.result; } -NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *trustdom_handle, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info) +NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *trustdom_handle, + enum lsa_TrustDomInfoEnum level, + union lsa_TrustedDomainInfo *info) { struct lsa_QueryTrustedDomainInfo r; NTSTATUS status; @@ -851,17 +1127,24 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_C r.in.trustdom_handle = trustdom_handle; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYTRUSTEDDOMAININFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_QUERYTRUSTEDDOMAININFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -876,24 +1159,32 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_C return r.out.result; } -NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_SetInformationTrustedDomain r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetInformationTrustedDomain, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetInformationTrustedDomain, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -905,7 +1196,12 @@ NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli, TAL return r.out.result; } -NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *sec_handle) +NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String name, + uint32_t access_mask, + struct policy_handle *sec_handle) { struct lsa_OpenSecret r; NTSTATUS status; @@ -915,17 +1211,24 @@ NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.name = name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenSecret, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENSECRET, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_OPENSECRET, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenSecret, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -938,7 +1241,11 @@ NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return r.out.result; } -NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *sec_handle, struct lsa_DATA_BUF *new_val, struct lsa_DATA_BUF *old_val) +NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *sec_handle, + struct lsa_DATA_BUF *new_val, + struct lsa_DATA_BUF *old_val) { struct lsa_SetSecret r; NTSTATUS status; @@ -948,17 +1255,24 @@ NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.new_val = new_val; r.in.old_val = old_val; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetSecret, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETSECRET, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETSECRET, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetSecret, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -970,7 +1284,13 @@ NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return r.out.result; } -NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *sec_handle, struct lsa_DATA_BUF_PTR *new_val, NTTIME *new_mtime, struct lsa_DATA_BUF_PTR *old_val, NTTIME *old_mtime) +NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *sec_handle, + struct lsa_DATA_BUF_PTR *new_val, + NTTIME *new_mtime, + struct lsa_DATA_BUF_PTR *old_val, + NTTIME *old_mtime) { struct lsa_QuerySecret r; NTSTATUS status; @@ -982,17 +1302,24 @@ NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.old_val = old_val; r.in.old_mtime = old_mtime; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QuerySecret, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYSECRET, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_QUERYSECRET, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QuerySecret, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1016,7 +1343,11 @@ NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return r.out.result; } -NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_LUID *luid) +NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *name, + struct lsa_LUID *luid) { struct lsa_LookupPrivValue r; NTSTATUS status; @@ -1025,17 +1356,24 @@ NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.handle = handle; r.in.name = name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupPrivValue, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPPRIVVALUE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPPRIVVALUE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupPrivValue, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1048,7 +1386,11 @@ NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem return r.out.result; } -NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_LUID *luid, struct lsa_StringLarge *name) +NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_LUID *luid, + struct lsa_StringLarge *name) { struct lsa_LookupPrivName r; NTSTATUS status; @@ -1057,17 +1399,24 @@ NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.handle = handle; r.in.luid = luid; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupPrivName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPPRIVNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPPRIVNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupPrivName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1082,7 +1431,13 @@ NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return r.out.result; } -NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_StringLarge *disp_name, uint16_t *language_id, uint16_t unknown) +NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *name, + struct lsa_StringLarge *disp_name, + uint16_t *language_id, + uint16_t unknown) { struct lsa_LookupPrivDisplayName r; NTSTATUS status; @@ -1093,17 +1448,24 @@ NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli, TALLOC_CT r.in.language_id = language_id; r.in.unknown = unknown; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupPrivDisplayName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPPRIVDISPLAYNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPPRIVDISPLAYNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupPrivDisplayName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1119,24 +1481,32 @@ NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli, TALLOC_CT return r.out.result; } -NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_DeleteObject r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_DeleteObject, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_DELETEOBJECT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_DELETEOBJECT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_DeleteObject, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1148,7 +1518,11 @@ NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return r.out.result; } -NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_SidArray *sids) +NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *name, + struct lsa_SidArray *sids) { struct lsa_EnumAccountsWithUserRight r; NTSTATUS status; @@ -1157,17 +1531,24 @@ NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli, TALLO r.in.handle = handle; r.in.name = name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumAccountsWithUserRight, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumAccountsWithUserRight, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1180,7 +1561,11 @@ NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli, TALLO return r.out.result; } -NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, struct lsa_RightSet *rights) +NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + struct lsa_RightSet *rights) { struct lsa_EnumAccountRights r; NTSTATUS status; @@ -1189,17 +1574,24 @@ NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.handle = handle; r.in.sid = sid; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumAccountRights, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMACCOUNTRIGHTS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_ENUMACCOUNTRIGHTS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumAccountRights, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1212,7 +1604,11 @@ NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *m return r.out.result; } -NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, struct lsa_RightSet *rights) +NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + struct lsa_RightSet *rights) { struct lsa_AddAccountRights r; NTSTATUS status; @@ -1222,17 +1618,24 @@ NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.sid = sid; r.in.rights = rights; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_AddAccountRights, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ADDACCOUNTRIGHTS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_ADDACCOUNTRIGHTS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_AddAccountRights, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1244,7 +1647,12 @@ NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *me return r.out.result; } -NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t unknown, struct lsa_RightSet *rights) +NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + uint32_t unknown, + struct lsa_RightSet *rights) { struct lsa_RemoveAccountRights r; NTSTATUS status; @@ -1255,17 +1663,24 @@ NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX r.in.unknown = unknown; r.in.rights = rights; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_RemoveAccountRights, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_REMOVEACCOUNTRIGHTS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_REMOVEACCOUNTRIGHTS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_RemoveAccountRights, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1277,7 +1692,12 @@ NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *dom_sid, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info) +NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *dom_sid, + enum lsa_TrustDomInfoEnum level, + union lsa_TrustedDomainInfo *info) { struct lsa_QueryTrustedDomainInfoBySid r; NTSTATUS status; @@ -1287,17 +1707,24 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli, TAL r.in.dom_sid = dom_sid; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoBySid, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoBySid, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1312,24 +1739,32 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli, TAL return r.out.result; } -NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_SetTrustedDomainInfo r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETTRUSTEDDOMAININFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETTRUSTEDDOMAININFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1341,7 +1776,10 @@ NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *dom_sid) +NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *dom_sid) { struct lsa_DeleteTrustedDomain r; NTSTATUS status; @@ -1350,17 +1788,24 @@ NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX r.in.handle = handle; r.in.dom_sid = dom_sid; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_DeleteTrustedDomain, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_DELETETRUSTEDDOMAIN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_DELETETRUSTEDDOMAIN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_DeleteTrustedDomain, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1372,24 +1817,32 @@ NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_StorePrivateData r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_StorePrivateData, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_STOREPRIVATEDATA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_STOREPRIVATEDATA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_StorePrivateData, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1401,24 +1854,32 @@ NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *me return r.out.result; } -NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_RetrievePrivateData r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_RETRIEVEPRIVATEDATA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_RETRIEVEPRIVATEDATA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_RetrievePrivateData, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1430,7 +1891,12 @@ NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *system_name, struct lsa_ObjectAttribute *attr, uint32_t access_mask, struct policy_handle *handle) +NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + struct lsa_ObjectAttribute *attr, + uint32_t access_mask, + struct policy_handle *handle) { struct lsa_OpenPolicy2 r; NTSTATUS status; @@ -1440,17 +1906,24 @@ NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.attr = attr; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenPolicy2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENPOLICY2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_OPENPOLICY2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1463,7 +1936,11 @@ NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return r.out.result; } -NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *system_name, struct lsa_String *account_name, struct lsa_StringPointer *authority_name) +NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + struct lsa_String *account_name, + struct lsa_StringPointer *authority_name) { struct lsa_GetUserName r; NTSTATUS status; @@ -1473,17 +1950,24 @@ NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.account_name = account_name; r.in.authority_name = authority_name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_GetUserName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_GETUSERNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_GETUSERNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_GetUserName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1501,7 +1985,11 @@ NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return r.out.result; } -NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_PolicyInformation *info) +NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_PolicyInformation *info) { struct lsa_QueryInfoPolicy2 r; NTSTATUS status; @@ -1510,17 +1998,24 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.handle = handle; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYINFOPOLICY2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_QUERYINFOPOLICY2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1535,24 +2030,32 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *me return r.out.result; } -NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_SetInfoPolicy2 r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETINFOPOLICY2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETINFOPOLICY2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1564,7 +2067,12 @@ NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return r.out.result; } -NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info) +NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String trusted_domain, + enum lsa_TrustDomInfoEnum level, + union lsa_TrustedDomainInfo *info) { struct lsa_QueryTrustedDomainInfoByName r; NTSTATUS status; @@ -1574,17 +2082,24 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TA r.in.trusted_domain = trusted_domain; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoByName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoByName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1599,7 +2114,12 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TA return r.out.result; } -NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info) +NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String trusted_domain, + enum lsa_TrustDomInfoEnum level, + union lsa_TrustedDomainInfo *info) { struct lsa_SetTrustedDomainInfoByName r; NTSTATUS status; @@ -1610,17 +2130,24 @@ NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALL r.in.level = level; r.in.info = info; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfoByName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETTRUSTEDDOMAININFOBYNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETTRUSTEDDOMAININFOBYNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfoByName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1632,7 +2159,12 @@ NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALL return r.out.result; } -NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, struct lsa_DomainListEx *domains, uint32_t max_size) +NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *resume_handle, + struct lsa_DomainListEx *domains, + uint32_t max_size) { struct lsa_EnumTrustedDomainsEx r; NTSTATUS status; @@ -1642,17 +2174,24 @@ NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli, TALLOC_CTX r.in.resume_handle = resume_handle; r.in.max_size = max_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumTrustedDomainsEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_ENUMTRUSTEDDOMAINSEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_ENUMTRUSTEDDOMAINSEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumTrustedDomainsEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1666,24 +2205,32 @@ NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CreateTrustedDomainEx r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATETRUSTEDDOMAINEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREATETRUSTEDDOMAINEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1695,7 +2242,9 @@ NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CT return r.out.result; } -NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle) { struct lsa_CloseTrustedDomainEx r; NTSTATUS status; @@ -1703,17 +2252,24 @@ NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CloseTrustedDomainEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CLOSETRUSTEDDOMAINEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CLOSETRUSTEDDOMAINEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CloseTrustedDomainEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1726,7 +2282,11 @@ NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_DomainInformationPolicy *info) +NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_DomainInformationPolicy *info) { struct lsa_QueryDomainInformationPolicy r; NTSTATUS status; @@ -1735,17 +2295,24 @@ NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli, TA r.in.handle = handle; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryDomainInformationPolicy, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_QUERYDOMAININFORMATIONPOLICY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_QUERYDOMAININFORMATIONPOLICY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryDomainInformationPolicy, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1760,7 +2327,11 @@ NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli, TA return r.out.result; } -NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_DomainInformationPolicy *info) +NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_DomainInformationPolicy *info) { struct lsa_SetDomainInformationPolicy r; NTSTATUS status; @@ -1770,17 +2341,24 @@ NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli, TALL r.in.level = level; r.in.info = info; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetDomainInformationPolicy, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_SETDOMAININFORMATIONPOLICY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_SETDOMAININFORMATIONPOLICY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetDomainInformationPolicy, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1792,7 +2370,12 @@ NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli, TALL return r.out.result; } -NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *trustdom_handle) +NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String name, + uint32_t access_mask, + struct policy_handle *trustdom_handle) { struct lsa_OpenTrustedDomainByName r; NTSTATUS status; @@ -1802,17 +2385,24 @@ NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli, TALLOC_ r.in.name = name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomainByName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_OPENTRUSTEDDOMAINBYNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_OPENTRUSTEDDOMAINBYNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomainByName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1825,24 +2415,32 @@ NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli, TALLOC_ return r.out.result; } -NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_TestCall r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_TestCall, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_TESTCALL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_TESTCALL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_TestCall, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1854,7 +2452,16 @@ NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) return r.out.result; } -NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray2 *names, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2) +NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_SidArray *sids, + struct lsa_RefDomainList *domains, + struct lsa_TransNameArray2 *names, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2) { struct lsa_LookupSids2 r; NTSTATUS status; @@ -1868,17 +2475,24 @@ NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupSids2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPSIDS2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPSIDS2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupSids2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1895,7 +2509,17 @@ NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return r.out.result; } -NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray2 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2) +NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t num_names, + struct lsa_String *names, + struct lsa_RefDomainList *domains, + struct lsa_TransSidArray2 *sids, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2) { struct lsa_LookupNames2 r; NTSTATUS status; @@ -1910,17 +2534,24 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupNames2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPNAMES2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupNames2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1937,24 +2568,32 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return r.out.result; } -NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CreateTrustedDomainEx2 r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREATETRUSTEDDOMAINEX2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREATETRUSTEDDOMAINEX2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1966,24 +2605,32 @@ NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli, TALLOC_C return r.out.result; } -NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRWRITE r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRWRITE, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRWRITE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRWRITE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITE, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1995,24 +2642,32 @@ NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) return r.out.result; } -NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRREAD r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRREAD, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRREAD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRREAD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRREAD, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2024,24 +2679,32 @@ NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) return r.out.result; } -NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRENUMERATE r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRENUMERATE, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRENUMERATE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRENUMERATE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRENUMERATE, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2053,24 +2716,32 @@ NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return r.out.result; } -NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRWRITEDOMAINCREDENTIALS r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRWRITEDOMAINCREDENTIALS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRWRITEDOMAINCREDENTIALS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2082,24 +2753,32 @@ NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TAL return r.out.result; } -NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRREADDOMAINCREDENTIALS r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRREADDOMAINCREDENTIALS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRREADDOMAINCREDENTIALS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2111,24 +2790,32 @@ NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALL return r.out.result; } -NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRDELETE r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRDELETE, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRDELETE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRDELETE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRDELETE, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2140,24 +2827,32 @@ NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return r.out.result; } -NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRGETTARGETINFO r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRGETTARGETINFO, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRGETTARGETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRGETTARGETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRGETTARGETINFO, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2169,24 +2864,32 @@ NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli, TALLOC_CTX * return r.out.result; } -NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRPROFILELOADED r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRPROFILELOADED, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRPROFILELOADED, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRPROFILELOADED, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRPROFILELOADED, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2198,7 +2901,17 @@ NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli, TALLOC_CTX * return r.out.result; } -NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2) +NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t num_names, + struct lsa_String *names, + struct lsa_RefDomainList *domains, + struct lsa_TransSidArray3 *sids, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2) { struct lsa_LookupNames3 r; NTSTATUS status; @@ -2213,17 +2926,24 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupNames3, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES3, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPNAMES3, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupNames3, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2240,24 +2960,32 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return r.out.result; } -NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRGETSESSIONTYPES r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRGETSESSIONTYPES, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRGETSESSIONTYPES, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRGETSESSIONTYPES, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRGETSESSIONTYPES, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2269,24 +2997,32 @@ NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_LSARREGISTERAUDITEVENT r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARREGISTERAUDITEVENT, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARREGISTERAUDITEVENT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LSARREGISTERAUDITEVENT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARREGISTERAUDITEVENT, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2298,24 +3034,32 @@ NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_C return r.out.result; } -NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_LSARGENAUDITEVENT r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARGENAUDITEVENT, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARGENAUDITEVENT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LSARGENAUDITEVENT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARGENAUDITEVENT, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2327,24 +3071,32 @@ NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *m return r.out.result; } -NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_LSARUNREGISTERAUDITEVENT r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARUNREGISTERAUDITEVENT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LSARUNREGISTERAUDITEVENT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2356,24 +3108,32 @@ NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC return r.out.result; } -NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_LSARQUERYFORESTTRUSTINFORMATION r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2385,24 +3145,32 @@ NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, return r.out.result; } -NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_LSARSETFORESTTRUSTINFORMATION r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARSETFORESTTRUSTINFORMATION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LSARSETFORESTTRUSTINFORMATION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2414,24 +3182,32 @@ NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, T return r.out.result; } -NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_CREDRRENAME r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRRENAME, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_CREDRRENAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_CREDRRENAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRRENAME, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2443,7 +3219,15 @@ NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return r.out.result; } -NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray2 *names, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2) +NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_SidArray *sids, + struct lsa_RefDomainList *domains, + struct lsa_TransNameArray2 *names, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2) { struct lsa_LookupSids3 r; NTSTATUS status; @@ -2456,17 +3240,24 @@ NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupSids3, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPSIDS3, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPSIDS3, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupSids3, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2483,7 +3274,16 @@ NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return r.out.result; } -NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2) +NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t num_names, + struct lsa_String *names, + struct lsa_RefDomainList *domains, + struct lsa_TransSidArray3 *sids, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2) { struct lsa_LookupNames4 r; NTSTATUS status; @@ -2497,17 +3297,24 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.unknown1 = unknown1; r.in.unknown2 = unknown2; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupNames4, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LOOKUPNAMES4, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LOOKUPNAMES4, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupNames4, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2524,24 +3331,32 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return r.out.result; } -NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_LSAROPENPOLICYSCE r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSAROPENPOLICYSCE, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSAROPENPOLICYSCE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LSAROPENPOLICYSCE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSAROPENPOLICYSCE, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2553,24 +3368,32 @@ NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli, TALLOC_CTX *m return r.out.result; } -NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2582,24 +3405,32 @@ NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *c return r.out.result; } -NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2611,24 +3442,32 @@ NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client return r.out.result; } -NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx) { struct lsa_LSARADTREPORTSECURITYEVENT r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_LSARPC, &ndr_table_lsarpc, NDR_LSA_LSARADTREPORTSECURITYEVENT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_LSARPC, + &ndr_table_lsarpc, + NDR_LSA_LSARADTREPORTSECURITYEVENT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_lsa.h b/source3/librpc/gen_ndr/cli_lsa.h index a44105ea9c..ad5e60d591 100644 --- a/source3/librpc/gen_ndr/cli_lsa.h +++ b/source3/librpc/gen_ndr/cli_lsa.h @@ -1,86 +1,351 @@ #include "librpc/gen_ndr/ndr_lsa.h" #ifndef __CLI_LSARPC__ #define __CLI_LSARPC__ -NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t max_count, struct lsa_PrivArray *privs); -NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct sec_desc_buf *sdbuf); -NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, struct lsa_ObjectAttribute *attr, uint32_t access_mask, struct policy_handle *handle); -NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_PolicyInformation *info); -NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *acct_handle); -NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t num_entries, struct lsa_SidArray *sids); -NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_DomainInfo *info, uint32_t access_mask, struct policy_handle *trustdom_handle); -NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, uint32_t max_size, struct lsa_DomainList *domains); -NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray *sids, uint16_t level, uint32_t *count); -NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray *names, uint16_t level, uint32_t *count); -NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *sec_handle); -NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *acct_handle); -NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_PrivilegeSet *privs); -NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_PrivilegeSet *privs); -NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t remove_all, struct lsa_PrivilegeSet *privs); -NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t access_mask, struct policy_handle *trustdom_handle); -NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *trustdom_handle, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info); -NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *sec_handle); -NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *sec_handle, struct lsa_DATA_BUF *new_val, struct lsa_DATA_BUF *old_val); -NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *sec_handle, struct lsa_DATA_BUF_PTR *new_val, NTTIME *new_mtime, struct lsa_DATA_BUF_PTR *old_val, NTTIME *old_mtime); -NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_LUID *luid); -NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_LUID *luid, struct lsa_StringLarge *name); -NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_StringLarge *disp_name, uint16_t *language_id, uint16_t unknown); -NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *name, struct lsa_SidArray *sids); -NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, struct lsa_RightSet *rights); -NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, struct lsa_RightSet *rights); -NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *sid, uint32_t unknown, struct lsa_RightSet *rights); -NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *dom_sid, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info); -NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct dom_sid2 *dom_sid); -NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *system_name, struct lsa_ObjectAttribute *attr, uint32_t access_mask, struct policy_handle *handle); -NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *system_name, struct lsa_String *account_name, struct lsa_StringPointer *authority_name); -NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_PolicyInformation *info); -NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info); -NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String trusted_domain, enum lsa_TrustDomInfoEnum level, union lsa_TrustedDomainInfo *info); -NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *resume_handle, struct lsa_DomainListEx *domains, uint32_t max_size); -NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_DomainInformationPolicy *info); -NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint16_t level, union lsa_DomainInformationPolicy *info); -NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String name, uint32_t access_mask, struct policy_handle *trustdom_handle); -NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray2 *names, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2); -NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray2 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2); -NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2); -NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct lsa_SidArray *sids, struct lsa_RefDomainList *domains, struct lsa_TransNameArray2 *names, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2); -NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t num_names, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, uint16_t level, uint32_t *count, uint32_t unknown1, uint32_t unknown2); -NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_Close(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle); +NTSTATUS rpccli_lsa_Delete(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle); +NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *resume_handle, + uint32_t max_count, + struct lsa_PrivArray *privs); +NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t sec_info, + struct sec_desc_buf *sdbuf); +NTSTATUS rpccli_lsa_SetSecObj(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_ChangePassword(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + struct lsa_ObjectAttribute *attr, + uint32_t access_mask, + struct policy_handle *handle); +NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_PolicyInformation *info); +NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + uint32_t access_mask, + struct policy_handle *acct_handle); +NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *resume_handle, + uint32_t num_entries, + struct lsa_SidArray *sids); +NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_DomainInfo *info, + uint32_t access_mask, + struct policy_handle *trustdom_handle); +NTSTATUS rpccli_lsa_EnumTrustDom(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *resume_handle, + uint32_t max_size, + struct lsa_DomainList *domains); +NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t num_names, + struct lsa_String *names, + struct lsa_RefDomainList *domains, + struct lsa_TransSidArray *sids, + uint16_t level, + uint32_t *count); +NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_SidArray *sids, + struct lsa_RefDomainList *domains, + struct lsa_TransNameArray *names, + uint16_t level, + uint32_t *count); +NTSTATUS rpccli_lsa_CreateSecret(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String name, + uint32_t access_mask, + struct policy_handle *sec_handle); +NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + uint32_t access_mask, + struct policy_handle *acct_handle); +NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_PrivilegeSet *privs); +NTSTATUS rpccli_lsa_AddPrivilegesToAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_PrivilegeSet *privs); +NTSTATUS rpccli_lsa_RemovePrivilegesFromAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint8_t remove_all, + struct lsa_PrivilegeSet *privs); +NTSTATUS rpccli_lsa_GetQuotasForAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_SetQuotasForAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_GetSystemAccessAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_SetSystemAccessAccount(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_OpenTrustedDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + uint32_t access_mask, + struct policy_handle *trustdom_handle); +NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *trustdom_handle, + enum lsa_TrustDomInfoEnum level, + union lsa_TrustedDomainInfo *info); +NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String name, + uint32_t access_mask, + struct policy_handle *sec_handle); +NTSTATUS rpccli_lsa_SetSecret(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *sec_handle, + struct lsa_DATA_BUF *new_val, + struct lsa_DATA_BUF *old_val); +NTSTATUS rpccli_lsa_QuerySecret(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *sec_handle, + struct lsa_DATA_BUF_PTR *new_val, + NTTIME *new_mtime, + struct lsa_DATA_BUF_PTR *old_val, + NTTIME *old_mtime); +NTSTATUS rpccli_lsa_LookupPrivValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *name, + struct lsa_LUID *luid); +NTSTATUS rpccli_lsa_LookupPrivName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_LUID *luid, + struct lsa_StringLarge *name); +NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *name, + struct lsa_StringLarge *disp_name, + uint16_t *language_id, + uint16_t unknown); +NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *name, + struct lsa_SidArray *sids); +NTSTATUS rpccli_lsa_EnumAccountRights(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + struct lsa_RightSet *rights); +NTSTATUS rpccli_lsa_AddAccountRights(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + struct lsa_RightSet *rights); +NTSTATUS rpccli_lsa_RemoveAccountRights(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *sid, + uint32_t unknown, + struct lsa_RightSet *rights); +NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *dom_sid, + enum lsa_TrustDomInfoEnum level, + union lsa_TrustedDomainInfo *info); +NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid2 *dom_sid); +NTSTATUS rpccli_lsa_StorePrivateData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_RetrievePrivateData(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_OpenPolicy2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + struct lsa_ObjectAttribute *attr, + uint32_t access_mask, + struct policy_handle *handle); +NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + struct lsa_String *account_name, + struct lsa_StringPointer *authority_name); +NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_PolicyInformation *info); +NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String trusted_domain, + enum lsa_TrustDomInfoEnum level, + union lsa_TrustedDomainInfo *info); +NTSTATUS rpccli_lsa_SetTrustedDomainInfoByName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String trusted_domain, + enum lsa_TrustDomInfoEnum level, + union lsa_TrustedDomainInfo *info); +NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *resume_handle, + struct lsa_DomainListEx *domains, + uint32_t max_size); +NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle); +NTSTATUS rpccli_lsa_QueryDomainInformationPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_DomainInformationPolicy *info); +NTSTATUS rpccli_lsa_SetDomainInformationPolicy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_DomainInformationPolicy *info); +NTSTATUS rpccli_lsa_OpenTrustedDomainByName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String name, + uint32_t access_mask, + struct policy_handle *trustdom_handle); +NTSTATUS rpccli_lsa_TestCall(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LookupSids2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_SidArray *sids, + struct lsa_RefDomainList *domains, + struct lsa_TransNameArray2 *names, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2); +NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t num_names, + struct lsa_String *names, + struct lsa_RefDomainList *domains, + struct lsa_TransSidArray2 *sids, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2); +NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CREDRENUMERATE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CREDRWRITEDOMAINCREDENTIALS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CREDRREADDOMAINCREDENTIALS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CREDRDELETE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CREDRGETTARGETINFO(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CREDRPROFILELOADED(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t num_names, + struct lsa_String *names, + struct lsa_RefDomainList *domains, + struct lsa_TransSidArray3 *sids, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2); +NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LookupSids3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_SidArray *sids, + struct lsa_RefDomainList *domains, + struct lsa_TransNameArray2 *names, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2); +NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t num_names, + struct lsa_String *names, + struct lsa_RefDomainList *domains, + struct lsa_TransSidArray3 *sids, + uint16_t level, + uint32_t *count, + uint32_t unknown1, + uint32_t unknown2); +NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_LSARADTREPORTSECURITYEVENT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx); #endif /* __CLI_LSARPC__ */ diff --git a/source3/librpc/gen_ndr/cli_netlogon.c b/source3/librpc/gen_ndr/cli_netlogon.c index addf9f80d1..efabf2e08f 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.c +++ b/source3/librpc/gen_ndr/cli_netlogon.c @@ -6,7 +6,13 @@ #include "includes.h" #include "librpc/gen_ndr/cli_netlogon.h" -NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, const char *workstation, struct netr_UasInfo *info, WERROR *werror) +NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + const char *workstation, + struct netr_UasInfo *info, + WERROR *werror) { struct netr_LogonUasLogon r; NTSTATUS status; @@ -16,17 +22,24 @@ NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.account_name = account_name; r.in.workstation = workstation; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonUasLogon, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONUASLOGON, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONUASLOGON, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -45,7 +58,13 @@ NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, const char *workstation, struct netr_UasLogoffInfo *info, WERROR *werror) +NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + const char *workstation, + struct netr_UasLogoffInfo *info, + WERROR *werror) { struct netr_LogonUasLogoff r; NTSTATUS status; @@ -55,17 +74,24 @@ NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.account_name = account_name; r.in.workstation = workstation; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonUasLogoff, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONUASLOGOFF, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONUASLOGOFF, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -82,7 +108,17 @@ NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative) +NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint16_t logon_level, + union netr_LogonLevel logon, + uint16_t validation_level, + union netr_Validation *validation, + uint8_t *authoritative) { struct netr_LogonSamLogon r; NTSTATUS status; @@ -96,17 +132,24 @@ NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.logon = logon; r.in.validation_level = validation_level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonSamLogon, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGON, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONSAMLOGON, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -123,7 +166,14 @@ NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return r.out.result; } -NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon) +NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint16_t logon_level, + union netr_LogonLevel logon) { struct netr_LogonSamLogoff r; NTSTATUS status; @@ -136,17 +186,24 @@ NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.logon_level = logon_level; r.in.logon = logon; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonSamLogoff, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGOFF, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONSAMLOGOFF, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -161,7 +218,11 @@ NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem return r.out.result; } -NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Credential *credentials) +NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Credential *credentials) { struct netr_ServerReqChallenge r; NTSTATUS status; @@ -171,17 +232,24 @@ NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli, TALLOC_CTX r.in.computer_name = computer_name; r.in.credentials = credentials; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerReqChallenge, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERREQCHALLENGE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_SERVERREQCHALLENGE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerReqChallenge, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -194,7 +262,13 @@ NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials) +NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Credential *credentials) { struct netr_ServerAuthenticate r; NTSTATUS status; @@ -206,17 +280,24 @@ NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli, TALLOC_CTX r.in.computer_name = computer_name; r.in.credentials = credentials; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERAUTHENTICATE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_SERVERAUTHENTICATE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -229,7 +310,15 @@ NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Authenticator credential, struct samr_Password new_password, struct netr_Authenticator *return_authenticator) +NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Authenticator credential, + struct samr_Password new_password, + struct netr_Authenticator *return_authenticator) { struct netr_ServerPasswordSet r; NTSTATUS status; @@ -242,17 +331,24 @@ NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.credential = credential; r.in.new_password = new_password; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERPASSWORDSET, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_SERVERPASSWORDSET, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -265,7 +361,16 @@ NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, TALLOC_CTX * return r.out.result; } -NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint64_t *sequence_num, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array) +NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + enum netr_SamDatabaseID database_id, + uint64_t *sequence_num, + uint32_t preferredmaximumlength, + struct netr_DELTA_ENUM_ARRAY *delta_enum_array) { struct netr_DatabaseDeltas r; NTSTATUS status; @@ -279,17 +384,24 @@ NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.sequence_num = sequence_num; r.in.preferredmaximumlength = preferredmaximumlength; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DatabaseDeltas, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASEDELTAS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DATABASEDELTAS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -306,7 +418,16 @@ NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem return r.out.result; } -NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint32_t *sync_context, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array) +NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + enum netr_SamDatabaseID database_id, + uint32_t *sync_context, + uint32_t preferredmaximumlength, + struct netr_DELTA_ENUM_ARRAY *delta_enum_array) { struct netr_DatabaseSync r; NTSTATUS status; @@ -320,17 +441,24 @@ NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.sync_context = sync_context; r.in.preferredmaximumlength = preferredmaximumlength; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DatabaseSync, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASESYNC, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DATABASESYNC, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -347,7 +475,20 @@ NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, struct netr_UAS_INFO_0 uas, uint32_t count, uint32_t level, uint32_t buffersize, struct netr_AccountBuffer *buffer, uint32_t *count_returned, uint32_t *total_entries, struct netr_UAS_INFO_0 *recordid) +NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + struct netr_UAS_INFO_0 uas, + uint32_t count, + uint32_t level, + uint32_t buffersize, + struct netr_AccountBuffer *buffer, + uint32_t *count_returned, + uint32_t *total_entries, + struct netr_UAS_INFO_0 *recordid) { struct netr_AccountDeltas r; NTSTATUS status; @@ -362,17 +503,24 @@ NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.level = level; r.in.buffersize = buffersize; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_AccountDeltas, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_ACCOUNTDELTAS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_ACCOUNTDELTAS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -389,7 +537,20 @@ NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return r.out.result; } -NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, uint32_t reference, uint32_t level, uint32_t buffersize, struct netr_AccountBuffer *buffer, uint32_t *count_returned, uint32_t *total_entries, uint32_t *next_reference, struct netr_UAS_INFO_0 *recordid) +NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + uint32_t reference, + uint32_t level, + uint32_t buffersize, + struct netr_AccountBuffer *buffer, + uint32_t *count_returned, + uint32_t *total_entries, + uint32_t *next_reference, + struct netr_UAS_INFO_0 *recordid) { struct netr_AccountSync r; NTSTATUS status; @@ -404,17 +565,24 @@ NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.buffersize = buffersize; r.in.recordid = recordid; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_AccountSync, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_ACCOUNTSYNC, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_ACCOUNTSYNC, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_AccountSync, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -432,7 +600,11 @@ NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return r.out.result; } -NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *domainname, const char **dcname) +NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *domainname, + const char **dcname) { struct netr_GetDcName r; NTSTATUS status; @@ -441,17 +613,24 @@ NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.logon_server = logon_server; r.in.domainname = domainname; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_GetDcName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_GETDCNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_GETDCNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_GetDcName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -464,7 +643,13 @@ NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return r.out.result; } -NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, enum netr_LogonControlCode function_code, uint32_t level, union netr_CONTROL_QUERY_INFORMATION *info, WERROR *werror) +NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + enum netr_LogonControlCode function_code, + uint32_t level, + union netr_CONTROL_QUERY_INFORMATION *info, + WERROR *werror) { struct netr_LogonControl r; NTSTATUS status; @@ -474,17 +659,24 @@ NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.function_code = function_code; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonControl, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONCONTROL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONCONTROL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonControl, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -501,7 +693,12 @@ NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *domainname, const char **dcname, WERROR *werror) +NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *domainname, + const char **dcname, + WERROR *werror) { struct netr_GetAnyDCName r; NTSTATUS status; @@ -510,17 +707,24 @@ NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.logon_server = logon_server; r.in.domainname = domainname; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_GetAnyDCName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_GETANYDCNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_GETANYDCNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -537,7 +741,14 @@ NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, uint32_t function_code, uint32_t level, union netr_CONTROL_DATA_INFORMATION data, union netr_CONTROL_QUERY_INFORMATION *query, WERROR *werror) +NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + uint32_t function_code, + uint32_t level, + union netr_CONTROL_DATA_INFORMATION data, + union netr_CONTROL_QUERY_INFORMATION *query, + WERROR *werror) { struct netr_LogonControl2 r; NTSTATUS status; @@ -548,17 +759,24 @@ NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.level = level; r.in.data = data; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonControl2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONCONTROL2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONCONTROL2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonControl2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -575,7 +793,14 @@ NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials, uint32_t *negotiate_flags) +NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Credential *credentials, + uint32_t *negotiate_flags) { struct netr_ServerAuthenticate2 r; NTSTATUS status; @@ -588,17 +813,24 @@ NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, TALLOC_CTX r.in.credentials = credentials; r.in.negotiate_flags = negotiate_flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERAUTHENTICATE2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_SERVERAUTHENTICATE2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -612,7 +844,17 @@ NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint16_t restart_state, uint32_t *sync_context, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array) +NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + enum netr_SamDatabaseID database_id, + uint16_t restart_state, + uint32_t *sync_context, + uint32_t preferredmaximumlength, + struct netr_DELTA_ENUM_ARRAY *delta_enum_array) { struct netr_DatabaseSync2 r; NTSTATUS status; @@ -627,17 +869,24 @@ NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.sync_context = sync_context; r.in.preferredmaximumlength = preferredmaximumlength; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DatabaseSync2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASESYNC2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DATABASESYNC2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -654,7 +903,15 @@ NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return r.out.result; } -NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, uint8_t *change_log_entry, uint32_t change_log_entry_size, struct netr_DELTA_ENUM_ARRAY *delta_enum_array) +NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + uint8_t *change_log_entry, + uint32_t change_log_entry_size, + struct netr_DELTA_ENUM_ARRAY *delta_enum_array) { struct netr_DatabaseRedo r; NTSTATUS status; @@ -667,17 +924,24 @@ NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.change_log_entry = change_log_entry; r.in.change_log_entry_size = change_log_entry_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DatabaseRedo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DATABASEREDO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DATABASEREDO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -693,7 +957,14 @@ NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, uint32_t function_code, uint32_t level, union netr_CONTROL_DATA_INFORMATION data, union netr_CONTROL_QUERY_INFORMATION *query, WERROR *werror) +NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + uint32_t function_code, + uint32_t level, + union netr_CONTROL_DATA_INFORMATION data, + union netr_CONTROL_QUERY_INFORMATION *query, + WERROR *werror) { struct netr_LogonControl2Ex r; NTSTATUS status; @@ -704,17 +975,24 @@ NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.level = level; r.in.data = data; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonControl2Ex, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONCONTROL2EX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONCONTROL2EX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -731,24 +1009,33 @@ NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, TALLOC_CTX *me return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRENUMERATETRUSTEDDOMAINS r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -764,7 +1051,15 @@ NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, TA return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *domain_name, struct GUID *domain_guid, struct GUID *site_guid, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror) +NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *domain_name, + struct GUID *domain_guid, + struct GUID *site_guid, + uint32_t flags, + struct netr_DsRGetDCNameInfo *info, + WERROR *werror) { struct netr_DsRGetDCName r; NTSTATUS status; @@ -776,17 +1071,24 @@ NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.site_guid = site_guid; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsRGetDCName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRGETDCNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -805,24 +1107,33 @@ NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRLOGONDUMMYROUTINE1 r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONDUMMYROUTINE1, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONDUMMYROUTINE1, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRLOGONDUMMYROUTINE1, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONDUMMYROUTINE1, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -838,24 +1149,33 @@ NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRLOGONSETSERVICEBITS r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONSETSERVICEBITS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRLOGONSETSERVICEBITS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -871,24 +1191,33 @@ NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, TALLOC return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRLOGONGETTRUSTRID r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONGETTRUSTRID, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRLOGONGETTRUSTRID, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -904,24 +1233,33 @@ NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRLOGONCOMPUTESERVERDIGEST r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -937,24 +1275,33 @@ NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, T return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRLOGONCOMPUTECLIENTDIGEST r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -970,7 +1317,15 @@ NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli, T return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials, uint32_t *negotiate_flags, uint32_t *rid) +NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Credential *credentials, + uint32_t *negotiate_flags, + uint32_t *rid) { struct netr_ServerAuthenticate3 r; NTSTATUS status; @@ -983,17 +1338,24 @@ NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, TALLOC_CTX r.in.credentials = credentials; r.in.negotiate_flags = negotiate_flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERAUTHENTICATE3, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_SERVERAUTHENTICATE3, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1008,7 +1370,15 @@ NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *domain_name, struct GUID *domain_guid, const char *site_name, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror) +NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *domain_name, + struct GUID *domain_guid, + const char *site_name, + uint32_t flags, + struct netr_DsRGetDCNameInfo *info, + WERROR *werror) { struct netr_DsRGetDCNameEx r; NTSTATUS status; @@ -1020,17 +1390,24 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.site_name = site_name; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCNAMEEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRGETDCNAMEEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1049,7 +1426,11 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site, WERROR *werror) +NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *computer_name, + const char **site, + WERROR *werror) { struct netr_DsRGetSiteName r; NTSTATUS status; @@ -1057,17 +1438,24 @@ NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, TALLOC_CTX *mem /* In parameters */ r.in.computer_name = computer_name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETSITENAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRGETSITENAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1084,7 +1472,15 @@ NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint32_t level, union netr_DomainQuery query, union netr_DomainInfo *info) +NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint32_t level, + union netr_DomainQuery query, + union netr_DomainInfo *info) { struct netr_LogonGetDomainInfo r; NTSTATUS status; @@ -1097,17 +1493,24 @@ NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX r.in.level = level; r.in.query = query; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONGETDOMAININFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONGETDOMAININFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1121,7 +1524,15 @@ NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Authenticator credential, struct netr_CryptPassword new_password, struct netr_Authenticator *return_authenticator) +NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Authenticator credential, + struct netr_CryptPassword new_password, + struct netr_Authenticator *return_authenticator) { struct netr_ServerPasswordSet2 r; NTSTATUS status; @@ -1134,17 +1545,24 @@ NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, TALLOC_CTX r.in.credential = credential; r.in.new_password = new_password; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_SERVERPASSWORDSET2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_SERVERPASSWORDSET2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1157,24 +1575,33 @@ NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, TALLOC_CTX return r.out.result; } -NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRSERVERPASSWORDGET r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRSERVERPASSWORDGET, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRSERVERPASSWORDGET, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRSERVERPASSWORDGET, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRSERVERPASSWORDGET, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1190,24 +1617,33 @@ NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRLOGONSENDTOSAM r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONSENDTOSAM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRLOGONSENDTOSAM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1223,24 +1659,33 @@ NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_DSRADDRESSTOSITENAMESW r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRADDRESSTOSITENAMESW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRADDRESSTOSITENAMESW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1256,7 +1701,17 @@ NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client_account, uint32_t mask, const char *domain_name, struct GUID *domain_guid, const char *site_name, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror) +NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *client_account, + uint32_t mask, + const char *domain_name, + struct GUID *domain_guid, + const char *site_name, + uint32_t flags, + struct netr_DsRGetDCNameInfo *info, + WERROR *werror) { struct netr_DsRGetDCNameEx2 r; NTSTATUS status; @@ -1270,17 +1725,24 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.site_name = site_name; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCNAMEEX2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRGETDCNAMEEX2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1299,24 +1761,33 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *me return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1332,24 +1803,33 @@ NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRENUMERATETRUSTEDDOMAINSEX r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1365,24 +1845,33 @@ NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_DSRADDRESSTOSITENAMESEXW r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRADDRESSTOSITENAMESEXW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRADDRESSTOSITENAMESEXW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1398,24 +1887,33 @@ NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_DSRGETDCSITECOVERAGEW r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRGETDCSITECOVERAGEW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETDCSITECOVERAGEW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRGETDCSITECOVERAGEW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRGETDCSITECOVERAGEW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1431,7 +1929,16 @@ NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative, uint32_t *flags) +NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + uint16_t logon_level, + union netr_LogonLevel logon, + uint16_t validation_level, + union netr_Validation *validation, + uint8_t *authoritative, + uint32_t *flags) { struct netr_LogonSamLogonEx r; NTSTATUS status; @@ -1444,17 +1951,24 @@ NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.validation_level = validation_level; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGONEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONSAMLOGONEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1469,7 +1983,13 @@ NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *me return r.out.result; } -NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t trust_flags, uint32_t *count, struct netr_DomainTrust **trusts, WERROR *werror) +NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t trust_flags, + uint32_t *count, + struct netr_DomainTrust **trusts, + WERROR *werror) { struct netr_DsrEnumerateDomainTrusts r; NTSTATUS status; @@ -1478,17 +1998,24 @@ NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLO r.in.server_name = server_name; r.in.trust_flags = trust_flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRENUMERATEDOMAINTRUSTS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRENUMERATEDOMAINTRUSTS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1506,24 +2033,33 @@ NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_DSRDEREGISTERDNSHOSTRECORDS r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1539,24 +2075,33 @@ NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, TA return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRSERVERTRUSTPASSWORDSGET r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRSERVERTRUSTPASSWORDSGET, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRSERVERTRUSTPASSWORDSGET, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1572,24 +2117,33 @@ NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, TA return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_DSRGETFORESTTRUSTINFORMATION r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_DSRGETFORESTTRUSTINFORMATION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_DSRGETFORESTTRUSTINFORMATION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1605,24 +2159,33 @@ NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, T return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRGETFORESTTRUSTINFORMATION r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRGETFORESTTRUSTINFORMATION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRGETFORESTTRUSTINFORMATION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1638,7 +2201,18 @@ NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative, uint32_t *flags) +NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint16_t logon_level, + union netr_LogonLevel logon, + uint16_t validation_level, + union netr_Validation *validation, + uint8_t *authoritative, + uint32_t *flags) { struct netr_LogonSamLogonWithFlags r; NTSTATUS status; @@ -1653,17 +2227,24 @@ NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_ r.in.validation_level = validation_level; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_LOGONSAMLOGONWITHFLAGS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_LOGONSAMLOGONWITHFLAGS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1681,24 +2262,33 @@ NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_ return r.out.result; } -NTSTATUS rpccli_netr_NETRSERVERGETTRUSTINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_netr_NETRSERVERGETTRUSTINFO(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct netr_NETRSERVERGETTRUSTINFO r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRSERVERGETTRUSTINFO, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, NDR_NETR_NETRSERVERGETTRUSTINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_NETLOGON, + &ndr_table_netlogon, + NDR_NETR_NETRSERVERGETTRUSTINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRSERVERGETTRUSTINFO, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_netlogon.h b/source3/librpc/gen_ndr/cli_netlogon.h index 4273fedf13..9409077d09 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.h +++ b/source3/librpc/gen_ndr/cli_netlogon.h @@ -1,51 +1,312 @@ #include "librpc/gen_ndr/ndr_netlogon.h" #ifndef __CLI_NETLOGON__ #define __CLI_NETLOGON__ -NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, const char *workstation, struct netr_UasInfo *info, WERROR *werror); -NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, const char *workstation, struct netr_UasLogoffInfo *info, WERROR *werror); -NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative); -NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon); -NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Credential *credentials); -NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials); -NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Authenticator credential, struct samr_Password new_password, struct netr_Authenticator *return_authenticator); -NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint64_t *sequence_num, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array); -NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint32_t *sync_context, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array); -NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, struct netr_UAS_INFO_0 uas, uint32_t count, uint32_t level, uint32_t buffersize, struct netr_AccountBuffer *buffer, uint32_t *count_returned, uint32_t *total_entries, struct netr_UAS_INFO_0 *recordid); -NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, uint32_t reference, uint32_t level, uint32_t buffersize, struct netr_AccountBuffer *buffer, uint32_t *count_returned, uint32_t *total_entries, uint32_t *next_reference, struct netr_UAS_INFO_0 *recordid); -NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *domainname, const char **dcname); -NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, enum netr_LogonControlCode function_code, uint32_t level, union netr_CONTROL_QUERY_INFORMATION *info, WERROR *werror); -NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *domainname, const char **dcname, WERROR *werror); -NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, uint32_t function_code, uint32_t level, union netr_CONTROL_DATA_INFORMATION data, union netr_CONTROL_QUERY_INFORMATION *query, WERROR *werror); -NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials, uint32_t *negotiate_flags); -NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, enum netr_SamDatabaseID database_id, uint16_t restart_state, uint32_t *sync_context, uint32_t preferredmaximumlength, struct netr_DELTA_ENUM_ARRAY *delta_enum_array); -NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, const char *computername, struct netr_Authenticator credential, struct netr_Authenticator *return_authenticator, uint8_t *change_log_entry, uint32_t change_log_entry_size, struct netr_DELTA_ENUM_ARRAY *delta_enum_array); -NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *logon_server, uint32_t function_code, uint32_t level, union netr_CONTROL_DATA_INFORMATION data, union netr_CONTROL_QUERY_INFORMATION *query, WERROR *werror); -NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *domain_name, struct GUID *domain_guid, struct GUID *site_guid, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror); -NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Credential *credentials, uint32_t *negotiate_flags, uint32_t *rid); -NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *domain_name, struct GUID *domain_guid, const char *site_name, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror); -NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site, WERROR *werror); -NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint32_t level, union netr_DomainQuery query, union netr_DomainInfo *info); -NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account_name, enum netr_SchannelType secure_channel_type, const char *computer_name, struct netr_Authenticator credential, struct netr_CryptPassword new_password, struct netr_Authenticator *return_authenticator); -NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client_account, uint32_t mask, const char *domain_name, struct GUID *domain_guid, const char *site_name, uint32_t flags, struct netr_DsRGetDCNameInfo *info, WERROR *werror); -NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative, uint32_t *flags); -NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t trust_flags, uint32_t *count, struct netr_DomainTrust **trusts, WERROR *werror); -NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *computer_name, struct netr_Authenticator *credential, struct netr_Authenticator *return_authenticator, uint16_t logon_level, union netr_LogonLevel logon, uint16_t validation_level, union netr_Validation *validation, uint8_t *authoritative, uint32_t *flags); -NTSTATUS rpccli_netr_NETRSERVERGETTRUSTINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); +NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + const char *workstation, + struct netr_UasInfo *info, + WERROR *werror); +NTSTATUS rpccli_netr_LogonUasLogoff(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + const char *workstation, + struct netr_UasLogoffInfo *info, + WERROR *werror); +NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint16_t logon_level, + union netr_LogonLevel logon, + uint16_t validation_level, + union netr_Validation *validation, + uint8_t *authoritative); +NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint16_t logon_level, + union netr_LogonLevel logon); +NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Credential *credentials); +NTSTATUS rpccli_netr_ServerAuthenticate(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Credential *credentials); +NTSTATUS rpccli_netr_ServerPasswordSet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Authenticator credential, + struct samr_Password new_password, + struct netr_Authenticator *return_authenticator); +NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + enum netr_SamDatabaseID database_id, + uint64_t *sequence_num, + uint32_t preferredmaximumlength, + struct netr_DELTA_ENUM_ARRAY *delta_enum_array); +NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + enum netr_SamDatabaseID database_id, + uint32_t *sync_context, + uint32_t preferredmaximumlength, + struct netr_DELTA_ENUM_ARRAY *delta_enum_array); +NTSTATUS rpccli_netr_AccountDeltas(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + struct netr_UAS_INFO_0 uas, + uint32_t count, + uint32_t level, + uint32_t buffersize, + struct netr_AccountBuffer *buffer, + uint32_t *count_returned, + uint32_t *total_entries, + struct netr_UAS_INFO_0 *recordid); +NTSTATUS rpccli_netr_AccountSync(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + uint32_t reference, + uint32_t level, + uint32_t buffersize, + struct netr_AccountBuffer *buffer, + uint32_t *count_returned, + uint32_t *total_entries, + uint32_t *next_reference, + struct netr_UAS_INFO_0 *recordid); +NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *domainname, + const char **dcname); +NTSTATUS rpccli_netr_LogonControl(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + enum netr_LogonControlCode function_code, + uint32_t level, + union netr_CONTROL_QUERY_INFORMATION *info, + WERROR *werror); +NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *domainname, + const char **dcname, + WERROR *werror); +NTSTATUS rpccli_netr_LogonControl2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + uint32_t function_code, + uint32_t level, + union netr_CONTROL_DATA_INFORMATION data, + union netr_CONTROL_QUERY_INFORMATION *query, + WERROR *werror); +NTSTATUS rpccli_netr_ServerAuthenticate2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Credential *credentials, + uint32_t *negotiate_flags); +NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + enum netr_SamDatabaseID database_id, + uint16_t restart_state, + uint32_t *sync_context, + uint32_t preferredmaximumlength, + struct netr_DELTA_ENUM_ARRAY *delta_enum_array); +NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + const char *computername, + struct netr_Authenticator credential, + struct netr_Authenticator *return_authenticator, + uint8_t *change_log_entry, + uint32_t change_log_entry_size, + struct netr_DELTA_ENUM_ARRAY *delta_enum_array); +NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *logon_server, + uint32_t function_code, + uint32_t level, + union netr_CONTROL_DATA_INFORMATION data, + union netr_CONTROL_QUERY_INFORMATION *query, + WERROR *werror); +NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *domain_name, + struct GUID *domain_guid, + struct GUID *site_guid, + uint32_t flags, + struct netr_DsRGetDCNameInfo *info, + WERROR *werror); +NTSTATUS rpccli_netr_NETRLOGONDUMMYROUTINE1(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_NETRLOGONSETSERVICEBITS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_NETRLOGONGETTRUSTRID(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_NETRLOGONCOMPUTESERVERDIGEST(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_ServerAuthenticate3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Credential *credentials, + uint32_t *negotiate_flags, + uint32_t *rid); +NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *domain_name, + struct GUID *domain_guid, + const char *site_name, + uint32_t flags, + struct netr_DsRGetDCNameInfo *info, + WERROR *werror); +NTSTATUS rpccli_netr_DsRGetSiteName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *computer_name, + const char **site, + WERROR *werror); +NTSTATUS rpccli_netr_LogonGetDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint32_t level, + union netr_DomainQuery query, + union netr_DomainInfo *info); +NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Authenticator credential, + struct netr_CryptPassword new_password, + struct netr_Authenticator *return_authenticator); +NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *client_account, + uint32_t mask, + const char *domain_name, + struct GUID *domain_guid, + const char *site_name, + uint32_t flags, + struct netr_DsRGetDCNameInfo *info, + WERROR *werror); +NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + uint16_t logon_level, + union netr_LogonLevel logon, + uint16_t validation_level, + union netr_Validation *validation, + uint8_t *authoritative, + uint32_t *flags); +NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t trust_flags, + uint32_t *count, + struct netr_DomainTrust **trusts, + WERROR *werror); +NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint16_t logon_level, + union netr_LogonLevel logon, + uint16_t validation_level, + union netr_Validation *validation, + uint8_t *authoritative, + uint32_t *flags); +NTSTATUS rpccli_netr_NETRSERVERGETTRUSTINFO(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); #endif /* __CLI_NETLOGON__ */ diff --git a/source3/librpc/gen_ndr/cli_srvsvc.c b/source3/librpc/gen_ndr/cli_srvsvc.c index 9353390e96..2b1d050a14 100644 --- a/source3/librpc/gen_ndr/cli_srvsvc.c +++ b/source3/librpc/gen_ndr/cli_srvsvc.c @@ -6,7 +6,15 @@ #include "includes.h" #include "librpc/gen_ndr/cli_srvsvc.h" -NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetCharDevCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t *level, + union srvsvc_NetCharDevCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror) { struct srvsvc_NetCharDevEnum r; NTSTATUS status; @@ -18,17 +26,24 @@ NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETCHARDEVENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -50,7 +65,13 @@ NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, uint32_t level, union srvsvc_NetCharDevInfo *info, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *device_name, + uint32_t level, + union srvsvc_NetCharDevInfo *info, + WERROR *werror) { struct srvsvc_NetCharDevGetInfo r; NTSTATUS status; @@ -60,17 +81,24 @@ NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX r.in.device_name = device_name; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevGetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVGETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETCHARDEVGETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevGetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -87,7 +115,12 @@ NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, uint32_t opcode, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *device_name, + uint32_t opcode, + WERROR *werror) { struct srvsvc_NetCharDevControl r; NTSTATUS status; @@ -97,17 +130,24 @@ NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli, TALLOC_CTX r.in.device_name = device_name; r.in.opcode = opcode; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevControl, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVCONTROL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETCHARDEVCONTROL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevControl, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -123,7 +163,16 @@ NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *user, uint32_t *level, union srvsvc_NetCharDevQCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *user, + uint32_t *level, + union srvsvc_NetCharDevQCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror) { struct srvsvc_NetCharDevQEnum r; NTSTATUS status; @@ -136,17 +185,24 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETCHARDEVQENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -168,7 +224,14 @@ NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, const char *user, uint32_t level, union srvsvc_NetCharDevQInfo *info, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *queue_name, + const char *user, + uint32_t level, + union srvsvc_NetCharDevQInfo *info, + WERROR *werror) { struct srvsvc_NetCharDevQGetInfo r; NTSTATUS status; @@ -179,17 +242,24 @@ NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli, TALLOC_CT r.in.user = user; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQGetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQGETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETCHARDEVQGETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQGetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -206,7 +276,14 @@ NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, uint32_t level, union srvsvc_NetCharDevQInfo info, uint32_t *parm_error, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *queue_name, + uint32_t level, + union srvsvc_NetCharDevQInfo info, + uint32_t *parm_error, + WERROR *werror) { struct srvsvc_NetCharDevQSetInfo r; NTSTATUS status; @@ -218,17 +295,24 @@ NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli, TALLOC_CT r.in.info = info; r.in.parm_error = parm_error; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQSetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQSETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETCHARDEVQSETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQSetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -247,7 +331,11 @@ NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *queue_name, + WERROR *werror) { struct srvsvc_NetCharDevQPurge r; NTSTATUS status; @@ -256,17 +344,24 @@ NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli, TALLOC_CTX r.in.server_unc = server_unc; r.in.queue_name = queue_name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurge, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQPURGE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETCHARDEVQPURGE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurge, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -282,7 +377,12 @@ NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, const char *computer_name, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *queue_name, + const char *computer_name, + WERROR *werror) { struct srvsvc_NetCharDevQPurgeSelf r; NTSTATUS status; @@ -292,17 +392,24 @@ NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli, TALLOC_ r.in.queue_name = queue_name; r.in.computer_name = computer_name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurgeSelf, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCHARDEVQPURGESELF, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETCHARDEVQPURGESELF, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurgeSelf, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -318,7 +425,16 @@ NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint32_t *level, union srvsvc_NetConnCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path, + uint32_t *level, + union srvsvc_NetConnCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror) { struct srvsvc_NetConnEnum r; NTSTATUS status; @@ -331,17 +447,24 @@ NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetConnEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETCONNENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETCONNENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetConnEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -363,7 +486,17 @@ NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, const char *user, uint32_t *level, union srvsvc_NetFileCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path, + const char *user, + uint32_t *level, + union srvsvc_NetFileCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror) { struct srvsvc_NetFileEnum r; NTSTATUS status; @@ -377,17 +510,24 @@ NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetFileEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETFILEENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETFILEENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetFileEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -409,7 +549,13 @@ NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t fid, uint32_t level, union srvsvc_NetFileInfo *info, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t fid, + uint32_t level, + union srvsvc_NetFileInfo *info, + WERROR *werror) { struct srvsvc_NetFileGetInfo r; NTSTATUS status; @@ -419,17 +565,24 @@ NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.fid = fid; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetFileGetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETFILEGETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETFILEGETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetFileGetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -446,7 +599,11 @@ NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t fid, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t fid, + WERROR *werror) { struct srvsvc_NetFileClose r; NTSTATUS status; @@ -455,17 +612,24 @@ NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.server_unc = server_unc; r.in.fid = fid; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetFileClose, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETFILECLOSE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETFILECLOSE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetFileClose, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -481,7 +645,17 @@ NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client, const char *user, uint32_t *level, union srvsvc_NetSessCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *client, + const char *user, + uint32_t *level, + union srvsvc_NetSessCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror) { struct srvsvc_NetSessEnum r; NTSTATUS status; @@ -495,17 +669,24 @@ NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSessEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSESSENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSESSENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSessEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -527,7 +708,12 @@ NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client, const char *user, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *client, + const char *user, + WERROR *werror) { struct srvsvc_NetSessDel r; NTSTATUS status; @@ -537,17 +723,24 @@ NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.client = client; r.in.user = user; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSessDel, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSESSDEL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSESSDEL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSessDel, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -563,7 +756,13 @@ NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetShareInfo info, uint32_t *parm_error, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetShareInfo info, + uint32_t *parm_error, + WERROR *werror) { struct srvsvc_NetShareAdd r; NTSTATUS status; @@ -574,17 +773,24 @@ NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.info = info; r.in.parm_error = parm_error; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareAdd, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREADD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHAREADD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareAdd, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -603,7 +809,15 @@ NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetShareCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t *level, + union srvsvc_NetShareCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror) { struct srvsvc_NetShareEnumAll r; NTSTATUS status; @@ -615,17 +829,24 @@ NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnumAll, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREENUMALL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHAREENUMALL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnumAll, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -647,7 +868,13 @@ NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t level, union srvsvc_NetShareInfo *info, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share_name, + uint32_t level, + union srvsvc_NetShareInfo *info, + WERROR *werror) { struct srvsvc_NetShareGetInfo r; NTSTATUS status; @@ -657,17 +884,24 @@ NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.share_name = share_name; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareGetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREGETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHAREGETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareGetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -684,7 +918,14 @@ NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t level, union srvsvc_NetShareInfo info, uint32_t *parm_error, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share_name, + uint32_t level, + union srvsvc_NetShareInfo info, + uint32_t *parm_error, + WERROR *werror) { struct srvsvc_NetShareSetInfo r; NTSTATUS status; @@ -696,17 +937,24 @@ NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.info = info; r.in.parm_error = parm_error; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareSetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHARESETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHARESETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareSetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -725,7 +973,12 @@ NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t reserved, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share_name, + uint32_t reserved, + WERROR *werror) { struct srvsvc_NetShareDel r; NTSTATUS status; @@ -735,17 +988,24 @@ NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.share_name = share_name; r.in.reserved = reserved; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareDel, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDEL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHAREDEL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDel, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -761,7 +1021,12 @@ NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t reserved, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share_name, + uint32_t reserved, + WERROR *werror) { struct srvsvc_NetShareDelSticky r; NTSTATUS status; @@ -771,17 +1036,24 @@ NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli, TALLOC_CTX r.in.share_name = share_name; r.in.reserved = reserved; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelSticky, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDELSTICKY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHAREDELSTICKY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelSticky, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -797,7 +1069,12 @@ NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, enum srvsvc_ShareType *type, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *device_name, + enum srvsvc_ShareType *type, + WERROR *werror) { struct srvsvc_NetShareCheck r; NTSTATUS status; @@ -806,17 +1083,24 @@ NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.server_unc = server_unc; r.in.device_name = device_name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareCheck, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHARECHECK, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHARECHECK, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareCheck, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -833,7 +1117,12 @@ NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli, TALLOC_CTX *me return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetSrvInfo *info, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetSrvInfo *info, + WERROR *werror) { struct srvsvc_NetSrvGetInfo r; NTSTATUS status; @@ -842,17 +1131,24 @@ NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.server_unc = server_unc; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSrvGetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSRVGETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSRVGETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvGetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -869,7 +1165,13 @@ NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *me return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetSrvInfo info, uint32_t *parm_error, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetSrvInfo info, + uint32_t *parm_error, + WERROR *werror) { struct srvsvc_NetSrvSetInfo r; NTSTATUS status; @@ -880,17 +1182,24 @@ NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.info = info; r.in.parm_error = parm_error; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSrvSetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSRVSETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSRVSETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvSetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -909,7 +1218,15 @@ NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *me return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, struct srvsvc_NetDiskInfo *info, uint32_t maxlen, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + struct srvsvc_NetDiskInfo *info, + uint32_t maxlen, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror) { struct srvsvc_NetDiskEnum r; NTSTATUS status; @@ -921,17 +1238,24 @@ NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.maxlen = maxlen; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetDiskEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETDISKENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETDISKENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetDiskEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -952,7 +1276,14 @@ NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *service, uint32_t level, uint32_t options, struct srvsvc_Statistics *stats, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *service, + uint32_t level, + uint32_t options, + struct srvsvc_Statistics *stats, + WERROR *werror) { struct srvsvc_NetServerStatisticsGet r; NTSTATUS status; @@ -963,17 +1294,24 @@ NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, TALLO r.in.level = level; r.in.options = options; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetServerStatisticsGet, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSERVERSTATISTICSGET, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSERVERSTATISTICSGET, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetServerStatisticsGet, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -990,7 +1328,12 @@ NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetTransportInfo info, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetTransportInfo info, + WERROR *werror) { struct srvsvc_NetTransportAdd r; NTSTATUS status; @@ -1000,17 +1343,24 @@ NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.level = level; r.in.info = info; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetTransportAdd, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETTRANSPORTADD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETTRANSPORTADD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportAdd, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1026,7 +1376,15 @@ NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetTransportCtr *transports, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t *level, + union srvsvc_NetTransportCtr *transports, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror) { struct srvsvc_NetTransportEnum r; NTSTATUS status; @@ -1038,17 +1396,24 @@ NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetTransportEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETTRANSPORTENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETTRANSPORTENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1070,7 +1435,12 @@ NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t unknown, struct srvsvc_NetTransportInfo0 transport, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t unknown, + struct srvsvc_NetTransportInfo0 transport, + WERROR *werror) { struct srvsvc_NetTransportDel r; NTSTATUS status; @@ -1080,17 +1450,24 @@ NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.unknown = unknown; r.in.transport = transport; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetTransportDel, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETTRANSPORTDEL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETTRANSPORTDEL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportDel, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1106,7 +1483,11 @@ NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, struct srvsvc_NetRemoteTODInfo *info, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + struct srvsvc_NetRemoteTODInfo *info, + WERROR *werror) { struct srvsvc_NetRemoteTOD r; NTSTATUS status; @@ -1114,17 +1495,24 @@ NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, TALLOC_CTX *mem /* In parameters */ r.in.server_unc = server_unc; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetRemoteTOD, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETREMOTETOD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETREMOTETOD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetRemoteTOD, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1143,7 +1531,13 @@ NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *transport, uint32_t servicebits, uint32_t updateimmediately, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *transport, + uint32_t servicebits, + uint32_t updateimmediately, + WERROR *werror) { struct srvsvc_NetSetServiceBits r; NTSTATUS status; @@ -1154,17 +1548,24 @@ NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli, TALLOC_CTX r.in.servicebits = servicebits; r.in.updateimmediately = updateimmediately; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSetServiceBits, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSETSERVICEBITS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSETSERVICEBITS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSetServiceBits, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1180,7 +1581,13 @@ NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint32_t pathflags, uint32_t *pathtype, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path, + uint32_t pathflags, + uint32_t *pathtype, + WERROR *werror) { struct srvsvc_NetPathType r; NTSTATUS status; @@ -1190,17 +1597,24 @@ NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.path = path; r.in.pathflags = pathflags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetPathType, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPATHTYPE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETPATHTYPE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetPathType, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1217,7 +1631,16 @@ NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint8_t *can_path, uint32_t maxbuf, const char *prefix, uint32_t *pathtype, uint32_t pathflags, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path, + uint8_t *can_path, + uint32_t maxbuf, + const char *prefix, + uint32_t *pathtype, + uint32_t pathflags, + WERROR *werror) { struct srvsvc_NetPathCanonicalize r; NTSTATUS status; @@ -1230,17 +1653,24 @@ NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, TALLOC_C r.in.pathtype = pathtype; r.in.pathflags = pathflags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetPathCanonicalize, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPATHCANONICALIZE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETPATHCANONICALIZE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCanonicalize, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1258,7 +1688,14 @@ NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path1, const char *path2, uint32_t pathtype, uint32_t pathflags, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path1, + const char *path2, + uint32_t pathtype, + uint32_t pathflags, + WERROR *werror) { struct srvsvc_NetPathCompare r; NTSTATUS status; @@ -1270,17 +1707,24 @@ NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.pathtype = pathtype; r.in.pathflags = pathflags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetPathCompare, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPATHCOMPARE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETPATHCOMPARE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCompare, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1296,7 +1740,13 @@ NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *name, uint32_t name_type, uint32_t flags, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *name, + uint32_t name_type, + uint32_t flags, + WERROR *werror) { struct srvsvc_NetNameValidate r; NTSTATUS status; @@ -1307,17 +1757,24 @@ NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.name_type = name_type; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetNameValidate, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETNAMEVALIDATE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETNAMEVALIDATE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetNameValidate, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1333,24 +1790,33 @@ NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRPRNAMECANONICALIZE r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRPRNAMECANONICALIZE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRPRNAMECANONICALIZE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1366,7 +1832,14 @@ NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *name1, const char *name2, uint32_t name_type, uint32_t flags, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *name1, + const char *name2, + uint32_t name_type, + uint32_t flags, + WERROR *werror) { struct srvsvc_NetPRNameCompare r; NTSTATUS status; @@ -1378,17 +1851,24 @@ NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli, TALLOC_CTX r.in.name_type = name_type; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetPRNameCompare, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETPRNAMECOMPARE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETPRNAMECOMPARE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetPRNameCompare, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1404,7 +1884,15 @@ NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetShareCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t *level, + union srvsvc_NetShareCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror) { struct srvsvc_NetShareEnum r; NTSTATUS status; @@ -1416,17 +1904,24 @@ NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHAREENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1448,7 +1943,13 @@ NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, uint32_t reserved, struct policy_handle *hnd, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share, + uint32_t reserved, + struct policy_handle *hnd, + WERROR *werror) { struct srvsvc_NetShareDelStart r; NTSTATUS status; @@ -1458,17 +1959,24 @@ NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli, TALLOC_CTX r.in.share = share; r.in.reserved = reserved; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelStart, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDELSTART, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHAREDELSTART, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelStart, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1487,7 +1995,10 @@ NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *hnd, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *hnd, + WERROR *werror) { struct srvsvc_NetShareDelCommit r; NTSTATUS status; @@ -1495,17 +2006,24 @@ NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli, TALLOC_CTX /* In parameters */ r.in.hnd = hnd; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelCommit, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSHAREDELCOMMIT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSHAREDELCOMMIT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelCommit, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1524,7 +2042,14 @@ NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, const char *file, uint32_t securityinformation, struct sec_desc_buf *sd_buf, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share, + const char *file, + uint32_t securityinformation, + struct sec_desc_buf *sd_buf, + WERROR *werror) { struct srvsvc_NetGetFileSecurity r; NTSTATUS status; @@ -1535,17 +2060,24 @@ NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CT r.in.file = file; r.in.securityinformation = securityinformation; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetGetFileSecurity, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETGETFILESECURITY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETGETFILESECURITY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetGetFileSecurity, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1564,7 +2096,14 @@ NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, const char *file, uint32_t securityinformation, struct sec_desc_buf sd_buf, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share, + const char *file, + uint32_t securityinformation, + struct sec_desc_buf sd_buf, + WERROR *werror) { struct srvsvc_NetSetFileSecurity r; NTSTATUS status; @@ -1576,17 +2115,24 @@ NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CT r.in.securityinformation = securityinformation; r.in.sd_buf = sd_buf; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSetFileSecurity, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSETFILESECURITY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSETFILESECURITY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSetFileSecurity, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1602,7 +2148,12 @@ NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetTransportInfo info, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetTransportInfo info, + WERROR *werror) { struct srvsvc_NetServerTransportAddEx r; NTSTATUS status; @@ -1612,17 +2163,24 @@ NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli, TALL r.in.level = level; r.in.info = info; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetServerTransportAddEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSERVERTRANSPORTADDEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSERVERTRANSPORTADDEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetServerTransportAddEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1638,7 +2196,15 @@ NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli, TALL return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *emulated_server_unc, const char *transport, uint32_t servicebitsofinterest, uint32_t servicebits, uint32_t updateimmediately, WERROR *werror) +NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *emulated_server_unc, + const char *transport, + uint32_t servicebitsofinterest, + uint32_t servicebits, + uint32_t updateimmediately, + WERROR *werror) { struct srvsvc_NetServerSetServiceBitsEx r; NTSTATUS status; @@ -1651,17 +2217,24 @@ NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, TA r.in.servicebits = servicebits; r.in.updateimmediately = updateimmediately; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetServerSetServiceBitsEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETSERVERSETSERVICEBITSEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETSERVERSETSERVICEBITSEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetServerSetServiceBitsEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1677,24 +2250,33 @@ NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, TA return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSGETVERSION r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSGETVERSION, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSGETVERSION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSGETVERSION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSGETVERSION, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1710,24 +2292,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSCREATELOCALPARTITION r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSCREATELOCALPARTITION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSCREATELOCALPARTITION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1743,24 +2334,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSDELETELOCALPARTITION r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSDELETELOCALPARTITION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSDELETELOCALPARTITION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1776,24 +2376,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSSETLOCALVOLUMESTATE r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSSETLOCALVOLUMESTATE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSSETLOCALVOLUMESTATE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1809,24 +2418,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli, T return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSSETSERVERINFO r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETSERVERINFO, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSSETSERVERINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSSETSERVERINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETSERVERINFO, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1842,24 +2460,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSCREATEEXITPOINT r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSCREATEEXITPOINT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSCREATEEXITPOINT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1875,24 +2502,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSDELETEEXITPOINT r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSDELETEEXITPOINT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSDELETEEXITPOINT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1908,24 +2544,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSMODIFYPREFIX r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSMODIFYPREFIX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSMODIFYPREFIX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1941,24 +2586,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSFIXLOCALVOLUME r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSFIXLOCALVOLUME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSFIXLOCALVOLUME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1974,24 +2628,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli, TALLOC return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRDFSMANAGERREPORTSITEINFO r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRDFSMANAGERREPORTSITEINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRDFSMANAGERREPORTSITEINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -2007,24 +2670,33 @@ NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_srvsvc_NETRSERVERTRANSPORTDELEX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_srvsvc_NETRSERVERTRANSPORTDELEX(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct srvsvc_NETRSERVERTRANSPORTDELEX r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SRVSVC, &ndr_table_srvsvc, NDR_SRVSVC_NETRSERVERTRANSPORTDELEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SRVSVC, + &ndr_table_srvsvc, + NDR_SRVSVC_NETRSERVERTRANSPORTDELEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_srvsvc.h b/source3/librpc/gen_ndr/cli_srvsvc.h index 7f9385b985..eb19db37bd 100644 --- a/source3/librpc/gen_ndr/cli_srvsvc.h +++ b/source3/librpc/gen_ndr/cli_srvsvc.h @@ -1,58 +1,352 @@ #include "librpc/gen_ndr/ndr_srvsvc.h" #ifndef __CLI_SRVSVC__ #define __CLI_SRVSVC__ -NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetCharDevCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, uint32_t level, union srvsvc_NetCharDevInfo *info, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, uint32_t opcode, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *user, uint32_t *level, union srvsvc_NetCharDevQCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, const char *user, uint32_t level, union srvsvc_NetCharDevQInfo *info, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, uint32_t level, union srvsvc_NetCharDevQInfo info, uint32_t *parm_error, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *queue_name, const char *computer_name, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint32_t *level, union srvsvc_NetConnCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, const char *user, uint32_t *level, union srvsvc_NetFileCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t fid, uint32_t level, union srvsvc_NetFileInfo *info, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t fid, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client, const char *user, uint32_t *level, union srvsvc_NetSessCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *client, const char *user, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetShareInfo info, uint32_t *parm_error, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetShareCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t level, union srvsvc_NetShareInfo *info, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t level, union srvsvc_NetShareInfo info, uint32_t *parm_error, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t reserved, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share_name, uint32_t reserved, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *device_name, enum srvsvc_ShareType *type, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetSrvInfo *info, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetSrvInfo info, uint32_t *parm_error, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, struct srvsvc_NetDiskInfo *info, uint32_t maxlen, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *service, uint32_t level, uint32_t options, struct srvsvc_Statistics *stats, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetTransportInfo info, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetTransportCtr *transports, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t unknown, struct srvsvc_NetTransportInfo0 transport, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, struct srvsvc_NetRemoteTODInfo *info, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *transport, uint32_t servicebits, uint32_t updateimmediately, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint32_t pathflags, uint32_t *pathtype, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path, uint8_t *can_path, uint32_t maxbuf, const char *prefix, uint32_t *pathtype, uint32_t pathflags, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *path1, const char *path2, uint32_t pathtype, uint32_t pathflags, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *name, uint32_t name_type, uint32_t flags, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *name1, const char *name2, uint32_t name_type, uint32_t flags, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t *level, union srvsvc_NetShareCtr *ctr, uint32_t max_buffer, uint32_t *totalentries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, uint32_t reserved, struct policy_handle *hnd, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *hnd, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, const char *file, uint32_t securityinformation, struct sec_desc_buf *sd_buf, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *share, const char *file, uint32_t securityinformation, struct sec_desc_buf sd_buf, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, uint32_t level, union srvsvc_NetTransportInfo info, WERROR *werror); -NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_unc, const char *emulated_server_unc, const char *transport, uint32_t servicebitsofinterest, uint32_t servicebits, uint32_t updateimmediately, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_srvsvc_NETRSERVERTRANSPORTDELEX(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); +NTSTATUS rpccli_srvsvc_NetCharDevEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t *level, + union srvsvc_NetCharDevCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetCharDevGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *device_name, + uint32_t level, + union srvsvc_NetCharDevInfo *info, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetCharDevControl(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *device_name, + uint32_t opcode, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetCharDevQEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *user, + uint32_t *level, + union srvsvc_NetCharDevQCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetCharDevQGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *queue_name, + const char *user, + uint32_t level, + union srvsvc_NetCharDevQInfo *info, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetCharDevQSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *queue_name, + uint32_t level, + union srvsvc_NetCharDevQInfo info, + uint32_t *parm_error, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetCharDevQPurge(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *queue_name, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetCharDevQPurgeSelf(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *queue_name, + const char *computer_name, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetConnEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path, + uint32_t *level, + union srvsvc_NetConnCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetFileEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path, + const char *user, + uint32_t *level, + union srvsvc_NetFileCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetFileGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t fid, + uint32_t level, + union srvsvc_NetFileInfo *info, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetFileClose(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t fid, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetSessEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *client, + const char *user, + uint32_t *level, + union srvsvc_NetSessCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetSessDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *client, + const char *user, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetShareInfo info, + uint32_t *parm_error, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareEnumAll(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t *level, + union srvsvc_NetShareCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share_name, + uint32_t level, + union srvsvc_NetShareInfo *info, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share_name, + uint32_t level, + union srvsvc_NetShareInfo info, + uint32_t *parm_error, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share_name, + uint32_t reserved, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareDelSticky(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share_name, + uint32_t reserved, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareCheck(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *device_name, + enum srvsvc_ShareType *type, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetSrvGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetSrvInfo *info, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetSrvSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetSrvInfo info, + uint32_t *parm_error, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetDiskEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + struct srvsvc_NetDiskInfo *info, + uint32_t maxlen, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetServerStatisticsGet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *service, + uint32_t level, + uint32_t options, + struct srvsvc_Statistics *stats, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetTransportAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetTransportInfo info, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetTransportEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t *level, + union srvsvc_NetTransportCtr *transports, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetTransportDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t unknown, + struct srvsvc_NetTransportInfo0 transport, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetRemoteTOD(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + struct srvsvc_NetRemoteTODInfo *info, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetSetServiceBits(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *transport, + uint32_t servicebits, + uint32_t updateimmediately, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetPathType(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path, + uint32_t pathflags, + uint32_t *pathtype, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetPathCanonicalize(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path, + uint8_t *can_path, + uint32_t maxbuf, + const char *prefix, + uint32_t *pathtype, + uint32_t pathflags, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetPathCompare(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *path1, + const char *path2, + uint32_t pathtype, + uint32_t pathflags, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetNameValidate(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *name, + uint32_t name_type, + uint32_t flags, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRPRNAMECANONICALIZE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetPRNameCompare(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *name1, + const char *name2, + uint32_t name_type, + uint32_t flags, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t *level, + union srvsvc_NetShareCtr *ctr, + uint32_t max_buffer, + uint32_t *totalentries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareDelStart(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share, + uint32_t reserved, + struct policy_handle *hnd, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetShareDelCommit(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *hnd, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetGetFileSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share, + const char *file, + uint32_t securityinformation, + struct sec_desc_buf *sd_buf, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetSetFileSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *share, + const char *file, + uint32_t securityinformation, + struct sec_desc_buf sd_buf, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetServerTransportAddEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + uint32_t level, + union srvsvc_NetTransportInfo info, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NetServerSetServiceBitsEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_unc, + const char *emulated_server_unc, + const char *transport, + uint32_t servicebitsofinterest, + uint32_t servicebits, + uint32_t updateimmediately, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSGETVERSION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSCREATELOCALPARTITION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSDELETELOCALPARTITION(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSSETSERVERINFO(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSCREATEEXITPOINT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSDELETEEXITPOINT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSMODIFYPREFIX(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSFIXLOCALVOLUME(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_srvsvc_NETRSERVERTRANSPORTDELEX(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); #endif /* __CLI_SRVSVC__ */ diff --git a/source3/librpc/gen_ndr/cli_svcctl.c b/source3/librpc/gen_ndr/cli_svcctl.c index 3266e0c3c5..2a5d6badc6 100644 --- a/source3/librpc/gen_ndr/cli_svcctl.c +++ b/source3/librpc/gen_ndr/cli_svcctl.c @@ -6,7 +6,10 @@ #include "includes.h" #include "librpc/gen_ndr/cli_svcctl.h" -NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + WERROR *werror) { struct svcctl_CloseServiceHandle r; NTSTATUS status; @@ -14,17 +17,24 @@ NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli, TALLOC_CT /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CLOSESERVICEHANDLE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_CLOSESERVICEHANDLE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -41,7 +51,12 @@ NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t control, struct SERVICE_STATUS *service_status, WERROR *werror) +NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t control, + struct SERVICE_STATUS *service_status, + WERROR *werror) { struct svcctl_ControlService r; NTSTATUS status; @@ -50,17 +65,24 @@ NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.handle = handle; r.in.control = control; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ControlService, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CONTROLSERVICE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_CONTROLSERVICE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ControlService, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -77,7 +99,10 @@ NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + WERROR *werror) { struct svcctl_DeleteService r; NTSTATUS status; @@ -85,17 +110,24 @@ NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli, TALLOC_CTX *me /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_DeleteService, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_DELETESERVICE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_DELETESERVICE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -111,7 +143,11 @@ NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli, TALLOC_CTX *me return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct policy_handle *lock, WERROR *werror) +NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct policy_handle *lock, + WERROR *werror) { struct svcctl_LockServiceDatabase r; NTSTATUS status; @@ -119,17 +155,24 @@ NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_C /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_LOCKSERVICEDATABASE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_LOCKSERVICEDATABASE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -146,24 +189,33 @@ NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct svcctl_QueryServiceObjectSecurity r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -179,24 +231,33 @@ NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli, T return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct svcctl_SetServiceObjectSecurity r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SETSERVICEOBJECTSECURITY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_SETSERVICEOBJECTSECURITY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -212,7 +273,11 @@ NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli, TAL return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct SERVICE_STATUS *service_status, WERROR *werror) +NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct SERVICE_STATUS *service_status, + WERROR *werror) { struct svcctl_QueryServiceStatus r; NTSTATUS status; @@ -220,17 +285,24 @@ NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli, TALLOC_CT /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICESTATUS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_QUERYSERVICESTATUS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -247,24 +319,33 @@ NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct svcctl_SetServiceStatus r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SETSERVICESTATUS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_SETSERVICESTATUS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -280,7 +361,10 @@ NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *lock, WERROR *werror) +NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *lock, + WERROR *werror) { struct svcctl_UnlockServiceDatabase r; NTSTATUS status; @@ -288,17 +372,24 @@ NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli, TALLOC /* In parameters */ r.in.lock = lock; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_UNLOCKSERVICEDATABASE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_UNLOCKSERVICEDATABASE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -315,24 +406,33 @@ NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli, TALLOC return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct svcctl_NotifyBootConfigStatus r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -348,7 +448,13 @@ NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t bits, uint32_t bitson, uint32_t immediate, WERROR *werror) +NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t bits, + uint32_t bitson, + uint32_t immediate, + WERROR *werror) { struct svcctl_SCSetServiceBitsW r; NTSTATUS status; @@ -359,17 +465,24 @@ NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli, TALLOC_CTX r.in.bitson = bitson; r.in.immediate = immediate; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SCSETSERVICEBITSW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_SCSETSERVICEBITSW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -385,7 +498,20 @@ NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t start, uint32_t error, const char *binary_path, const char *load_order_group, uint32_t *tag_id, const char *dependencies, const char *service_start_name, const char *password, const char *display_name, WERROR *werror) +NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t type, + uint32_t start, + uint32_t error, + const char *binary_path, + const char *load_order_group, + uint32_t *tag_id, + const char *dependencies, + const char *service_start_name, + const char *password, + const char *display_name, + WERROR *werror) { struct svcctl_ChangeServiceConfigW r; NTSTATUS status; @@ -402,17 +528,24 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, TALLOC_ r.in.password = password; r.in.display_name = display_name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIGW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_CHANGESERVICECONFIGW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -429,7 +562,25 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, const char *DisplayName, uint32_t desired_access, uint32_t type, uint32_t start_type, uint32_t error_control, const char *binary_path, const char *LoadOrderGroupKey, uint32_t *TagId, uint8_t *dependencies, uint32_t dependencies_size, const char *service_start_name, uint8_t *password, uint32_t password_size, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager_handle, + const char *ServiceName, + const char *DisplayName, + uint32_t desired_access, + uint32_t type, + uint32_t start_type, + uint32_t error_control, + const char *binary_path, + const char *LoadOrderGroupKey, + uint32_t *TagId, + uint8_t *dependencies, + uint32_t dependencies_size, + const char *service_start_name, + uint8_t *password, + uint32_t password_size, + struct policy_handle *handle, + WERROR *werror) { struct svcctl_CreateServiceW r; NTSTATUS status; @@ -451,17 +602,24 @@ NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.password = password; r.in.password_size = password_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CREATESERVICEW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_CREATESERVICEW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -481,7 +639,15 @@ NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *service, uint32_t state, struct ENUM_SERVICE_STATUS *service_status, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *services_returned, WERROR *werror) +NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *service, + uint32_t state, + struct ENUM_SERVICE_STATUS *service_status, + uint32_t buf_size, + uint32_t *bytes_needed, + uint32_t *services_returned, + WERROR *werror) { struct svcctl_EnumDependentServicesW r; NTSTATUS status; @@ -491,17 +657,24 @@ NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli, TALLO r.in.state = state; r.in.buf_size = buf_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMDEPENDENTSERVICESW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_ENUMDEPENDENTSERVICESW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -522,7 +695,17 @@ NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t state, uint32_t buf_size, uint8_t *service, uint32_t *bytes_needed, uint32_t *services_returned, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t type, + uint32_t state, + uint32_t buf_size, + uint8_t *service, + uint32_t *bytes_needed, + uint32_t *services_returned, + uint32_t *resume_handle, + WERROR *werror) { struct svcctl_EnumServicesStatusW r; NTSTATUS status; @@ -534,17 +717,24 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, TALLOC_C r.in.buf_size = buf_size; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMSERVICESSTATUSW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_ENUMSERVICESSTATUSW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -566,7 +756,13 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *MachineName, const char *DatabaseName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *MachineName, + const char *DatabaseName, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct svcctl_OpenSCManagerW r; NTSTATUS status; @@ -576,17 +772,24 @@ NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.DatabaseName = DatabaseName; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSCMANAGERW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_OPENSCMANAGERW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -603,7 +806,13 @@ NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager_handle, + const char *ServiceName, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct svcctl_OpenServiceW r; NTSTATUS status; @@ -613,17 +822,24 @@ NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.ServiceName = ServiceName; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSERVICEW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_OPENSERVICEW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -640,7 +856,13 @@ NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t *query, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror) +NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint8_t *query, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror) { struct svcctl_QueryServiceConfigW r; NTSTATUS status; @@ -649,17 +871,24 @@ NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli, TALLOC_C r.in.handle = handle; r.in.buf_size = buf_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIGW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_QUERYSERVICECONFIGW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -677,7 +906,13 @@ NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t buf_size, struct SERVICE_LOCK_STATUS *lock_status, uint32_t *required_buf_size, WERROR *werror) +NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t buf_size, + struct SERVICE_LOCK_STATUS *lock_status, + uint32_t *required_buf_size, + WERROR *werror) { struct svcctl_QueryServiceLockStatusW r; NTSTATUS status; @@ -686,17 +921,24 @@ NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli, TALL r.in.handle = handle; r.in.buf_size = buf_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICELOCKSTATUSW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_QUERYSERVICELOCKSTATUSW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -714,7 +956,12 @@ NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli, TALL return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t NumArgs, const char *Arguments, WERROR *werror) +NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t NumArgs, + const char *Arguments, + WERROR *werror) { struct svcctl_StartServiceW r; NTSTATUS status; @@ -724,17 +971,24 @@ NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.NumArgs = NumArgs; r.in.Arguments = Arguments; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_STARTSERVICEW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_STARTSERVICEW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -750,7 +1004,13 @@ NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *me return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **display_name, uint32_t *display_name_length, WERROR *werror) +NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *service_name, + const char **display_name, + uint32_t *display_name_length, + WERROR *werror) { struct svcctl_GetServiceDisplayNameW r; NTSTATUS status; @@ -760,17 +1020,24 @@ NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli, TALLO r.in.service_name = service_name; r.in.display_name_length = display_name_length; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEDISPLAYNAMEW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_GETSERVICEDISPLAYNAMEW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -790,7 +1057,13 @@ NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **key_name, uint32_t *display_name_length, WERROR *werror) +NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *service_name, + const char **key_name, + uint32_t *display_name_length, + WERROR *werror) { struct svcctl_GetServiceKeyNameW r; NTSTATUS status; @@ -800,17 +1073,24 @@ NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli, TALLOC_CT r.in.service_name = service_name; r.in.display_name_length = display_name_length; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEKEYNAMEW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_GETSERVICEKEYNAMEW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -830,7 +1110,13 @@ NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t bits, uint32_t bitson, uint32_t immediate, WERROR *werror) +NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t bits, + uint32_t bitson, + uint32_t immediate, + WERROR *werror) { struct svcctl_SCSetServiceBitsA r; NTSTATUS status; @@ -841,17 +1127,24 @@ NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli, TALLOC_CTX r.in.bitson = bitson; r.in.immediate = immediate; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SCSETSERVICEBITSA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_SCSETSERVICEBITSA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -867,7 +1160,20 @@ NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t start, uint32_t error, const char *binary_path, const char *load_order_group, uint32_t *tag_id, const char *dependencies, const char *service_start_name, const char *password, const char *display_name, WERROR *werror) +NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t type, + uint32_t start, + uint32_t error, + const char *binary_path, + const char *load_order_group, + uint32_t *tag_id, + const char *dependencies, + const char *service_start_name, + const char *password, + const char *display_name, + WERROR *werror) { struct svcctl_ChangeServiceConfigA r; NTSTATUS status; @@ -884,17 +1190,24 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, TALLOC_ r.in.password = password; r.in.display_name = display_name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIGA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_CHANGESERVICECONFIGA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -911,7 +1224,22 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *ServiceName, const char *DisplayName, uint32_t desired_access, uint32_t type, uint32_t start_type, uint32_t error_control, const char *binary_path, const char *LoadOrderGroupKey, uint32_t *TagId, const char *dependencies, const char *service_start_name, const char *password, WERROR *werror) +NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *ServiceName, + const char *DisplayName, + uint32_t desired_access, + uint32_t type, + uint32_t start_type, + uint32_t error_control, + const char *binary_path, + const char *LoadOrderGroupKey, + uint32_t *TagId, + const char *dependencies, + const char *service_start_name, + const char *password, + WERROR *werror) { struct svcctl_CreateServiceA r; NTSTATUS status; @@ -930,17 +1258,24 @@ NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.service_start_name = service_start_name; r.in.password = password; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CREATESERVICEA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_CREATESERVICEA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -959,7 +1294,15 @@ NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *service, uint32_t state, struct ENUM_SERVICE_STATUS *service_status, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *services_returned, WERROR *werror) +NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *service, + uint32_t state, + struct ENUM_SERVICE_STATUS *service_status, + uint32_t buf_size, + uint32_t *bytes_needed, + uint32_t *services_returned, + WERROR *werror) { struct svcctl_EnumDependentServicesA r; NTSTATUS status; @@ -969,17 +1312,24 @@ NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli, TALLO r.in.state = state; r.in.buf_size = buf_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMDEPENDENTSERVICESA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_ENUMDEPENDENTSERVICESA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1000,7 +1350,17 @@ NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t state, uint32_t buf_size, uint8_t *service, uint32_t *bytes_needed, uint32_t *services_returned, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t type, + uint32_t state, + uint32_t buf_size, + uint8_t *service, + uint32_t *bytes_needed, + uint32_t *services_returned, + uint32_t *resume_handle, + WERROR *werror) { struct svcctl_EnumServicesStatusA r; NTSTATUS status; @@ -1012,17 +1372,24 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, TALLOC_C r.in.buf_size = buf_size; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMSERVICESSTATUSA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_ENUMSERVICESSTATUSA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1044,7 +1411,13 @@ NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *MachineName, const char *DatabaseName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *MachineName, + const char *DatabaseName, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct svcctl_OpenSCManagerA r; NTSTATUS status; @@ -1054,17 +1427,24 @@ NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.DatabaseName = DatabaseName; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSCMANAGERA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_OPENSCMANAGERA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1081,7 +1461,12 @@ NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, uint32_t access_mask, WERROR *werror) +NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager_handle, + const char *ServiceName, + uint32_t access_mask, + WERROR *werror) { struct svcctl_OpenServiceA r; NTSTATUS status; @@ -1091,17 +1476,24 @@ NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.ServiceName = ServiceName; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_OPENSERVICEA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_OPENSERVICEA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1117,7 +1509,13 @@ NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t *query, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror) +NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint8_t *query, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror) { struct svcctl_QueryServiceConfigA r; NTSTATUS status; @@ -1126,17 +1524,24 @@ NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli, TALLOC_C r.in.handle = handle; r.in.buf_size = buf_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIGA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_QUERYSERVICECONFIGA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1154,7 +1559,13 @@ NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t buf_size, struct SERVICE_LOCK_STATUS *lock_status, uint32_t *required_buf_size, WERROR *werror) +NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t buf_size, + struct SERVICE_LOCK_STATUS *lock_status, + uint32_t *required_buf_size, + WERROR *werror) { struct svcctl_QueryServiceLockStatusA r; NTSTATUS status; @@ -1163,17 +1574,24 @@ NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli, TALL r.in.handle = handle; r.in.buf_size = buf_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICELOCKSTATUSA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_QUERYSERVICELOCKSTATUSA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1191,7 +1609,12 @@ NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli, TALL return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t NumArgs, const char *Arguments, WERROR *werror) +NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t NumArgs, + const char *Arguments, + WERROR *werror) { struct svcctl_StartServiceA r; NTSTATUS status; @@ -1201,17 +1624,24 @@ NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *me r.in.NumArgs = NumArgs; r.in.Arguments = Arguments; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_STARTSERVICEA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_STARTSERVICEA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1227,7 +1657,13 @@ NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *me return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **display_name, uint32_t *display_name_length, WERROR *werror) +NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *service_name, + const char **display_name, + uint32_t *display_name_length, + WERROR *werror) { struct svcctl_GetServiceDisplayNameA r; NTSTATUS status; @@ -1237,17 +1673,24 @@ NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli, TALLO r.in.service_name = service_name; r.in.display_name_length = display_name_length; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEDISPLAYNAMEA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_GETSERVICEDISPLAYNAMEA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1267,7 +1710,13 @@ NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **key_name, uint32_t *display_name_length, WERROR *werror) +NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *service_name, + const char **key_name, + uint32_t *display_name_length, + WERROR *werror) { struct svcctl_GetServiceKeyNameA r; NTSTATUS status; @@ -1277,17 +1726,24 @@ NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli, TALLOC_CT r.in.service_name = service_name; r.in.display_name_length = display_name_length; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETSERVICEKEYNAMEA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_GETSERVICEKEYNAMEA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1307,24 +1763,33 @@ NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct svcctl_GetCurrentGroupeStateW r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_GETCURRENTGROUPESTATEW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_GETCURRENTGROUPESTATEW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1340,24 +1805,33 @@ NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct svcctl_EnumServiceGroupW r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_ENUMSERVICEGROUPW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_ENUMSERVICEGROUPW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1373,7 +1847,12 @@ NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *info, WERROR *werror) +NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *info, + WERROR *werror) { struct svcctl_ChangeServiceConfig2A r; NTSTATUS status; @@ -1383,17 +1862,24 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli, TALLOC r.in.info_level = info_level; r.in.info = info; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIG2A, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_CHANGESERVICECONFIG2A, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1409,7 +1895,12 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli, TALLOC return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *info, WERROR *werror) +NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *info, + WERROR *werror) { struct svcctl_ChangeServiceConfig2W r; NTSTATUS status; @@ -1419,17 +1910,24 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli, TALLOC r.in.info_level = info_level; r.in.info = info; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_CHANGESERVICECONFIG2W, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_CHANGESERVICECONFIG2W, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1445,7 +1943,14 @@ NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli, TALLOC return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror) +NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *buffer, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror) { struct svcctl_QueryServiceConfig2A r; NTSTATUS status; @@ -1455,17 +1960,24 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_ r.in.info_level = info_level; r.in.buf_size = buf_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIG2A, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_QUERYSERVICECONFIG2A, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1483,7 +1995,14 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror) +NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *buffer, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror) { struct svcctl_QueryServiceConfig2W r; NTSTATUS status; @@ -1493,17 +2012,24 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_ r.in.info_level = info_level; r.in.buf_size = buf_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICECONFIG2W, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_QUERYSERVICECONFIG2W, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1521,7 +2047,14 @@ NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror) +NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *buffer, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror) { struct svcctl_QueryServiceStatusEx r; NTSTATUS status; @@ -1531,17 +2064,24 @@ NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli, TALLOC_ r.in.info_level = info_level; r.in.buf_size = buf_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_QUERYSERVICESTATUSEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_QUERYSERVICESTATUSEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1559,7 +2099,19 @@ NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager, uint32_t info_level, uint32_t type, uint32_t state, uint8_t *services, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *service_returned, uint32_t *resume_handle, const char **group_name, WERROR *werror) +NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager, + uint32_t info_level, + uint32_t type, + uint32_t state, + uint8_t *services, + uint32_t buf_size, + uint32_t *bytes_needed, + uint32_t *service_returned, + uint32_t *resume_handle, + const char **group_name, + WERROR *werror) { struct EnumServicesStatusExA r; NTSTATUS status; @@ -1572,17 +2124,24 @@ NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.buf_size = buf_size; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_ENUMSERVICESSTATUSEXA, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_ENUMSERVICESSTATUSEXA, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1605,7 +2164,19 @@ NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager, uint32_t info_level, uint32_t type, uint32_t state, uint8_t *services, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *service_returned, uint32_t *resume_handle, const char **group_name, WERROR *werror) +NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager, + uint32_t info_level, + uint32_t type, + uint32_t state, + uint8_t *services, + uint32_t buf_size, + uint32_t *bytes_needed, + uint32_t *service_returned, + uint32_t *resume_handle, + const char **group_name, + WERROR *werror) { struct EnumServicesStatusExW r; NTSTATUS status; @@ -1618,17 +2189,24 @@ NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.buf_size = buf_size; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_ENUMSERVICESSTATUSEXW, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_ENUMSERVICESSTATUSEXW, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1651,24 +2229,33 @@ NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct svcctl_SCSendTSMessage r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_SVCCTL, &ndr_table_svcctl, NDR_SVCCTL_SCSENDTSMESSAGE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SVCCTL, + &ndr_table_svcctl, + NDR_SVCCTL_SCSENDTSMESSAGE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_svcctl.h b/source3/librpc/gen_ndr/cli_svcctl.h index 77e9e8d6da..e9eeb2d9e2 100644 --- a/source3/librpc/gen_ndr/cli_svcctl.h +++ b/source3/librpc/gen_ndr/cli_svcctl.h @@ -1,48 +1,327 @@ #include "librpc/gen_ndr/ndr_svcctl.h" #ifndef __CLI_SVCCTL__ #define __CLI_SVCCTL__ -NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t control, struct SERVICE_STATUS *service_status, WERROR *werror); -NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct policy_handle *lock, WERROR *werror); -NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct SERVICE_STATUS *service_status, WERROR *werror); -NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *lock, WERROR *werror); -NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t bits, uint32_t bitson, uint32_t immediate, WERROR *werror); -NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t start, uint32_t error, const char *binary_path, const char *load_order_group, uint32_t *tag_id, const char *dependencies, const char *service_start_name, const char *password, const char *display_name, WERROR *werror); -NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, const char *DisplayName, uint32_t desired_access, uint32_t type, uint32_t start_type, uint32_t error_control, const char *binary_path, const char *LoadOrderGroupKey, uint32_t *TagId, uint8_t *dependencies, uint32_t dependencies_size, const char *service_start_name, uint8_t *password, uint32_t password_size, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *service, uint32_t state, struct ENUM_SERVICE_STATUS *service_status, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *services_returned, WERROR *werror); -NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t state, uint32_t buf_size, uint8_t *service, uint32_t *bytes_needed, uint32_t *services_returned, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *MachineName, const char *DatabaseName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t *query, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror); -NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t buf_size, struct SERVICE_LOCK_STATUS *lock_status, uint32_t *required_buf_size, WERROR *werror); -NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t NumArgs, const char *Arguments, WERROR *werror); -NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **display_name, uint32_t *display_name_length, WERROR *werror); -NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **key_name, uint32_t *display_name_length, WERROR *werror); -NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t bits, uint32_t bitson, uint32_t immediate, WERROR *werror); -NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t start, uint32_t error, const char *binary_path, const char *load_order_group, uint32_t *tag_id, const char *dependencies, const char *service_start_name, const char *password, const char *display_name, WERROR *werror); -NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *ServiceName, const char *DisplayName, uint32_t desired_access, uint32_t type, uint32_t start_type, uint32_t error_control, const char *binary_path, const char *LoadOrderGroupKey, uint32_t *TagId, const char *dependencies, const char *service_start_name, const char *password, WERROR *werror); -NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *service, uint32_t state, struct ENUM_SERVICE_STATUS *service_status, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *services_returned, WERROR *werror); -NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t type, uint32_t state, uint32_t buf_size, uint8_t *service, uint32_t *bytes_needed, uint32_t *services_returned, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *MachineName, const char *DatabaseName, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager_handle, const char *ServiceName, uint32_t access_mask, WERROR *werror); -NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t *query, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror); -NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t buf_size, struct SERVICE_LOCK_STATUS *lock_status, uint32_t *required_buf_size, WERROR *werror); -NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t NumArgs, const char *Arguments, WERROR *werror); -NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **display_name, uint32_t *display_name_length, WERROR *werror); -NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *service_name, const char **key_name, uint32_t *display_name_length, WERROR *werror); -NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *info, WERROR *werror); -NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *info, WERROR *werror); -NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror); -NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror); -NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t info_level, uint8_t *buffer, uint32_t buf_size, uint32_t *bytes_needed, WERROR *werror); -NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager, uint32_t info_level, uint32_t type, uint32_t state, uint8_t *services, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *service_returned, uint32_t *resume_handle, const char **group_name, WERROR *werror); -NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *scmanager, uint32_t info_level, uint32_t type, uint32_t state, uint8_t *services, uint32_t buf_size, uint32_t *bytes_needed, uint32_t *service_returned, uint32_t *resume_handle, const char **group_name, WERROR *werror); -NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); +NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t control, + struct SERVICE_STATUS *service_status, + WERROR *werror); +NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct policy_handle *lock, + WERROR *werror); +NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct SERVICE_STATUS *service_status, + WERROR *werror); +NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *lock, + WERROR *werror); +NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t bits, + uint32_t bitson, + uint32_t immediate, + WERROR *werror); +NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t type, + uint32_t start, + uint32_t error, + const char *binary_path, + const char *load_order_group, + uint32_t *tag_id, + const char *dependencies, + const char *service_start_name, + const char *password, + const char *display_name, + WERROR *werror); +NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager_handle, + const char *ServiceName, + const char *DisplayName, + uint32_t desired_access, + uint32_t type, + uint32_t start_type, + uint32_t error_control, + const char *binary_path, + const char *LoadOrderGroupKey, + uint32_t *TagId, + uint8_t *dependencies, + uint32_t dependencies_size, + const char *service_start_name, + uint8_t *password, + uint32_t password_size, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *service, + uint32_t state, + struct ENUM_SERVICE_STATUS *service_status, + uint32_t buf_size, + uint32_t *bytes_needed, + uint32_t *services_returned, + WERROR *werror); +NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t type, + uint32_t state, + uint32_t buf_size, + uint8_t *service, + uint32_t *bytes_needed, + uint32_t *services_returned, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *MachineName, + const char *DatabaseName, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager_handle, + const char *ServiceName, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint8_t *query, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror); +NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t buf_size, + struct SERVICE_LOCK_STATUS *lock_status, + uint32_t *required_buf_size, + WERROR *werror); +NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t NumArgs, + const char *Arguments, + WERROR *werror); +NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *service_name, + const char **display_name, + uint32_t *display_name_length, + WERROR *werror); +NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *service_name, + const char **key_name, + uint32_t *display_name_length, + WERROR *werror); +NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t bits, + uint32_t bitson, + uint32_t immediate, + WERROR *werror); +NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t type, + uint32_t start, + uint32_t error, + const char *binary_path, + const char *load_order_group, + uint32_t *tag_id, + const char *dependencies, + const char *service_start_name, + const char *password, + const char *display_name, + WERROR *werror); +NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *ServiceName, + const char *DisplayName, + uint32_t desired_access, + uint32_t type, + uint32_t start_type, + uint32_t error_control, + const char *binary_path, + const char *LoadOrderGroupKey, + uint32_t *TagId, + const char *dependencies, + const char *service_start_name, + const char *password, + WERROR *werror); +NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *service, + uint32_t state, + struct ENUM_SERVICE_STATUS *service_status, + uint32_t buf_size, + uint32_t *bytes_needed, + uint32_t *services_returned, + WERROR *werror); +NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t type, + uint32_t state, + uint32_t buf_size, + uint8_t *service, + uint32_t *bytes_needed, + uint32_t *services_returned, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *MachineName, + const char *DatabaseName, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager_handle, + const char *ServiceName, + uint32_t access_mask, + WERROR *werror); +NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint8_t *query, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror); +NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t buf_size, + struct SERVICE_LOCK_STATUS *lock_status, + uint32_t *required_buf_size, + WERROR *werror); +NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t NumArgs, + const char *Arguments, + WERROR *werror); +NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *service_name, + const char **display_name, + uint32_t *display_name_length, + WERROR *werror); +NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *service_name, + const char **key_name, + uint32_t *display_name_length, + WERROR *werror); +NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *info, + WERROR *werror); +NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *info, + WERROR *werror); +NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *buffer, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror); +NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *buffer, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror); +NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t info_level, + uint8_t *buffer, + uint32_t buf_size, + uint32_t *bytes_needed, + WERROR *werror); +NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager, + uint32_t info_level, + uint32_t type, + uint32_t state, + uint8_t *services, + uint32_t buf_size, + uint32_t *bytes_needed, + uint32_t *service_returned, + uint32_t *resume_handle, + const char **group_name, + WERROR *werror); +NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *scmanager, + uint32_t info_level, + uint32_t type, + uint32_t state, + uint8_t *services, + uint32_t buf_size, + uint32_t *bytes_needed, + uint32_t *service_returned, + uint32_t *resume_handle, + const char **group_name, + WERROR *werror); +NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); #endif /* __CLI_SVCCTL__ */ diff --git a/source3/librpc/gen_ndr/cli_unixinfo.c b/source3/librpc/gen_ndr/cli_unixinfo.c index c8b9a01f3d..c8a6c926ef 100644 --- a/source3/librpc/gen_ndr/cli_unixinfo.c +++ b/source3/librpc/gen_ndr/cli_unixinfo.c @@ -6,7 +6,10 @@ #include "includes.h" #include "librpc/gen_ndr/cli_unixinfo.h" -NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *uid) +NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct dom_sid sid, + uint64_t *uid) { struct unixinfo_SidToUid r; NTSTATUS status; @@ -14,17 +17,24 @@ NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* In parameters */ r.in.sid = sid; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_SidToUid, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_SIDTOUID, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_UNIXINFO, + &ndr_table_unixinfo, + NDR_UNIXINFO_SIDTOUID, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_SidToUid, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -37,7 +47,10 @@ NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid) +NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint64_t uid, + struct dom_sid *sid) { struct unixinfo_UidToSid r; NTSTATUS status; @@ -45,17 +58,24 @@ NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* In parameters */ r.in.uid = uid; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_UidToSid, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_UIDTOSID, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_UNIXINFO, + &ndr_table_unixinfo, + NDR_UNIXINFO_UIDTOSID, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_UidToSid, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -68,7 +88,10 @@ NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *gid) +NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct dom_sid sid, + uint64_t *gid) { struct unixinfo_SidToGid r; NTSTATUS status; @@ -76,17 +99,24 @@ NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* In parameters */ r.in.sid = sid; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_SidToGid, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_SIDTOGID, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_UNIXINFO, + &ndr_table_unixinfo, + NDR_UNIXINFO_SIDTOGID, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_SidToGid, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -99,7 +129,10 @@ NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid) +NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint64_t gid, + struct dom_sid *sid) { struct unixinfo_GidToSid r; NTSTATUS status; @@ -107,17 +140,24 @@ NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* In parameters */ r.in.gid = gid; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_GidToSid, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_GIDTOSID, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_UNIXINFO, + &ndr_table_unixinfo, + NDR_UNIXINFO_GIDTOSID, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_GidToSid, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -130,7 +170,11 @@ NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo *infos) +NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t *count, + uint64_t *uids, + struct unixinfo_GetPWUidInfo *infos) { struct unixinfo_GetPWUid r; NTSTATUS status; @@ -139,17 +183,24 @@ NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.count = count; r.in.uids = uids; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_GetPWUid, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, &ndr_table_unixinfo, NDR_UNIXINFO_GETPWUID, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_UNIXINFO, + &ndr_table_unixinfo, + NDR_UNIXINFO_GETPWUID, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_GetPWUid, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_unixinfo.h b/source3/librpc/gen_ndr/cli_unixinfo.h index f0f2b54626..fa084cc75d 100644 --- a/source3/librpc/gen_ndr/cli_unixinfo.h +++ b/source3/librpc/gen_ndr/cli_unixinfo.h @@ -1,9 +1,25 @@ #include "librpc/gen_ndr/ndr_unixinfo.h" #ifndef __CLI_UNIXINFO__ #define __CLI_UNIXINFO__ -NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *uid); -NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid); -NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *gid); -NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid); -NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo *infos); +NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct dom_sid sid, + uint64_t *uid); +NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint64_t uid, + struct dom_sid *sid); +NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct dom_sid sid, + uint64_t *gid); +NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint64_t gid, + struct dom_sid *sid); +NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t *count, + uint64_t *uids, + struct unixinfo_GetPWUidInfo *infos); #endif /* __CLI_UNIXINFO__ */ diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c index 934dfc17b6..1c691e3d32 100644 --- a/source3/librpc/gen_ndr/cli_winreg.c +++ b/source3/librpc/gen_ndr/cli_winreg.c @@ -6,7 +6,12 @@ #include "includes.h" #include "librpc/gen_ndr/cli_winreg.h" -NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenHKCR r; NTSTATUS status; @@ -15,17 +20,24 @@ NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.system_name = system_name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKCR, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENHKCR, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -42,7 +54,12 @@ NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenHKCU r; NTSTATUS status; @@ -51,17 +68,24 @@ NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.system_name = system_name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKCU, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENHKCU, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -78,7 +102,12 @@ NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenHKLM r; NTSTATUS status; @@ -87,17 +116,24 @@ NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.system_name = system_name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKLM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENHKLM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -114,7 +150,12 @@ NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenHKPD r; NTSTATUS status; @@ -123,17 +164,24 @@ NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.system_name = system_name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKPD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENHKPD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -150,7 +198,12 @@ NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenHKU r; NTSTATUS status; @@ -159,17 +212,24 @@ NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.system_name = system_name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKU, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKU, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENHKU, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -186,7 +246,10 @@ NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + WERROR *werror) { struct winreg_CloseKey r; NTSTATUS status; @@ -194,17 +257,24 @@ NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_CloseKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_CLOSEKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_CLOSEKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_CloseKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -221,7 +291,17 @@ NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken, WERROR *werror) +NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String name, + struct winreg_String keyclass, + uint32_t options, + uint32_t access_mask, + struct winreg_SecBuf *secdesc, + struct policy_handle *new_handle, + enum winreg_CreateAction *action_taken, + WERROR *werror) { struct winreg_CreateKey r; NTSTATUS status; @@ -235,17 +315,24 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.secdesc = secdesc; r.in.action_taken = action_taken; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_CreateKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_CREATEKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_CREATEKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_CreateKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -265,7 +352,11 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String key, WERROR *werror) +NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String key, + WERROR *werror) { struct winreg_DeleteKey r; NTSTATUS status; @@ -274,17 +365,24 @@ NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.handle = handle; r.in.key = key; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_DeleteKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_DELETEKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_DELETEKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -300,7 +398,11 @@ NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value, WERROR *werror) +NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String value, + WERROR *werror) { struct winreg_DeleteValue r; NTSTATUS status; @@ -309,17 +411,24 @@ NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.handle = handle; r.in.value = value; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_DeleteValue, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_DELETEVALUE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_DELETEVALUE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -335,7 +444,14 @@ NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time, WERROR *werror) +NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t enum_index, + struct winreg_StringBuf *name, + struct winreg_StringBuf *keyclass, + NTTIME *last_changed_time, + WERROR *werror) { struct winreg_EnumKey r; NTSTATUS status; @@ -347,17 +463,24 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.keyclass = keyclass; r.in.last_changed_time = last_changed_time; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_EnumKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_ENUMKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_ENUMKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_EnumKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -380,7 +503,16 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_ValNameBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length, WERROR *werror) +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t enum_index, + struct winreg_ValNameBuf *name, + enum winreg_Type *type, + uint8_t *value, + uint32_t *size, + uint32_t *length, + WERROR *werror) { struct winreg_EnumValue r; NTSTATUS status; @@ -394,17 +526,24 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.size = size; r.in.length = length; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_EnumValue, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_ENUMVALUE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_ENUMVALUE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_EnumValue, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -433,7 +572,10 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + WERROR *werror) { struct winreg_FlushKey r; NTSTATUS status; @@ -441,17 +583,24 @@ NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_FlushKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_FLUSHKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_FLUSHKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_FlushKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -467,7 +616,12 @@ NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd, WERROR *werror) +NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t sec_info, + struct KeySecurityData *sd, + WERROR *werror) { struct winreg_GetKeySecurity r; NTSTATUS status; @@ -477,17 +631,24 @@ NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.sec_info = sec_info; r.in.sd = sd; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_GETKEYSECURITY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_GETKEYSECURITY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -504,7 +665,12 @@ NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename, WERROR *werror) +NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String *keyname, + struct winreg_String *filename, + WERROR *werror) { struct winreg_LoadKey r; NTSTATUS status; @@ -514,17 +680,24 @@ NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.keyname = keyname; r.in.filename = filename; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_LoadKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_LOADKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_LOADKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_LoadKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -540,7 +713,16 @@ NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2, WERROR *werror) +NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint8_t watch_subtree, + uint32_t notify_filter, + uint32_t unknown, + struct winreg_String string1, + struct winreg_String string2, + uint32_t unknown2, + WERROR *werror) { struct winreg_NotifyChangeKeyValue r; NTSTATUS status; @@ -554,17 +736,24 @@ NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_ r.in.string2 = string2; r.in.unknown2 = unknown2; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_NOTIFYCHANGEKEYVALUE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_NOTIFYCHANGEKEYVALUE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -580,7 +769,14 @@ NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *parent_handle, + struct winreg_String keyname, + uint32_t unknown, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenKey r; NTSTATUS status; @@ -591,17 +787,24 @@ NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.unknown = unknown; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -618,7 +821,19 @@ NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_classlen, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time, WERROR *werror) +NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String *classname, + uint32_t *num_subkeys, + uint32_t *max_subkeylen, + uint32_t *max_classlen, + uint32_t *num_values, + uint32_t *max_valnamelen, + uint32_t *max_valbufsize, + uint32_t *secdescsize, + NTTIME *last_changed_time, + WERROR *werror) { struct winreg_QueryInfoKey r; NTSTATUS status; @@ -627,17 +842,24 @@ NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem r.in.handle = handle; r.in.classname = classname; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYINFOKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_QUERYINFOKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -662,7 +884,15 @@ NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length, WERROR *werror) +NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String value_name, + enum winreg_Type *type, + uint8_t *data, + uint32_t *data_size, + uint32_t *value_length, + WERROR *werror) { struct winreg_QueryValue r; NTSTATUS status; @@ -675,17 +905,24 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.data_size = data_size; r.in.value_length = value_length; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYVALUE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_QUERYVALUE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_QueryValue, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -713,24 +950,33 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct winreg_ReplaceKey r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_REPLACEKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_REPLACEKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -746,7 +992,12 @@ NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags, WERROR *werror) +NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String *filename, + uint32_t flags, + WERROR *werror) { struct winreg_RestoreKey r; NTSTATUS status; @@ -756,17 +1007,24 @@ NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.filename = filename; r.in.flags = flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_RESTOREKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_RESTOREKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -782,7 +1040,12 @@ NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib, WERROR *werror) +NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String *filename, + struct KeySecurityAttribute *sec_attrib, + WERROR *werror) { struct winreg_SaveKey r; NTSTATUS status; @@ -792,17 +1055,24 @@ NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.filename = filename; r.in.sec_attrib = sec_attrib; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SAVEKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_SAVEKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -818,7 +1088,12 @@ NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd, WERROR *werror) +NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t access_mask, + struct KeySecurityData *sd, + WERROR *werror) { struct winreg_SetKeySecurity r; NTSTATUS status; @@ -828,17 +1103,24 @@ NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.access_mask = access_mask; r.in.sd = sd; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SETKEYSECURITY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_SETKEYSECURITY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -854,7 +1136,14 @@ NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size, WERROR *werror) +NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String name, + enum winreg_Type type, + uint8_t *data, + uint32_t size, + WERROR *werror) { struct winreg_SetValue r; NTSTATUS status; @@ -866,17 +1155,24 @@ NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.data = data; r.in.size = size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_SetValue, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SETVALUE, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_SETVALUE, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_SetValue, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -892,24 +1188,33 @@ NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct winreg_UnLoadKey r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_UNLOADKEY, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_UNLOADKEY, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -925,7 +1230,14 @@ NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, WERROR *werror) +NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *hostname, + struct initshutdown_String *message, + uint32_t timeout, + uint8_t force_apps, + uint8_t reboot, + WERROR *werror) { struct winreg_InitiateSystemShutdown r; NTSTATUS status; @@ -937,17 +1249,24 @@ NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, TALLO r.in.force_apps = force_apps; r.in.reboot = reboot; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_INITIATESYSTEMSHUTDOWN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_INITIATESYSTEMSHUTDOWN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -963,7 +1282,10 @@ NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server, WERROR *werror) +NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *server, + WERROR *werror) { struct winreg_AbortSystemShutdown r; NTSTATUS status; @@ -971,17 +1293,24 @@ NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_C /* In parameters */ r.in.server = server; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_ABORTSYSTEMSHUTDOWN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_ABORTSYSTEMSHUTDOWN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -997,7 +1326,11 @@ NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *version, WERROR *werror) +NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *version, + WERROR *werror) { struct winreg_GetVersion r; NTSTATUS status; @@ -1005,17 +1338,24 @@ NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* In parameters */ r.in.handle = handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_GetVersion, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_GETVERSION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_GETVERSION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_GetVersion, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1032,7 +1372,12 @@ NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenHKCC r; NTSTATUS status; @@ -1041,17 +1386,24 @@ NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.system_name = system_name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKCC, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENHKCC, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1068,7 +1420,12 @@ NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenHKDD r; NTSTATUS status; @@ -1077,17 +1434,24 @@ NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.system_name = system_name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKDD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENHKDD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1104,7 +1468,14 @@ NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t *buffer, uint32_t *buffer_size, WERROR *werror) +NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *key_handle, + struct QueryMultipleValue *values, + uint32_t num_values, + uint8_t *buffer, + uint32_t *buffer_size, + WERROR *werror) { struct winreg_QueryMultipleValues r; NTSTATUS status; @@ -1116,17 +1487,24 @@ NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_C r.in.buffer = buffer; r.in.buffer_size = buffer_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYMULTIPLEVALUES, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_QUERYMULTIPLEVALUES, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1147,7 +1525,15 @@ NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason, WERROR *werror) +NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *hostname, + struct initshutdown_String *message, + uint32_t timeout, + uint8_t force_apps, + uint8_t reboot, + uint32_t reason, + WERROR *werror) { struct winreg_InitiateSystemShutdownEx r; NTSTATUS status; @@ -1160,17 +1546,24 @@ NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TAL r.in.reboot = reboot; r.in.reason = reason; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_INITIATESYSTEMSHUTDOWNEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_INITIATESYSTEMSHUTDOWNEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1186,24 +1579,33 @@ NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TAL return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct winreg_SaveKeyEx r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_SAVEKEYEX, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_SAVEKEYEX, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1219,7 +1621,12 @@ NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenHKPT r; NTSTATUS status; @@ -1228,17 +1635,24 @@ NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.system_name = system_name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKPT, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENHKPT, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1255,7 +1669,12 @@ NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror) +NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror) { struct winreg_OpenHKPN r; NTSTATUS status; @@ -1264,17 +1683,24 @@ NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx r.in.system_name = system_name; r.in.access_mask = access_mask; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_OPENHKPN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_OPENHKPN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1291,24 +1717,33 @@ NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror) +NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror) { struct winreg_QueryMultipleValues2 r; NTSTATUS status; /* In parameters */ - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, &ndr_table_winreg, NDR_WINREG_QUERYMULTIPLEVALUES2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WINREG, + &ndr_table_winreg, + NDR_WINREG_QUERYMULTIPLEVALUES2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_winreg.h b/source3/librpc/gen_ndr/cli_winreg.h index 48934e1286..9ba46884d5 100644 --- a/source3/librpc/gen_ndr/cli_winreg.h +++ b/source3/librpc/gen_ndr/cli_winreg.h @@ -1,39 +1,229 @@ #include "librpc/gen_ndr/ndr_winreg.h" #ifndef __CLI_WINREG__ #define __CLI_WINREG__ -NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken, WERROR *werror); -NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String key, WERROR *werror); -NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value, WERROR *werror); -NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time, WERROR *werror); -NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_ValNameBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length, WERROR *werror); -NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd, WERROR *werror); -NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename, WERROR *werror); -NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2, WERROR *werror); -NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_classlen, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time, WERROR *werror); -NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length, WERROR *werror); -NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags, WERROR *werror); -NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib, WERROR *werror); -NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd, WERROR *werror); -NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size, WERROR *werror); -NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, WERROR *werror); -NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server, WERROR *werror); -NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *version, WERROR *werror); -NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t *buffer, uint32_t *buffer_size, WERROR *werror); -NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason, WERROR *werror); -NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle, WERROR *werror); -NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); +NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String name, + struct winreg_String keyclass, + uint32_t options, + uint32_t access_mask, + struct winreg_SecBuf *secdesc, + struct policy_handle *new_handle, + enum winreg_CreateAction *action_taken, + WERROR *werror); +NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String key, + WERROR *werror); +NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String value, + WERROR *werror); +NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t enum_index, + struct winreg_StringBuf *name, + struct winreg_StringBuf *keyclass, + NTTIME *last_changed_time, + WERROR *werror); +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t enum_index, + struct winreg_ValNameBuf *name, + enum winreg_Type *type, + uint8_t *value, + uint32_t *size, + uint32_t *length, + WERROR *werror); +NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t sec_info, + struct KeySecurityData *sd, + WERROR *werror); +NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String *keyname, + struct winreg_String *filename, + WERROR *werror); +NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint8_t watch_subtree, + uint32_t notify_filter, + uint32_t unknown, + struct winreg_String string1, + struct winreg_String string2, + uint32_t unknown2, + WERROR *werror); +NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *parent_handle, + struct winreg_String keyname, + uint32_t unknown, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String *classname, + uint32_t *num_subkeys, + uint32_t *max_subkeylen, + uint32_t *max_classlen, + uint32_t *num_values, + uint32_t *max_valnamelen, + uint32_t *max_valbufsize, + uint32_t *secdescsize, + NTTIME *last_changed_time, + WERROR *werror); +NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String value_name, + enum winreg_Type *type, + uint8_t *data, + uint32_t *data_size, + uint32_t *value_length, + WERROR *werror); +NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String *filename, + uint32_t flags, + WERROR *werror); +NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String *filename, + struct KeySecurityAttribute *sec_attrib, + WERROR *werror); +NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t access_mask, + struct KeySecurityData *sd, + WERROR *werror); +NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct winreg_String name, + enum winreg_Type type, + uint8_t *data, + uint32_t size, + WERROR *werror); +NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *hostname, + struct initshutdown_String *message, + uint32_t timeout, + uint8_t force_apps, + uint8_t reboot, + WERROR *werror); +NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *server, + WERROR *werror); +NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t *version, + WERROR *werror); +NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *key_handle, + struct QueryMultipleValue *values, + uint32_t num_values, + uint8_t *buffer, + uint32_t *buffer_size, + WERROR *werror); +NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *hostname, + struct initshutdown_String *message, + uint32_t timeout, + uint8_t force_apps, + uint8_t reboot, + uint32_t reason, + WERROR *werror); +NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); +NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *handle, + WERROR *werror); +NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + WERROR *werror); #endif /* __CLI_WINREG__ */ diff --git a/source3/librpc/gen_ndr/cli_wkssvc.c b/source3/librpc/gen_ndr/cli_wkssvc.c index f0a35c701c..581a498146 100644 --- a/source3/librpc/gen_ndr/cli_wkssvc.c +++ b/source3/librpc/gen_ndr/cli_wkssvc.c @@ -6,7 +6,12 @@ #include "includes.h" #include "librpc/gen_ndr/cli_wkssvc.h" -NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetWkstaInfo *info, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t level, + union wkssvc_NetWkstaInfo *info, + WERROR *werror) { struct wkssvc_NetWkstaGetInfo r; NTSTATUS status; @@ -15,17 +20,24 @@ NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.server_name = server_name; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaGetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTAGETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETWKSTAGETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaGetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -42,7 +54,13 @@ NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetWkstaInfo *info, uint32_t *parm_error, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t level, + union wkssvc_NetWkstaInfo *info, + uint32_t *parm_error, + WERROR *werror) { struct wkssvc_NetWkstaSetInfo r; NTSTATUS status; @@ -53,17 +71,24 @@ NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.info = info; r.in.parm_error = parm_error; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaSetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTASETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETWKSTASETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaSetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -80,7 +105,14 @@ NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetWkstaEnumUsersInfo *info, uint32_t prefmaxlen, uint32_t *entries_read, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + struct wkssvc_NetWkstaEnumUsersInfo *info, + uint32_t prefmaxlen, + uint32_t *entries_read, + uint32_t *resume_handle, + WERROR *werror) { struct wkssvc_NetWkstaEnumUsers r; NTSTATUS status; @@ -91,17 +123,24 @@ NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli, TALLOC_CTX r.in.prefmaxlen = prefmaxlen; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaEnumUsers, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTAENUMUSERS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETWKSTAENUMUSERS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaEnumUsers, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -122,7 +161,12 @@ NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *unknown, uint32_t level, union wkssvc_NetrWkstaUserInfo *info, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *unknown, + uint32_t level, + union wkssvc_NetrWkstaUserInfo *info, + WERROR *werror) { struct wkssvc_NetrWkstaUserGetInfo r; NTSTATUS status; @@ -131,17 +175,24 @@ NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli, TALLOC_ r.in.unknown = unknown; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserGetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTAUSERGETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRWKSTAUSERGETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserGetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -158,7 +209,13 @@ NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *unknown, uint32_t level, union wkssvc_NetrWkstaUserInfo *info, uint32_t *parm_err, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *unknown, + uint32_t level, + union wkssvc_NetrWkstaUserInfo *info, + uint32_t *parm_err, + WERROR *werror) { struct wkssvc_NetrWkstaUserSetInfo r; NTSTATUS status; @@ -169,17 +226,24 @@ NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli, TALLOC_ r.in.info = info; r.in.parm_err = parm_err; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserSetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTAUSERSETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRWKSTAUSERSETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserSetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -198,7 +262,14 @@ NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli, TALLOC_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetWkstaTransportInfo *info, uint32_t max_buffer, uint32_t *total_entries, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + struct wkssvc_NetWkstaTransportInfo *info, + uint32_t max_buffer, + uint32_t *total_entries, + uint32_t *resume_handle, + WERROR *werror) { struct wkssvc_NetWkstaTransportEnum r; NTSTATUS status; @@ -209,17 +280,24 @@ NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli, TALLOC r.in.max_buffer = max_buffer; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaTransportEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETWKSTATRANSPORTENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETWKSTATRANSPORTENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaTransportEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -240,7 +318,13 @@ NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli, TALLOC return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, struct wkssvc_NetWkstaTransportInfo0 *info0, uint32_t *parm_err, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t level, + struct wkssvc_NetWkstaTransportInfo0 *info0, + uint32_t *parm_err, + WERROR *werror) { struct wkssvc_NetrWkstaTransportAdd r; NTSTATUS status; @@ -251,17 +335,24 @@ NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli, TALLOC r.in.info0 = info0; r.in.parm_err = parm_err; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportAdd, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTATRANSPORTADD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRWKSTATRANSPORTADD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportAdd, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -280,7 +371,12 @@ NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli, TALLOC return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *transport_name, uint32_t unknown3, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *transport_name, + uint32_t unknown3, + WERROR *werror) { struct wkssvc_NetrWkstaTransportDel r; NTSTATUS status; @@ -290,17 +386,24 @@ NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli, TALLOC r.in.transport_name = transport_name; r.in.unknown3 = unknown3; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportDel, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWKSTATRANSPORTDEL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRWKSTATRANSPORTDEL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportDel, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -316,7 +419,13 @@ NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli, TALLOC return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetrUseGetInfoCtr *ctr, uint32_t *parm_err, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t level, + union wkssvc_NetrUseGetInfoCtr *ctr, + uint32_t *parm_err, + WERROR *werror) { struct wkssvc_NetrUseAdd r; NTSTATUS status; @@ -327,17 +436,24 @@ NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.ctr = ctr; r.in.parm_err = parm_err; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUseAdd, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEADD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRUSEADD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseAdd, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -356,7 +472,13 @@ NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *use_name, uint32_t level, union wkssvc_NetrUseGetInfoCtr *ctr, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *use_name, + uint32_t level, + union wkssvc_NetrUseGetInfoCtr *ctr, + WERROR *werror) { struct wkssvc_NetrUseGetInfo r; NTSTATUS status; @@ -366,17 +488,24 @@ NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.use_name = use_name; r.in.level = level; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUseGetInfo, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEGETINFO, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRUSEGETINFO, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseGetInfo, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -393,7 +522,12 @@ NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *use_name, uint32_t force_cond, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *use_name, + uint32_t force_cond, + WERROR *werror) { struct wkssvc_NetrUseDel r; NTSTATUS status; @@ -403,17 +537,24 @@ NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c r.in.use_name = use_name; r.in.force_cond = force_cond; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUseDel, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEDEL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRUSEDEL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseDel, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -429,7 +570,14 @@ NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetrUseEnumInfo *info, uint32_t prefmaxlen, uint32_t *entries_read, uint32_t *resume_handle, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + struct wkssvc_NetrUseEnumInfo *info, + uint32_t prefmaxlen, + uint32_t *entries_read, + uint32_t *resume_handle, + WERROR *werror) { struct wkssvc_NetrUseEnum r; NTSTATUS status; @@ -440,17 +588,24 @@ NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ r.in.prefmaxlen = prefmaxlen; r.in.resume_handle = resume_handle; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUseEnum, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUSEENUM, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRUSEENUM, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseEnum, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -471,7 +626,14 @@ NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *message_name, const char *message_sender_name, uint8_t *message_buffer, uint32_t message_size, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *message_name, + const char *message_sender_name, + uint8_t *message_buffer, + uint32_t message_size, + WERROR *werror) { struct wkssvc_NetrMessageBufferSend r; NTSTATUS status; @@ -483,17 +645,24 @@ NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli, TALLOC r.in.message_buffer = message_buffer; r.in.message_size = message_size; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrMessageBufferSend, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRMESSAGEBUFFERSEND, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRMESSAGEBUFFERSEND, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrMessageBufferSend, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -509,7 +678,14 @@ NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli, TALLOC return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *unknown2, uint32_t unknown3, uint32_t unknown4, struct wkssvc_NetrWorkstationStatistics **info, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *unknown2, + uint32_t unknown3, + uint32_t unknown4, + struct wkssvc_NetrWorkstationStatistics **info, + WERROR *werror) { struct wkssvc_NetrWorkstationStatisticsGet r; NTSTATUS status; @@ -520,17 +696,24 @@ NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli, r.in.unknown3 = unknown3; r.in.unknown4 = unknown4; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWorkstationStatisticsGet, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWorkstationStatisticsGet, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -547,7 +730,10 @@ NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *domain_name, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *domain_name, + WERROR *werror) { struct wkssvc_NetrLogonDomainNameAdd r; NTSTATUS status; @@ -555,17 +741,24 @@ NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli, TALLO /* In parameters */ r.in.domain_name = domain_name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameAdd, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRLOGONDOMAINNAMEADD, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRLOGONDOMAINNAMEADD, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameAdd, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -581,7 +774,10 @@ NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *domain_name, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *domain_name, + WERROR *werror) { struct wkssvc_NetrLogonDomainNameDel r; NTSTATUS status; @@ -589,17 +785,24 @@ NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli, TALLO /* In parameters */ r.in.domain_name = domain_name; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameDel, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameDel, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -615,7 +818,15 @@ NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *account_ou, const char *Account, const char *password, uint32_t join_flags, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *account_ou, + const char *Account, + const char *password, + uint32_t join_flags, + WERROR *werror) { struct wkssvc_NetrJoinDomain r; NTSTATUS status; @@ -628,17 +839,24 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *m r.in.password = password; r.in.join_flags = join_flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRJOINDOMAIN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRJOINDOMAIN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -654,7 +872,13 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *m return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *Account, const char *password, uint32_t unjoin_flags, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *Account, + const char *password, + uint32_t unjoin_flags, + WERROR *werror) { struct wkssvc_NetrUnjoinDomain r; NTSTATUS status; @@ -665,17 +889,24 @@ NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX r.in.password = password; r.in.unjoin_flags = unjoin_flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUNJOINDOMAIN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRUNJOINDOMAIN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -691,7 +922,14 @@ NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewMachineName, const char *Account, const char *password, uint32_t RenameOptions, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *NewMachineName, + const char *Account, + const char *password, + uint32_t RenameOptions, + WERROR *werror) { struct wkssvc_NetrRenameMachineInDomain r; NTSTATUS status; @@ -703,17 +941,24 @@ NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli, TA r.in.password = password; r.in.RenameOptions = RenameOptions; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -729,7 +974,14 @@ NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli, TA return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *name, const char *Account, const char *Password, enum wkssvc_NetValidateNameType name_type, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *name, + const char *Account, + const char *Password, + enum wkssvc_NetValidateNameType name_type, + WERROR *werror) { struct wkssvc_NetrValidateName r; NTSTATUS status; @@ -741,17 +993,24 @@ NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli, TALLOC_CTX r.in.Password = Password; r.in.name_type = name_type; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRVALIDATENAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRVALIDATENAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -767,7 +1026,12 @@ NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char **name_buffer, enum wkssvc_NetJoinStatus *name_type, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char **name_buffer, + enum wkssvc_NetJoinStatus *name_type, + WERROR *werror) { struct wkssvc_NetrGetJoinInformation r; NTSTATUS status; @@ -776,17 +1040,24 @@ NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli, TALLO r.in.server_name = server_name; r.in.name_buffer = name_buffer; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinInformation, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRGETJOININFORMATION, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRGETJOININFORMATION, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinInformation, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -804,7 +1075,15 @@ NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli, TALLO return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *Account, const char *unknown, uint32_t *num_ous, const char ***ous, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *Account, + const char *unknown, + uint32_t *num_ous, + const char ***ous, + WERROR *werror) { struct wkssvc_NetrGetJoinableOus r; NTSTATUS status; @@ -816,17 +1095,24 @@ NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli, TALLOC_CT r.in.unknown = unknown; r.in.num_ous = num_ous; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRGETJOINABLEOUS, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRGETJOINABLEOUS, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -844,7 +1130,15 @@ NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli, TALLOC_CT return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *account_ou, const char *admin_account, struct wkssvc_PasswordBuffer *encrypted_password, uint32_t join_flags, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *account_ou, + const char *admin_account, + struct wkssvc_PasswordBuffer *encrypted_password, + uint32_t join_flags, + WERROR *werror) { struct wkssvc_NetrJoinDomain2 r; NTSTATUS status; @@ -857,17 +1151,24 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX * r.in.encrypted_password = encrypted_password; r.in.join_flags = join_flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRJOINDOMAIN2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRJOINDOMAIN2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -883,7 +1184,13 @@ NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX * return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account, struct wkssvc_PasswordBuffer *encrypted_password, uint32_t unjoin_flags, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account, + struct wkssvc_PasswordBuffer *encrypted_password, + uint32_t unjoin_flags, + WERROR *werror) { struct wkssvc_NetrUnjoinDomain2 r; NTSTATUS status; @@ -894,17 +1201,24 @@ NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX r.in.encrypted_password = encrypted_password; r.in.unjoin_flags = unjoin_flags; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRUNJOINDOMAIN2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRUNJOINDOMAIN2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -920,7 +1234,14 @@ NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewMachineName, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t RenameOptions, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *NewMachineName, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t RenameOptions, + WERROR *werror) { struct wkssvc_NetrRenameMachineInDomain2 r; NTSTATUS status; @@ -932,17 +1253,24 @@ NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli, T r.in.EncryptedPassword = EncryptedPassword; r.in.RenameOptions = RenameOptions; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -958,7 +1286,14 @@ NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli, T return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, enum wkssvc_NetValidateNameType name_type, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *name, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + enum wkssvc_NetValidateNameType name_type, + WERROR *werror) { struct wkssvc_NetrValidateName2 r; NTSTATUS status; @@ -970,17 +1305,24 @@ NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli, TALLOC_CTX r.in.EncryptedPassword = EncryptedPassword; r.in.name_type = name_type; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRVALIDATENAME2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRVALIDATENAME2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -996,7 +1338,15 @@ NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli, TALLOC_CTX return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t *num_ous, const char ***ous, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t *num_ous, + const char ***ous, + WERROR *werror) { struct wkssvc_NetrGetJoinableOus2 r; NTSTATUS status; @@ -1008,17 +1358,24 @@ NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli, TALLOC_C r.in.EncryptedPassword = EncryptedPassword; r.in.num_ous = num_ous; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus2, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRGETJOINABLEOUS2, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRGETJOINABLEOUS2, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus2, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1036,7 +1393,14 @@ NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli, TALLOC_C return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewAlternateMachineName, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *NewAlternateMachineName, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t Reserved, + WERROR *werror) { struct wkssvc_NetrAddAlternateComputerName r; NTSTATUS status; @@ -1048,17 +1412,24 @@ NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli, r.in.EncryptedPassword = EncryptedPassword; r.in.Reserved = Reserved; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrAddAlternateComputerName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrAddAlternateComputerName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1074,7 +1445,14 @@ NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *AlternateMachineNameToRemove, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *AlternateMachineNameToRemove, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t Reserved, + WERROR *werror) { struct wkssvc_NetrRemoveAlternateComputerName r; NTSTATUS status; @@ -1086,17 +1464,24 @@ NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *c r.in.EncryptedPassword = EncryptedPassword; r.in.Reserved = Reserved; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrRemoveAlternateComputerName, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrRemoveAlternateComputerName, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1112,7 +1497,14 @@ NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *c return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *primary_name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *primary_name, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t Reserved, + WERROR *werror) { struct wkssvc_NetrSetPrimaryComputername r; NTSTATUS status; @@ -1124,17 +1516,24 @@ NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli, T r.in.EncryptedPassword = EncryptedPassword; r.in.Reserved = Reserved; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrSetPrimaryComputername, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrSetPrimaryComputername, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; @@ -1150,7 +1549,13 @@ NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli, T return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, enum wkssvc_ComputerNameType name_type, uint32_t Reserved, struct wkssvc_ComputerNamesCtr **ctr, WERROR *werror) +NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + enum wkssvc_ComputerNameType name_type, + uint32_t Reserved, + struct wkssvc_ComputerNamesCtr **ctr, + WERROR *werror) { struct wkssvc_NetrEnumerateComputerNames r; NTSTATUS status; @@ -1160,17 +1565,24 @@ NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli, T r.in.name_type = name_type; r.in.Reserved = Reserved; - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrEnumerateComputerNames, &r); + } - status = cli_do_rpc_ndr(cli, mem_ctx, PI_WKSSVC, &ndr_table_wkssvc, NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES, &r); + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_WKSSVC, + &ndr_table_wkssvc, + NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES, + &r); if (!NT_STATUS_IS_OK(status)) { return status; } - if (DEBUGLEVEL >= 10) + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrEnumerateComputerNames, &r); + } if (NT_STATUS_IS_ERR(status)) { return status; diff --git a/source3/librpc/gen_ndr/cli_wkssvc.h b/source3/librpc/gen_ndr/cli_wkssvc.h index 4ead050d56..89012daf21 100644 --- a/source3/librpc/gen_ndr/cli_wkssvc.h +++ b/source3/librpc/gen_ndr/cli_wkssvc.h @@ -1,35 +1,230 @@ #include "librpc/gen_ndr/ndr_wkssvc.h" #ifndef __CLI_WKSSVC__ #define __CLI_WKSSVC__ -NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetWkstaInfo *info, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetWkstaInfo *info, uint32_t *parm_error, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetWkstaEnumUsersInfo *info, uint32_t prefmaxlen, uint32_t *entries_read, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *unknown, uint32_t level, union wkssvc_NetrWkstaUserInfo *info, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *unknown, uint32_t level, union wkssvc_NetrWkstaUserInfo *info, uint32_t *parm_err, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetWkstaTransportInfo *info, uint32_t max_buffer, uint32_t *total_entries, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, struct wkssvc_NetWkstaTransportInfo0 *info0, uint32_t *parm_err, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *transport_name, uint32_t unknown3, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t level, union wkssvc_NetrUseGetInfoCtr *ctr, uint32_t *parm_err, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *use_name, uint32_t level, union wkssvc_NetrUseGetInfoCtr *ctr, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *use_name, uint32_t force_cond, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, struct wkssvc_NetrUseEnumInfo *info, uint32_t prefmaxlen, uint32_t *entries_read, uint32_t *resume_handle, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *message_name, const char *message_sender_name, uint8_t *message_buffer, uint32_t message_size, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *unknown2, uint32_t unknown3, uint32_t unknown4, struct wkssvc_NetrWorkstationStatistics **info, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *domain_name, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *domain_name, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *account_ou, const char *Account, const char *password, uint32_t join_flags, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *Account, const char *password, uint32_t unjoin_flags, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewMachineName, const char *Account, const char *password, uint32_t RenameOptions, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *name, const char *Account, const char *Password, enum wkssvc_NetValidateNameType name_type, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char **name_buffer, enum wkssvc_NetJoinStatus *name_type, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *Account, const char *unknown, uint32_t *num_ous, const char ***ous, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *account_ou, const char *admin_account, struct wkssvc_PasswordBuffer *encrypted_password, uint32_t join_flags, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *account, struct wkssvc_PasswordBuffer *encrypted_password, uint32_t unjoin_flags, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewMachineName, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t RenameOptions, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, enum wkssvc_NetValidateNameType name_type, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t *num_ous, const char ***ous, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *NewAlternateMachineName, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *AlternateMachineNameToRemove, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *primary_name, const char *Account, struct wkssvc_PasswordBuffer *EncryptedPassword, uint32_t Reserved, WERROR *werror); -NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, enum wkssvc_ComputerNameType name_type, uint32_t Reserved, struct wkssvc_ComputerNamesCtr **ctr, WERROR *werror); +NTSTATUS rpccli_wkssvc_NetWkstaGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t level, + union wkssvc_NetWkstaInfo *info, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetWkstaSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t level, + union wkssvc_NetWkstaInfo *info, + uint32_t *parm_error, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetWkstaEnumUsers(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + struct wkssvc_NetWkstaEnumUsersInfo *info, + uint32_t prefmaxlen, + uint32_t *entries_read, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrWkstaUserGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *unknown, + uint32_t level, + union wkssvc_NetrWkstaUserInfo *info, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrWkstaUserSetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *unknown, + uint32_t level, + union wkssvc_NetrWkstaUserInfo *info, + uint32_t *parm_err, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetWkstaTransportEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + struct wkssvc_NetWkstaTransportInfo *info, + uint32_t max_buffer, + uint32_t *total_entries, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrWkstaTransportAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t level, + struct wkssvc_NetWkstaTransportInfo0 *info0, + uint32_t *parm_err, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrWkstaTransportDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *transport_name, + uint32_t unknown3, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrUseAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t level, + union wkssvc_NetrUseGetInfoCtr *ctr, + uint32_t *parm_err, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrUseGetInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *use_name, + uint32_t level, + union wkssvc_NetrUseGetInfoCtr *ctr, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrUseDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *use_name, + uint32_t force_cond, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrUseEnum(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + struct wkssvc_NetrUseEnumInfo *info, + uint32_t prefmaxlen, + uint32_t *entries_read, + uint32_t *resume_handle, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrMessageBufferSend(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *message_name, + const char *message_sender_name, + uint8_t *message_buffer, + uint32_t message_size, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrWorkstationStatisticsGet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *unknown2, + uint32_t unknown3, + uint32_t unknown4, + struct wkssvc_NetrWorkstationStatistics **info, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrLogonDomainNameAdd(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *domain_name, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrLogonDomainNameDel(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *domain_name, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrJoinDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *account_ou, + const char *Account, + const char *password, + uint32_t join_flags, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrUnjoinDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *Account, + const char *password, + uint32_t unjoin_flags, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *NewMachineName, + const char *Account, + const char *password, + uint32_t RenameOptions, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrValidateName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *name, + const char *Account, + const char *Password, + enum wkssvc_NetValidateNameType name_type, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrGetJoinInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char **name_buffer, + enum wkssvc_NetJoinStatus *name_type, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrGetJoinableOus(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *Account, + const char *unknown, + uint32_t *num_ous, + const char ***ous, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrJoinDomain2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *account_ou, + const char *admin_account, + struct wkssvc_PasswordBuffer *encrypted_password, + uint32_t join_flags, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrUnjoinDomain2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account, + struct wkssvc_PasswordBuffer *encrypted_password, + uint32_t unjoin_flags, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrRenameMachineInDomain2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *NewMachineName, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t RenameOptions, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrValidateName2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *name, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + enum wkssvc_NetValidateNameType name_type, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrGetJoinableOus2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *domain_name, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t *num_ous, + const char ***ous, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrAddAlternateComputerName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *NewAlternateMachineName, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t Reserved, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrRemoveAlternateComputerName(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *AlternateMachineNameToRemove, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t Reserved, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrSetPrimaryComputername(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *primary_name, + const char *Account, + struct wkssvc_PasswordBuffer *EncryptedPassword, + uint32_t Reserved, + WERROR *werror); +NTSTATUS rpccli_wkssvc_NetrEnumerateComputerNames(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + enum wkssvc_ComputerNameType name_type, + uint32_t Reserved, + struct wkssvc_ComputerNamesCtr **ctr, + WERROR *werror); #endif /* __CLI_WKSSVC__ */ -- cgit From b43719d0fb240d7eacc7d0e08ac220c982516867 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Jan 2008 11:44:40 +0100 Subject: Attempt to fix the compile of source/utils/net_dns.c Jeremy, please check! (This used to be commit 66d3012bf422b2ffc47fa6a405269bad2a80bd6f) --- source3/utils/net_dns.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source3/utils/net_dns.c b/source3/utils/net_dns.c index c661c77ce6..44a0b46e4e 100644 --- a/source3/utils/net_dns.c +++ b/source3/utils/net_dns.c @@ -47,7 +47,7 @@ DNS_ERROR DoDNSUpdate(char *pszServerName, OM_uint32 minor; struct dns_update_request *req, *resp; - if ( (num_addrs <= 0) || !iplist ) { + if ( (num_addrs <= 0) || !sslist ) { return ERROR_DNS_INVALID_PARAMETER; } @@ -167,14 +167,16 @@ int get_my_ip_address( struct sockaddr_storage **pp_ss ) } #if defined(HAVE_IPV6) if ((nics[i].ip.ss_family == AF_INET)) { - memcpy(&list[count++], &nics[i].ip); + memcpy(&list[count++], &nics[i].ip, + sizeof(struct sockaddr_storage)); } else #endif - if ((nics[i].ip.ss_family == AF_INET)) { - memcpy(&list[count++], &nics[i].ip); + if (nics[i].ip.ss_family == AF_INET) { + memcpy(&list[count++], &nics[i].ip, + sizeof(struct sockaddr_storage)); } } - *ips = list; + *pp_ss = list; return count; } -- cgit From 1ac5e6cdfe19f601549de4f3e5b8fbf5be4abe0c Mon Sep 17 00:00:00 2001 From: Karolin Seeger Date: Tue, 8 Jan 2008 19:21:26 +0100 Subject: Correct comment. Default debug level of smbclient is 1, not 0. (This used to be commit 9c81125e6d3df49806e1c0b39409ffac8e3a0fd1) --- source3/client/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/client/client.c b/source3/client/client.c index 46f056021e..267c13048e 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -4624,7 +4624,7 @@ static int do_message_op(void) set_global_myworkgroup( "" ); set_global_myname( "" ); - /* set default debug level to 0 regardless of what smb.conf sets */ + /* set default debug level to 1 regardless of what smb.conf sets */ setup_logging( "smbclient", true ); DEBUGLEVEL_CLASS[DBGC_ALL] = 1; if ((dbf = x_fdup(x_stderr))) { -- cgit From 3d87cba590b714e95c4e02946bdba8588c3d3700 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 9 Jan 2008 12:28:44 +0100 Subject: Re-run make idl to get even nicer pidl generated server code. Guenther (This used to be commit 6169dea4dc3c4fc5eb1caefde828ed896cf048c5) --- source3/librpc/gen_ndr/srv_dfs.c | 1296 ++++---- source3/librpc/gen_ndr/srv_echo.c | 580 ++-- source3/librpc/gen_ndr/srv_epmapper.c | 464 +-- source3/librpc/gen_ndr/srv_eventlog.c | 1364 +++++---- source3/librpc/gen_ndr/srv_initshutdown.c | 168 +- source3/librpc/gen_ndr/srv_lsa.c | 4728 +++++++++++++++-------------- source3/librpc/gen_ndr/srv_netlogon.c | 2772 +++++++++-------- source3/librpc/gen_ndr/srv_srvsvc.c | 3108 ++++++++++--------- source3/librpc/gen_ndr/srv_svcctl.c | 2656 ++++++++-------- source3/librpc/gen_ndr/srv_unixinfo.c | 300 +- source3/librpc/gen_ndr/srv_winreg.c | 2040 +++++++------ source3/librpc/gen_ndr/srv_wkssvc.c | 1780 +++++------ 12 files changed, 10994 insertions(+), 10262 deletions(-) diff --git a/source3/librpc/gen_ndr/srv_dfs.c b/source3/librpc/gen_ndr/srv_dfs.c index 4c92c438f0..384c2ba940 100644 --- a/source3/librpc/gen_ndr/srv_dfs.c +++ b/source3/librpc/gen_ndr/srv_dfs.c @@ -14,74 +14,76 @@ static bool api_dfs_GetManagerVersion(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_GetManagerVersion *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_GETMANAGERVERSION]; - + r = talloc(NULL, struct dfs_GetManagerVersion); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_GetManagerVersion, r); - + } + ZERO_STRUCT(r->out); r->out.version = talloc_zero(r, enum dfs_ManagerVersion); if (r->out.version == NULL) { talloc_free(r); - return False; + return false; } - + _dfs_GetManagerVersion(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_GetManagerVersion, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_Add(pipes_struct *p) @@ -92,67 +94,69 @@ static bool api_dfs_Add(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_Add *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_ADD]; - + r = talloc(NULL, struct dfs_Add); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Add, r); - + } + r->out.result = _dfs_Add(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Add, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_Remove(pipes_struct *p) @@ -163,67 +167,69 @@ static bool api_dfs_Remove(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_Remove *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_REMOVE]; - + r = talloc(NULL, struct dfs_Remove); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Remove, r); - + } + r->out.result = _dfs_Remove(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Remove, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_SetInfo(pipes_struct *p) @@ -234,67 +240,69 @@ static bool api_dfs_SetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_SetInfo *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_SETINFO]; - + r = talloc(NULL, struct dfs_SetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_SetInfo, r); - + } + r->out.result = _dfs_SetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_SetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_GetInfo(pipes_struct *p) @@ -305,74 +313,76 @@ static bool api_dfs_GetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_GetInfo *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_GETINFO]; - + r = talloc(NULL, struct dfs_GetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_GetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union dfs_Info); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _dfs_GetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_GetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_Enum(pipes_struct *p) @@ -383,70 +393,72 @@ static bool api_dfs_Enum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_Enum *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_ENUM]; - + r = talloc(NULL, struct dfs_Enum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Enum, r); - + } + ZERO_STRUCT(r->out); r->out.info = r->in.info; r->out.total = r->in.total; r->out.result = _dfs_Enum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Enum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_Rename(pipes_struct *p) @@ -457,67 +469,69 @@ static bool api_dfs_Rename(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_Rename *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_RENAME]; - + r = talloc(NULL, struct dfs_Rename); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Rename, r); - + } + r->out.result = _dfs_Rename(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Rename, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_Move(pipes_struct *p) @@ -528,67 +542,69 @@ static bool api_dfs_Move(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_Move *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_MOVE]; - + r = talloc(NULL, struct dfs_Move); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Move, r); - + } + r->out.result = _dfs_Move(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Move, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_ManagerGetConfigInfo(pipes_struct *p) @@ -599,67 +615,69 @@ static bool api_dfs_ManagerGetConfigInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_ManagerGetConfigInfo *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_MANAGERGETCONFIGINFO]; - + r = talloc(NULL, struct dfs_ManagerGetConfigInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_ManagerGetConfigInfo, r); - + } + r->out.result = _dfs_ManagerGetConfigInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_ManagerGetConfigInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_ManagerSendSiteInfo(pipes_struct *p) @@ -670,67 +688,69 @@ static bool api_dfs_ManagerSendSiteInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_ManagerSendSiteInfo *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_MANAGERSENDSITEINFO]; - + r = talloc(NULL, struct dfs_ManagerSendSiteInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_ManagerSendSiteInfo, r); - + } + r->out.result = _dfs_ManagerSendSiteInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_ManagerSendSiteInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_AddFtRoot(pipes_struct *p) @@ -741,69 +761,71 @@ static bool api_dfs_AddFtRoot(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_AddFtRoot *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_ADDFTROOT]; - + r = talloc(NULL, struct dfs_AddFtRoot); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_AddFtRoot, r); - + } + ZERO_STRUCT(r->out); r->out.unknown2 = r->in.unknown2; r->out.result = _dfs_AddFtRoot(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_AddFtRoot, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_RemoveFtRoot(pipes_struct *p) @@ -814,69 +836,71 @@ static bool api_dfs_RemoveFtRoot(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_RemoveFtRoot *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_REMOVEFTROOT]; - + r = talloc(NULL, struct dfs_RemoveFtRoot); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_RemoveFtRoot, r); - + } + ZERO_STRUCT(r->out); r->out.unknown = r->in.unknown; r->out.result = _dfs_RemoveFtRoot(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_RemoveFtRoot, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_AddStdRoot(pipes_struct *p) @@ -887,67 +911,69 @@ static bool api_dfs_AddStdRoot(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_AddStdRoot *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_ADDSTDROOT]; - + r = talloc(NULL, struct dfs_AddStdRoot); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_AddStdRoot, r); - + } + r->out.result = _dfs_AddStdRoot(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_AddStdRoot, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_RemoveStdRoot(pipes_struct *p) @@ -958,67 +984,69 @@ static bool api_dfs_RemoveStdRoot(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_RemoveStdRoot *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_REMOVESTDROOT]; - + r = talloc(NULL, struct dfs_RemoveStdRoot); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_RemoveStdRoot, r); - + } + r->out.result = _dfs_RemoveStdRoot(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_RemoveStdRoot, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_ManagerInitialize(pipes_struct *p) @@ -1029,67 +1057,69 @@ static bool api_dfs_ManagerInitialize(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_ManagerInitialize *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_MANAGERINITIALIZE]; - + r = talloc(NULL, struct dfs_ManagerInitialize); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_ManagerInitialize, r); - + } + r->out.result = _dfs_ManagerInitialize(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_ManagerInitialize, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_AddStdRootForced(pipes_struct *p) @@ -1100,67 +1130,69 @@ static bool api_dfs_AddStdRootForced(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_AddStdRootForced *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_ADDSTDROOTFORCED]; - + r = talloc(NULL, struct dfs_AddStdRootForced); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_AddStdRootForced, r); - + } + r->out.result = _dfs_AddStdRootForced(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_AddStdRootForced, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_GetDcAddress(pipes_struct *p) @@ -1171,67 +1203,69 @@ static bool api_dfs_GetDcAddress(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_GetDcAddress *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_GETDCADDRESS]; - + r = talloc(NULL, struct dfs_GetDcAddress); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_GetDcAddress, r); - + } + r->out.result = _dfs_GetDcAddress(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_GetDcAddress, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_SetDcAddress(pipes_struct *p) @@ -1242,67 +1276,69 @@ static bool api_dfs_SetDcAddress(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_SetDcAddress *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_SETDCADDRESS]; - + r = talloc(NULL, struct dfs_SetDcAddress); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_SetDcAddress, r); - + } + r->out.result = _dfs_SetDcAddress(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_SetDcAddress, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_FlushFtTable(pipes_struct *p) @@ -1313,67 +1349,69 @@ static bool api_dfs_FlushFtTable(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_FlushFtTable *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_FLUSHFTTABLE]; - + r = talloc(NULL, struct dfs_FlushFtTable); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_FlushFtTable, r); - + } + r->out.result = _dfs_FlushFtTable(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_FlushFtTable, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_Add2(pipes_struct *p) @@ -1384,67 +1422,69 @@ static bool api_dfs_Add2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_Add2 *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_ADD2]; - + r = talloc(NULL, struct dfs_Add2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Add2, r); - + } + r->out.result = _dfs_Add2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Add2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_Remove2(pipes_struct *p) @@ -1455,67 +1495,69 @@ static bool api_dfs_Remove2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_Remove2 *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_REMOVE2]; - + r = talloc(NULL, struct dfs_Remove2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_Remove2, r); - + } + r->out.result = _dfs_Remove2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_Remove2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_EnumEx(pipes_struct *p) @@ -1526,70 +1568,72 @@ static bool api_dfs_EnumEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_EnumEx *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_ENUMEX]; - + r = talloc(NULL, struct dfs_EnumEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_EnumEx, r); - + } + ZERO_STRUCT(r->out); r->out.info = r->in.info; r->out.total = r->in.total; r->out.result = _dfs_EnumEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_EnumEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_dfs_SetInfo2(pipes_struct *p) @@ -1600,67 +1644,69 @@ static bool api_dfs_SetInfo2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct dfs_SetInfo2 *r; - + call = &ndr_table_netdfs.calls[NDR_DFS_SETINFO2]; - + r = talloc(NULL, struct dfs_SetInfo2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_SetInfo2, r); - + } + r->out.result = _dfs_SetInfo2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(dfs_SetInfo2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_echo.c b/source3/librpc/gen_ndr/srv_echo.c index 7e292985bc..de5fc9cd46 100644 --- a/source3/librpc/gen_ndr/srv_echo.c +++ b/source3/librpc/gen_ndr/srv_echo.c @@ -14,74 +14,76 @@ static bool api_echo_AddOne(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_AddOne *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_ADDONE]; - + r = talloc(NULL, struct echo_AddOne); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_AddOne, r); - + } + ZERO_STRUCT(r->out); r->out.out_data = talloc_zero(r, uint32_t); if (r->out.out_data == NULL) { talloc_free(r); - return False; + return false; } - + _echo_AddOne(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_AddOne, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_echo_EchoData(pipes_struct *p) @@ -92,74 +94,76 @@ static bool api_echo_EchoData(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_EchoData *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_ECHODATA]; - + r = talloc(NULL, struct echo_EchoData); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_EchoData, r); - + } + ZERO_STRUCT(r->out); r->out.out_data = talloc_zero_array(r, uint8_t, r->in.len); if (r->out.out_data == NULL) { talloc_free(r); - return False; + return false; } - + _echo_EchoData(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_EchoData, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_echo_SinkData(pipes_struct *p) @@ -170,67 +174,69 @@ static bool api_echo_SinkData(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_SinkData *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_SINKDATA]; - + r = talloc(NULL, struct echo_SinkData); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_SinkData, r); - + } + _echo_SinkData(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_SinkData, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_echo_SourceData(pipes_struct *p) @@ -241,74 +247,76 @@ static bool api_echo_SourceData(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_SourceData *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_SOURCEDATA]; - + r = talloc(NULL, struct echo_SourceData); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_SourceData, r); - + } + ZERO_STRUCT(r->out); r->out.data = talloc_zero_array(r, uint8_t, r->in.len); if (r->out.data == NULL) { talloc_free(r); - return False; + return false; } - + _echo_SourceData(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_SourceData, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_echo_TestCall(pipes_struct *p) @@ -319,74 +327,76 @@ static bool api_echo_TestCall(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_TestCall *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL]; - + r = talloc(NULL, struct echo_TestCall); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestCall, r); - + } + ZERO_STRUCT(r->out); r->out.s2 = talloc_zero(r, const char *); if (r->out.s2 == NULL) { talloc_free(r); - return False; + return false; } - + _echo_TestCall(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestCall, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_echo_TestCall2(pipes_struct *p) @@ -397,74 +407,76 @@ static bool api_echo_TestCall2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_TestCall2 *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTCALL2]; - + r = talloc(NULL, struct echo_TestCall2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestCall2, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union echo_Info); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _echo_TestCall2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestCall2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_echo_TestSleep(pipes_struct *p) @@ -475,67 +487,69 @@ static bool api_echo_TestSleep(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_TestSleep *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSLEEP]; - + r = talloc(NULL, struct echo_TestSleep); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestSleep, r); - + } + r->out.result = _echo_TestSleep(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestSleep, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_echo_TestEnum(pipes_struct *p) @@ -546,71 +560,73 @@ static bool api_echo_TestEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_TestEnum *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTENUM]; - + r = talloc(NULL, struct echo_TestEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestEnum, r); - + } + ZERO_STRUCT(r->out); r->out.foo1 = r->in.foo1; r->out.foo2 = r->in.foo2; r->out.foo3 = r->in.foo3; _echo_TestEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_echo_TestSurrounding(pipes_struct *p) @@ -621,69 +637,71 @@ static bool api_echo_TestSurrounding(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_TestSurrounding *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTSURROUNDING]; - + r = talloc(NULL, struct echo_TestSurrounding); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestSurrounding, r); - + } + ZERO_STRUCT(r->out); r->out.data = r->in.data; _echo_TestSurrounding(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_echo_TestDoublePointer(pipes_struct *p) @@ -694,67 +712,69 @@ static bool api_echo_TestDoublePointer(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct echo_TestDoublePointer *r; - + call = &ndr_table_rpcecho.calls[NDR_ECHO_TESTDOUBLEPOINTER]; - + r = talloc(NULL, struct echo_TestDoublePointer); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(echo_TestDoublePointer, r); - + } + r->out.result = _echo_TestDoublePointer(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_epmapper.c b/source3/librpc/gen_ndr/srv_epmapper.c index d74a509cfb..af768d9555 100644 --- a/source3/librpc/gen_ndr/srv_epmapper.c +++ b/source3/librpc/gen_ndr/srv_epmapper.c @@ -14,67 +14,69 @@ static bool api_epm_Insert(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct epm_Insert *r; - + call = &ndr_table_epmapper.calls[NDR_EPM_INSERT]; - + r = talloc(NULL, struct epm_Insert); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_Insert, r); - + } + r->out.result = _epm_Insert(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_Insert, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_epm_Delete(pipes_struct *p) @@ -85,67 +87,69 @@ static bool api_epm_Delete(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct epm_Delete *r; - + call = &ndr_table_epmapper.calls[NDR_EPM_DELETE]; - + r = talloc(NULL, struct epm_Delete); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_Delete, r); - + } + r->out.result = _epm_Delete(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_Delete, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_epm_Lookup(pipes_struct *p) @@ -156,81 +160,83 @@ static bool api_epm_Lookup(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct epm_Lookup *r; - + call = &ndr_table_epmapper.calls[NDR_EPM_LOOKUP]; - + r = talloc(NULL, struct epm_Lookup); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_Lookup, r); - + } + ZERO_STRUCT(r->out); r->out.entry_handle = r->in.entry_handle; r->out.num_ents = talloc_zero(r, uint32_t); if (r->out.num_ents == NULL) { talloc_free(r); - return False; + return false; } - + r->out.entries = talloc_zero_array(r, struct epm_entry_t, r->in.max_ents); if (r->out.entries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _epm_Lookup(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_Lookup, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_epm_Map(pipes_struct *p) @@ -241,81 +247,83 @@ static bool api_epm_Map(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct epm_Map *r; - + call = &ndr_table_epmapper.calls[NDR_EPM_MAP]; - + r = talloc(NULL, struct epm_Map); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_Map, r); - + } + ZERO_STRUCT(r->out); r->out.entry_handle = r->in.entry_handle; r->out.num_towers = talloc_zero(r, uint32_t); if (r->out.num_towers == NULL) { talloc_free(r); - return False; + return false; } - + r->out.towers = talloc_zero_array(r, struct epm_twr_p_t, r->in.max_towers); if (r->out.towers == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _epm_Map(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_Map, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_epm_LookupHandleFree(pipes_struct *p) @@ -326,69 +334,71 @@ static bool api_epm_LookupHandleFree(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct epm_LookupHandleFree *r; - + call = &ndr_table_epmapper.calls[NDR_EPM_LOOKUPHANDLEFREE]; - + r = talloc(NULL, struct epm_LookupHandleFree); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_LookupHandleFree, r); - + } + ZERO_STRUCT(r->out); r->out.entry_handle = r->in.entry_handle; r->out.result = _epm_LookupHandleFree(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_LookupHandleFree, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_epm_InqObject(pipes_struct *p) @@ -399,67 +409,69 @@ static bool api_epm_InqObject(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct epm_InqObject *r; - + call = &ndr_table_epmapper.calls[NDR_EPM_INQOBJECT]; - + r = talloc(NULL, struct epm_InqObject); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_InqObject, r); - + } + r->out.result = _epm_InqObject(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_InqObject, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_epm_MgmtDelete(pipes_struct *p) @@ -470,67 +482,69 @@ static bool api_epm_MgmtDelete(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct epm_MgmtDelete *r; - + call = &ndr_table_epmapper.calls[NDR_EPM_MGMTDELETE]; - + r = talloc(NULL, struct epm_MgmtDelete); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_MgmtDelete, r); - + } + r->out.result = _epm_MgmtDelete(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_MgmtDelete, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_epm_MapAuth(pipes_struct *p) @@ -541,67 +555,69 @@ static bool api_epm_MapAuth(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct epm_MapAuth *r; - + call = &ndr_table_epmapper.calls[NDR_EPM_MAPAUTH]; - + r = talloc(NULL, struct epm_MapAuth); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(epm_MapAuth, r); - + } + r->out.result = _epm_MapAuth(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(epm_MapAuth, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_eventlog.c b/source3/librpc/gen_ndr/srv_eventlog.c index 784bb51d6f..d9310a8fbb 100644 --- a/source3/librpc/gen_ndr/srv_eventlog.c +++ b/source3/librpc/gen_ndr/srv_eventlog.c @@ -14,67 +14,69 @@ static bool api_eventlog_ClearEventLogW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_ClearEventLogW *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CLEAREVENTLOGW]; - + r = talloc(NULL, struct eventlog_ClearEventLogW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogW, r); - + } + r->out.result = _eventlog_ClearEventLogW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_BackupEventLogW(pipes_struct *p) @@ -85,67 +87,69 @@ static bool api_eventlog_BackupEventLogW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_BackupEventLogW *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_BACKUPEVENTLOGW]; - + r = talloc(NULL, struct eventlog_BackupEventLogW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogW, r); - + } + r->out.result = _eventlog_BackupEventLogW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_CloseEventLog(pipes_struct *p) @@ -156,69 +160,71 @@ static bool api_eventlog_CloseEventLog(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_CloseEventLog *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CLOSEEVENTLOG]; - + r = talloc(NULL, struct eventlog_CloseEventLog); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_CloseEventLog, r); - + } + ZERO_STRUCT(r->out); r->out.handle = r->in.handle; r->out.result = _eventlog_CloseEventLog(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_CloseEventLog, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_DeregisterEventSource(pipes_struct *p) @@ -229,67 +235,69 @@ static bool api_eventlog_DeregisterEventSource(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_DeregisterEventSource *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_DEREGISTEREVENTSOURCE]; - + r = talloc(NULL, struct eventlog_DeregisterEventSource); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_DeregisterEventSource, r); - + } + r->out.result = _eventlog_DeregisterEventSource(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_DeregisterEventSource, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_GetNumRecords(pipes_struct *p) @@ -300,74 +308,76 @@ static bool api_eventlog_GetNumRecords(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_GetNumRecords *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_GETNUMRECORDS]; - + r = talloc(NULL, struct eventlog_GetNumRecords); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_GetNumRecords, r); - + } + ZERO_STRUCT(r->out); r->out.number = talloc_zero(r, uint32_t); if (r->out.number == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _eventlog_GetNumRecords(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_GetNumRecords, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_GetOldestRecord(pipes_struct *p) @@ -378,67 +388,69 @@ static bool api_eventlog_GetOldestRecord(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_GetOldestRecord *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_GETOLDESTRECORD]; - + r = talloc(NULL, struct eventlog_GetOldestRecord); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_GetOldestRecord, r); - + } + r->out.result = _eventlog_GetOldestRecord(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_GetOldestRecord, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_ChangeNotify(pipes_struct *p) @@ -449,67 +461,69 @@ static bool api_eventlog_ChangeNotify(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_ChangeNotify *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CHANGENOTIFY]; - + r = talloc(NULL, struct eventlog_ChangeNotify); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ChangeNotify, r); - + } + r->out.result = _eventlog_ChangeNotify(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ChangeNotify, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_OpenEventLogW(pipes_struct *p) @@ -520,74 +534,76 @@ static bool api_eventlog_OpenEventLogW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_OpenEventLogW *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENEVENTLOGW]; - + r = talloc(NULL, struct eventlog_OpenEventLogW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogW, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _eventlog_OpenEventLogW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_RegisterEventSourceW(pipes_struct *p) @@ -598,67 +614,69 @@ static bool api_eventlog_RegisterEventSourceW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_RegisterEventSourceW *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REGISTEREVENTSOURCEW]; - + r = talloc(NULL, struct eventlog_RegisterEventSourceW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceW, r); - + } + r->out.result = _eventlog_RegisterEventSourceW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_OpenBackupEventLogW(pipes_struct *p) @@ -669,67 +687,69 @@ static bool api_eventlog_OpenBackupEventLogW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_OpenBackupEventLogW *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENBACKUPEVENTLOGW]; - + r = talloc(NULL, struct eventlog_OpenBackupEventLogW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogW, r); - + } + r->out.result = _eventlog_OpenBackupEventLogW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_ReadEventLogW(pipes_struct *p) @@ -740,86 +760,88 @@ static bool api_eventlog_ReadEventLogW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_ReadEventLogW *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_READEVENTLOGW]; - + r = talloc(NULL, struct eventlog_ReadEventLogW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogW, r); - + } + ZERO_STRUCT(r->out); r->out.data = talloc_zero_array(r, uint8_t, r->in.number_of_bytes); if (r->out.data == NULL) { talloc_free(r); - return False; + return false; } - + r->out.sent_size = talloc_zero(r, uint32_t); if (r->out.sent_size == NULL) { talloc_free(r); - return False; + return false; } - + r->out.real_size = talloc_zero(r, uint32_t); if (r->out.real_size == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _eventlog_ReadEventLogW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_ReportEventW(pipes_struct *p) @@ -830,67 +852,69 @@ static bool api_eventlog_ReportEventW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_ReportEventW *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REPORTEVENTW]; - + r = talloc(NULL, struct eventlog_ReportEventW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ReportEventW, r); - + } + r->out.result = _eventlog_ReportEventW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ReportEventW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_ClearEventLogA(pipes_struct *p) @@ -901,67 +925,69 @@ static bool api_eventlog_ClearEventLogA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_ClearEventLogA *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_CLEAREVENTLOGA]; - + r = talloc(NULL, struct eventlog_ClearEventLogA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ClearEventLogA, r); - + } + r->out.result = _eventlog_ClearEventLogA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_BackupEventLogA(pipes_struct *p) @@ -972,67 +998,69 @@ static bool api_eventlog_BackupEventLogA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_BackupEventLogA *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_BACKUPEVENTLOGA]; - + r = talloc(NULL, struct eventlog_BackupEventLogA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_BackupEventLogA, r); - + } + r->out.result = _eventlog_BackupEventLogA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_OpenEventLogA(pipes_struct *p) @@ -1043,67 +1071,69 @@ static bool api_eventlog_OpenEventLogA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_OpenEventLogA *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENEVENTLOGA]; - + r = talloc(NULL, struct eventlog_OpenEventLogA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_OpenEventLogA, r); - + } + r->out.result = _eventlog_OpenEventLogA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_RegisterEventSourceA(pipes_struct *p) @@ -1114,67 +1144,69 @@ static bool api_eventlog_RegisterEventSourceA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_RegisterEventSourceA *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REGISTEREVENTSOURCEA]; - + r = talloc(NULL, struct eventlog_RegisterEventSourceA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_RegisterEventSourceA, r); - + } + r->out.result = _eventlog_RegisterEventSourceA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_OpenBackupEventLogA(pipes_struct *p) @@ -1185,67 +1217,69 @@ static bool api_eventlog_OpenBackupEventLogA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_OpenBackupEventLogA *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_OPENBACKUPEVENTLOGA]; - + r = talloc(NULL, struct eventlog_OpenBackupEventLogA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_OpenBackupEventLogA, r); - + } + r->out.result = _eventlog_OpenBackupEventLogA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_ReadEventLogA(pipes_struct *p) @@ -1256,67 +1290,69 @@ static bool api_eventlog_ReadEventLogA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_ReadEventLogA *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_READEVENTLOGA]; - + r = talloc(NULL, struct eventlog_ReadEventLogA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ReadEventLogA, r); - + } + r->out.result = _eventlog_ReadEventLogA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_ReportEventA(pipes_struct *p) @@ -1327,67 +1363,69 @@ static bool api_eventlog_ReportEventA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_ReportEventA *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REPORTEVENTA]; - + r = talloc(NULL, struct eventlog_ReportEventA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_ReportEventA, r); - + } + r->out.result = _eventlog_ReportEventA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_ReportEventA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_RegisterClusterSvc(pipes_struct *p) @@ -1398,67 +1436,69 @@ static bool api_eventlog_RegisterClusterSvc(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_RegisterClusterSvc *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_REGISTERCLUSTERSVC]; - + r = talloc(NULL, struct eventlog_RegisterClusterSvc); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_RegisterClusterSvc, r); - + } + r->out.result = _eventlog_RegisterClusterSvc(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_RegisterClusterSvc, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_DeregisterClusterSvc(pipes_struct *p) @@ -1469,67 +1509,69 @@ static bool api_eventlog_DeregisterClusterSvc(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_DeregisterClusterSvc *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_DEREGISTERCLUSTERSVC]; - + r = talloc(NULL, struct eventlog_DeregisterClusterSvc); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_DeregisterClusterSvc, r); - + } + r->out.result = _eventlog_DeregisterClusterSvc(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_DeregisterClusterSvc, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_WriteClusterEvents(pipes_struct *p) @@ -1540,67 +1582,69 @@ static bool api_eventlog_WriteClusterEvents(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_WriteClusterEvents *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_WRITECLUSTEREVENTS]; - + r = talloc(NULL, struct eventlog_WriteClusterEvents); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_WriteClusterEvents, r); - + } + r->out.result = _eventlog_WriteClusterEvents(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_WriteClusterEvents, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_GetLogIntormation(pipes_struct *p) @@ -1611,67 +1655,69 @@ static bool api_eventlog_GetLogIntormation(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_GetLogIntormation *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_GETLOGINTORMATION]; - + r = talloc(NULL, struct eventlog_GetLogIntormation); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_GetLogIntormation, r); - + } + r->out.result = _eventlog_GetLogIntormation(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_GetLogIntormation, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_eventlog_FlushEventLog(pipes_struct *p) @@ -1682,67 +1728,69 @@ static bool api_eventlog_FlushEventLog(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct eventlog_FlushEventLog *r; - + call = &ndr_table_eventlog.calls[NDR_EVENTLOG_FLUSHEVENTLOG]; - + r = talloc(NULL, struct eventlog_FlushEventLog); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(eventlog_FlushEventLog, r); - + } + r->out.result = _eventlog_FlushEventLog(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(eventlog_FlushEventLog, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_initshutdown.c b/source3/librpc/gen_ndr/srv_initshutdown.c index 56fbf42957..794adea81b 100644 --- a/source3/librpc/gen_ndr/srv_initshutdown.c +++ b/source3/librpc/gen_ndr/srv_initshutdown.c @@ -14,67 +14,69 @@ static bool api_initshutdown_Init(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct initshutdown_Init *r; - + call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_INIT]; - + r = talloc(NULL, struct initshutdown_Init); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(initshutdown_Init, r); - + } + r->out.result = _initshutdown_Init(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(initshutdown_Init, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_initshutdown_Abort(pipes_struct *p) @@ -85,67 +87,69 @@ static bool api_initshutdown_Abort(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct initshutdown_Abort *r; - + call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_ABORT]; - + r = talloc(NULL, struct initshutdown_Abort); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(initshutdown_Abort, r); - + } + r->out.result = _initshutdown_Abort(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(initshutdown_Abort, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_initshutdown_InitEx(pipes_struct *p) @@ -156,67 +160,69 @@ static bool api_initshutdown_InitEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct initshutdown_InitEx *r; - + call = &ndr_table_initshutdown.calls[NDR_INITSHUTDOWN_INITEX]; - + r = talloc(NULL, struct initshutdown_InitEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(initshutdown_InitEx, r); - + } + r->out.result = _initshutdown_InitEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(initshutdown_InitEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_lsa.c b/source3/librpc/gen_ndr/srv_lsa.c index b76680969a..68dc32cef5 100644 --- a/source3/librpc/gen_ndr/srv_lsa.c +++ b/source3/librpc/gen_ndr/srv_lsa.c @@ -14,69 +14,71 @@ static bool api_lsa_Close(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_Close *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CLOSE]; - + r = talloc(NULL, struct lsa_Close); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_Close, r); - + } + ZERO_STRUCT(r->out); r->out.handle = r->in.handle; r->out.result = _lsa_Close(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_Close, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_Delete(pipes_struct *p) @@ -87,67 +89,69 @@ static bool api_lsa_Delete(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_Delete *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_DELETE]; - + r = talloc(NULL, struct lsa_Delete); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_Delete, r); - + } + r->out.result = _lsa_Delete(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_Delete, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_EnumPrivs(pipes_struct *p) @@ -158,75 +162,77 @@ static bool api_lsa_EnumPrivs(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_EnumPrivs *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMPRIVS]; - + r = talloc(NULL, struct lsa_EnumPrivs); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumPrivs, r); - + } + ZERO_STRUCT(r->out); r->out.resume_handle = r->in.resume_handle; r->out.privs = talloc_zero(r, struct lsa_PrivArray); if (r->out.privs == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_EnumPrivs(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumPrivs, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_QuerySecurity(pipes_struct *p) @@ -237,74 +243,76 @@ static bool api_lsa_QuerySecurity(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_QuerySecurity *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYSECURITY]; - + r = talloc(NULL, struct lsa_QuerySecurity); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QuerySecurity, r); - + } + ZERO_STRUCT(r->out); r->out.sdbuf = talloc_zero(r, struct sec_desc_buf); if (r->out.sdbuf == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_QuerySecurity(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QuerySecurity, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetSecObj(pipes_struct *p) @@ -315,67 +323,69 @@ static bool api_lsa_SetSecObj(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetSecObj *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETSECOBJ]; - + r = talloc(NULL, struct lsa_SetSecObj); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetSecObj, r); - + } + r->out.result = _lsa_SetSecObj(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetSecObj, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_ChangePassword(pipes_struct *p) @@ -386,67 +396,69 @@ static bool api_lsa_ChangePassword(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_ChangePassword *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CHANGEPASSWORD]; - + r = talloc(NULL, struct lsa_ChangePassword); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_ChangePassword, r); - + } + r->out.result = _lsa_ChangePassword(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_ChangePassword, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_OpenPolicy(pipes_struct *p) @@ -457,74 +469,76 @@ static bool api_lsa_OpenPolicy(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_OpenPolicy *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENPOLICY]; - + r = talloc(NULL, struct lsa_OpenPolicy); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenPolicy, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_OpenPolicy(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_QueryInfoPolicy(pipes_struct *p) @@ -535,74 +549,76 @@ static bool api_lsa_QueryInfoPolicy(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_QueryInfoPolicy *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYINFOPOLICY]; - + r = talloc(NULL, struct lsa_QueryInfoPolicy); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union lsa_PolicyInformation); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_QueryInfoPolicy(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetInfoPolicy(pipes_struct *p) @@ -613,67 +629,69 @@ static bool api_lsa_SetInfoPolicy(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetInfoPolicy *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETINFOPOLICY]; - + r = talloc(NULL, struct lsa_SetInfoPolicy); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy, r); - + } + r->out.result = _lsa_SetInfoPolicy(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_ClearAuditLog(pipes_struct *p) @@ -684,67 +702,69 @@ static bool api_lsa_ClearAuditLog(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_ClearAuditLog *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CLEARAUDITLOG]; - + r = talloc(NULL, struct lsa_ClearAuditLog); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_ClearAuditLog, r); - + } + r->out.result = _lsa_ClearAuditLog(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_ClearAuditLog, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CreateAccount(pipes_struct *p) @@ -755,74 +775,76 @@ static bool api_lsa_CreateAccount(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CreateAccount *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATEACCOUNT]; - + r = talloc(NULL, struct lsa_CreateAccount); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateAccount, r); - + } + ZERO_STRUCT(r->out); r->out.acct_handle = talloc_zero(r, struct policy_handle); if (r->out.acct_handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_CreateAccount(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateAccount, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_EnumAccounts(pipes_struct *p) @@ -833,75 +855,77 @@ static bool api_lsa_EnumAccounts(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_EnumAccounts *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMACCOUNTS]; - + r = talloc(NULL, struct lsa_EnumAccounts); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumAccounts, r); - + } + ZERO_STRUCT(r->out); r->out.resume_handle = r->in.resume_handle; r->out.sids = talloc_zero(r, struct lsa_SidArray); if (r->out.sids == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_EnumAccounts(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumAccounts, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CreateTrustedDomain(pipes_struct *p) @@ -912,74 +936,76 @@ static bool api_lsa_CreateTrustedDomain(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CreateTrustedDomain *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATETRUSTEDDOMAIN]; - + r = talloc(NULL, struct lsa_CreateTrustedDomain); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomain, r); - + } + ZERO_STRUCT(r->out); r->out.trustdom_handle = talloc_zero(r, struct policy_handle); if (r->out.trustdom_handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_CreateTrustedDomain(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomain, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_EnumTrustDom(pipes_struct *p) @@ -990,75 +1016,77 @@ static bool api_lsa_EnumTrustDom(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_EnumTrustDom *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMTRUSTDOM]; - + r = talloc(NULL, struct lsa_EnumTrustDom); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumTrustDom, r); - + } + ZERO_STRUCT(r->out); r->out.resume_handle = r->in.resume_handle; r->out.domains = talloc_zero(r, struct lsa_DomainList); if (r->out.domains == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_EnumTrustDom(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumTrustDom, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupNames(pipes_struct *p) @@ -1069,76 +1097,78 @@ static bool api_lsa_LookupNames(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupNames *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES]; - + r = talloc(NULL, struct lsa_LookupNames); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupNames, r); - + } + ZERO_STRUCT(r->out); r->out.domains = talloc_zero(r, struct lsa_RefDomainList); if (r->out.domains == NULL) { talloc_free(r); - return False; + return false; } - + r->out.sids = r->in.sids; r->out.count = r->in.count; r->out.result = _lsa_LookupNames(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupNames, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupSids(pipes_struct *p) @@ -1149,76 +1179,78 @@ static bool api_lsa_LookupSids(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupSids *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPSIDS]; - + r = talloc(NULL, struct lsa_LookupSids); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupSids, r); - - ZERO_STRUCT(r->out); + } + + ZERO_STRUCT(r->out); r->out.domains = talloc_zero(r, struct lsa_RefDomainList); if (r->out.domains == NULL) { talloc_free(r); - return False; + return false; } - + r->out.names = r->in.names; r->out.count = r->in.count; r->out.result = _lsa_LookupSids(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupSids, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CreateSecret(pipes_struct *p) @@ -1229,74 +1261,76 @@ static bool api_lsa_CreateSecret(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CreateSecret *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATESECRET]; - + r = talloc(NULL, struct lsa_CreateSecret); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateSecret, r); - + } + ZERO_STRUCT(r->out); r->out.sec_handle = talloc_zero(r, struct policy_handle); if (r->out.sec_handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_CreateSecret(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateSecret, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_OpenAccount(pipes_struct *p) @@ -1307,74 +1341,76 @@ static bool api_lsa_OpenAccount(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_OpenAccount *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENACCOUNT]; - + r = talloc(NULL, struct lsa_OpenAccount); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenAccount, r); - + } + ZERO_STRUCT(r->out); r->out.acct_handle = talloc_zero(r, struct policy_handle); if (r->out.acct_handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_OpenAccount(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenAccount, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_EnumPrivsAccount(pipes_struct *p) @@ -1385,74 +1421,76 @@ static bool api_lsa_EnumPrivsAccount(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_EnumPrivsAccount *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMPRIVSACCOUNT]; - + r = talloc(NULL, struct lsa_EnumPrivsAccount); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumPrivsAccount, r); - + } + ZERO_STRUCT(r->out); r->out.privs = talloc_zero(r, struct lsa_PrivilegeSet); if (r->out.privs == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_EnumPrivsAccount(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumPrivsAccount, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_AddPrivilegesToAccount(pipes_struct *p) @@ -1463,67 +1501,69 @@ static bool api_lsa_AddPrivilegesToAccount(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_AddPrivilegesToAccount *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_ADDPRIVILEGESTOACCOUNT]; - + r = talloc(NULL, struct lsa_AddPrivilegesToAccount); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_AddPrivilegesToAccount, r); - + } + r->out.result = _lsa_AddPrivilegesToAccount(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_AddPrivilegesToAccount, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_RemovePrivilegesFromAccount(pipes_struct *p) @@ -1534,67 +1574,69 @@ static bool api_lsa_RemovePrivilegesFromAccount(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_RemovePrivilegesFromAccount *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_REMOVEPRIVILEGESFROMACCOUNT]; - + r = talloc(NULL, struct lsa_RemovePrivilegesFromAccount); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_RemovePrivilegesFromAccount, r); - + } + r->out.result = _lsa_RemovePrivilegesFromAccount(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_RemovePrivilegesFromAccount, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_GetQuotasForAccount(pipes_struct *p) @@ -1605,67 +1647,69 @@ static bool api_lsa_GetQuotasForAccount(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_GetQuotasForAccount *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_GETQUOTASFORACCOUNT]; - + r = talloc(NULL, struct lsa_GetQuotasForAccount); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_GetQuotasForAccount, r); - + } + r->out.result = _lsa_GetQuotasForAccount(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_GetQuotasForAccount, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetQuotasForAccount(pipes_struct *p) @@ -1676,67 +1720,69 @@ static bool api_lsa_SetQuotasForAccount(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetQuotasForAccount *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETQUOTASFORACCOUNT]; - + r = talloc(NULL, struct lsa_SetQuotasForAccount); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetQuotasForAccount, r); - + } + r->out.result = _lsa_SetQuotasForAccount(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetQuotasForAccount, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_GetSystemAccessAccount(pipes_struct *p) @@ -1747,67 +1793,69 @@ static bool api_lsa_GetSystemAccessAccount(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_GetSystemAccessAccount *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_GETSYSTEMACCESSACCOUNT]; - + r = talloc(NULL, struct lsa_GetSystemAccessAccount); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_GetSystemAccessAccount, r); - + } + r->out.result = _lsa_GetSystemAccessAccount(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_GetSystemAccessAccount, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetSystemAccessAccount(pipes_struct *p) @@ -1818,67 +1866,69 @@ static bool api_lsa_SetSystemAccessAccount(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetSystemAccessAccount *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETSYSTEMACCESSACCOUNT]; - + r = talloc(NULL, struct lsa_SetSystemAccessAccount); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetSystemAccessAccount, r); - + } + r->out.result = _lsa_SetSystemAccessAccount(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetSystemAccessAccount, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_OpenTrustedDomain(pipes_struct *p) @@ -1889,74 +1939,76 @@ static bool api_lsa_OpenTrustedDomain(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_OpenTrustedDomain *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENTRUSTEDDOMAIN]; - + r = talloc(NULL, struct lsa_OpenTrustedDomain); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomain, r); - + } + ZERO_STRUCT(r->out); r->out.trustdom_handle = talloc_zero(r, struct policy_handle); if (r->out.trustdom_handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_OpenTrustedDomain(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomain, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_QueryTrustedDomainInfo(pipes_struct *p) @@ -1967,74 +2019,76 @@ static bool api_lsa_QueryTrustedDomainInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_QueryTrustedDomainInfo *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYTRUSTEDDOMAININFO]; - + r = talloc(NULL, struct lsa_QueryTrustedDomainInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfo, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union lsa_TrustedDomainInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_QueryTrustedDomainInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetInformationTrustedDomain(pipes_struct *p) @@ -2045,67 +2099,69 @@ static bool api_lsa_SetInformationTrustedDomain(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetInformationTrustedDomain *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETINFORMATIONTRUSTEDDOMAIN]; - + r = talloc(NULL, struct lsa_SetInformationTrustedDomain); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetInformationTrustedDomain, r); - + } + r->out.result = _lsa_SetInformationTrustedDomain(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetInformationTrustedDomain, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_OpenSecret(pipes_struct *p) @@ -2116,74 +2172,76 @@ static bool api_lsa_OpenSecret(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_OpenSecret *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENSECRET]; - + r = talloc(NULL, struct lsa_OpenSecret); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenSecret, r); - + } + ZERO_STRUCT(r->out); r->out.sec_handle = talloc_zero(r, struct policy_handle); if (r->out.sec_handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_OpenSecret(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenSecret, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetSecret(pipes_struct *p) @@ -2194,67 +2252,69 @@ static bool api_lsa_SetSecret(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetSecret *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETSECRET]; - + r = talloc(NULL, struct lsa_SetSecret); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetSecret, r); - + } + r->out.result = _lsa_SetSecret(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetSecret, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_QuerySecret(pipes_struct *p) @@ -2265,72 +2325,74 @@ static bool api_lsa_QuerySecret(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_QuerySecret *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYSECRET]; - + r = talloc(NULL, struct lsa_QuerySecret); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QuerySecret, r); - + } + ZERO_STRUCT(r->out); r->out.new_val = r->in.new_val; r->out.new_mtime = r->in.new_mtime; r->out.old_val = r->in.old_val; r->out.old_mtime = r->in.old_mtime; r->out.result = _lsa_QuerySecret(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QuerySecret, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupPrivValue(pipes_struct *p) @@ -2341,74 +2403,76 @@ static bool api_lsa_LookupPrivValue(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupPrivValue *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPPRIVVALUE]; - + r = talloc(NULL, struct lsa_LookupPrivValue); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupPrivValue, r); - + } + ZERO_STRUCT(r->out); r->out.luid = talloc_zero(r, struct lsa_LUID); if (r->out.luid == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_LookupPrivValue(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupPrivValue, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupPrivName(pipes_struct *p) @@ -2419,74 +2483,76 @@ static bool api_lsa_LookupPrivName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupPrivName *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPPRIVNAME]; - + r = talloc(NULL, struct lsa_LookupPrivName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupPrivName, r); - + } + ZERO_STRUCT(r->out); r->out.name = talloc_zero(r, struct lsa_StringLarge); if (r->out.name == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_LookupPrivName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupPrivName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupPrivDisplayName(pipes_struct *p) @@ -2497,75 +2563,77 @@ static bool api_lsa_LookupPrivDisplayName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupPrivDisplayName *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPPRIVDISPLAYNAME]; - + r = talloc(NULL, struct lsa_LookupPrivDisplayName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupPrivDisplayName, r); - + } + ZERO_STRUCT(r->out); r->out.disp_name = talloc_zero(r, struct lsa_StringLarge); if (r->out.disp_name == NULL) { talloc_free(r); - return False; + return false; } - + r->out.language_id = r->in.language_id; r->out.result = _lsa_LookupPrivDisplayName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupPrivDisplayName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_DeleteObject(pipes_struct *p) @@ -2576,67 +2644,69 @@ static bool api_lsa_DeleteObject(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_DeleteObject *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_DELETEOBJECT]; - + r = talloc(NULL, struct lsa_DeleteObject); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_DeleteObject, r); - + } + r->out.result = _lsa_DeleteObject(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_DeleteObject, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_EnumAccountsWithUserRight(pipes_struct *p) @@ -2647,74 +2717,76 @@ static bool api_lsa_EnumAccountsWithUserRight(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_EnumAccountsWithUserRight *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMACCOUNTSWITHUSERRIGHT]; - + r = talloc(NULL, struct lsa_EnumAccountsWithUserRight); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumAccountsWithUserRight, r); - + } + ZERO_STRUCT(r->out); r->out.sids = talloc_zero(r, struct lsa_SidArray); if (r->out.sids == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_EnumAccountsWithUserRight(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumAccountsWithUserRight, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_EnumAccountRights(pipes_struct *p) @@ -2725,74 +2797,76 @@ static bool api_lsa_EnumAccountRights(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_EnumAccountRights *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMACCOUNTRIGHTS]; - + r = talloc(NULL, struct lsa_EnumAccountRights); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumAccountRights, r); - + } + ZERO_STRUCT(r->out); r->out.rights = talloc_zero(r, struct lsa_RightSet); if (r->out.rights == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_EnumAccountRights(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumAccountRights, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_AddAccountRights(pipes_struct *p) @@ -2803,67 +2877,69 @@ static bool api_lsa_AddAccountRights(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_AddAccountRights *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_ADDACCOUNTRIGHTS]; - + r = talloc(NULL, struct lsa_AddAccountRights); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_AddAccountRights, r); - + } + r->out.result = _lsa_AddAccountRights(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_AddAccountRights, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_RemoveAccountRights(pipes_struct *p) @@ -2874,67 +2950,69 @@ static bool api_lsa_RemoveAccountRights(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_RemoveAccountRights *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_REMOVEACCOUNTRIGHTS]; - + r = talloc(NULL, struct lsa_RemoveAccountRights); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_RemoveAccountRights, r); - + } + r->out.result = _lsa_RemoveAccountRights(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_RemoveAccountRights, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_QueryTrustedDomainInfoBySid(pipes_struct *p) @@ -2945,74 +3023,76 @@ static bool api_lsa_QueryTrustedDomainInfoBySid(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_QueryTrustedDomainInfoBySid *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYTRUSTEDDOMAININFOBYSID]; - + r = talloc(NULL, struct lsa_QueryTrustedDomainInfoBySid); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoBySid, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union lsa_TrustedDomainInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_QueryTrustedDomainInfoBySid(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoBySid, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetTrustedDomainInfo(pipes_struct *p) @@ -3023,67 +3103,69 @@ static bool api_lsa_SetTrustedDomainInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetTrustedDomainInfo *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETTRUSTEDDOMAININFO]; - + r = talloc(NULL, struct lsa_SetTrustedDomainInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfo, r); - + } + r->out.result = _lsa_SetTrustedDomainInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_DeleteTrustedDomain(pipes_struct *p) @@ -3094,67 +3176,69 @@ static bool api_lsa_DeleteTrustedDomain(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_DeleteTrustedDomain *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_DELETETRUSTEDDOMAIN]; - + r = talloc(NULL, struct lsa_DeleteTrustedDomain); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_DeleteTrustedDomain, r); - + } + r->out.result = _lsa_DeleteTrustedDomain(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_DeleteTrustedDomain, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_StorePrivateData(pipes_struct *p) @@ -3165,67 +3249,69 @@ static bool api_lsa_StorePrivateData(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_StorePrivateData *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_STOREPRIVATEDATA]; - + r = talloc(NULL, struct lsa_StorePrivateData); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_StorePrivateData, r); - + } + r->out.result = _lsa_StorePrivateData(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_StorePrivateData, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_RetrievePrivateData(pipes_struct *p) @@ -3236,67 +3322,69 @@ static bool api_lsa_RetrievePrivateData(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_RetrievePrivateData *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_RETRIEVEPRIVATEDATA]; - + r = talloc(NULL, struct lsa_RetrievePrivateData); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_RetrievePrivateData, r); - + } + r->out.result = _lsa_RetrievePrivateData(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_RetrievePrivateData, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_OpenPolicy2(pipes_struct *p) @@ -3307,74 +3395,76 @@ static bool api_lsa_OpenPolicy2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_OpenPolicy2 *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENPOLICY2]; - + r = talloc(NULL, struct lsa_OpenPolicy2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenPolicy2, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_OpenPolicy2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_GetUserName(pipes_struct *p) @@ -3385,70 +3475,72 @@ static bool api_lsa_GetUserName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_GetUserName *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_GETUSERNAME]; - + r = talloc(NULL, struct lsa_GetUserName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_GetUserName, r); - + } + ZERO_STRUCT(r->out); r->out.account_name = r->in.account_name; r->out.authority_name = r->in.authority_name; r->out.result = _lsa_GetUserName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_GetUserName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_QueryInfoPolicy2(pipes_struct *p) @@ -3459,74 +3551,76 @@ static bool api_lsa_QueryInfoPolicy2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_QueryInfoPolicy2 *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYINFOPOLICY2]; - + r = talloc(NULL, struct lsa_QueryInfoPolicy2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryInfoPolicy2, r); - - ZERO_STRUCT(r->out); + } + + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union lsa_PolicyInformation); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_QueryInfoPolicy2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetInfoPolicy2(pipes_struct *p) @@ -3537,67 +3631,69 @@ static bool api_lsa_SetInfoPolicy2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetInfoPolicy2 *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETINFOPOLICY2]; - + r = talloc(NULL, struct lsa_SetInfoPolicy2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy2, r); - + } + r->out.result = _lsa_SetInfoPolicy2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_QueryTrustedDomainInfoByName(pipes_struct *p) @@ -3608,74 +3704,76 @@ static bool api_lsa_QueryTrustedDomainInfoByName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_QueryTrustedDomainInfoByName *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYTRUSTEDDOMAININFOBYNAME]; - + r = talloc(NULL, struct lsa_QueryTrustedDomainInfoByName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryTrustedDomainInfoByName, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union lsa_TrustedDomainInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_QueryTrustedDomainInfoByName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoByName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetTrustedDomainInfoByName(pipes_struct *p) @@ -3686,67 +3784,69 @@ static bool api_lsa_SetTrustedDomainInfoByName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetTrustedDomainInfoByName *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETTRUSTEDDOMAININFOBYNAME]; - + r = talloc(NULL, struct lsa_SetTrustedDomainInfoByName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfoByName, r); - + } + r->out.result = _lsa_SetTrustedDomainInfoByName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfoByName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_EnumTrustedDomainsEx(pipes_struct *p) @@ -3757,75 +3857,77 @@ static bool api_lsa_EnumTrustedDomainsEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_EnumTrustedDomainsEx *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_ENUMTRUSTEDDOMAINSEX]; - + r = talloc(NULL, struct lsa_EnumTrustedDomainsEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_EnumTrustedDomainsEx, r); - + } + ZERO_STRUCT(r->out); r->out.resume_handle = r->in.resume_handle; r->out.domains = talloc_zero(r, struct lsa_DomainListEx); if (r->out.domains == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_EnumTrustedDomainsEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_EnumTrustedDomainsEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CreateTrustedDomainEx(pipes_struct *p) @@ -3836,67 +3938,69 @@ static bool api_lsa_CreateTrustedDomainEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CreateTrustedDomainEx *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATETRUSTEDDOMAINEX]; - + r = talloc(NULL, struct lsa_CreateTrustedDomainEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, r); - + } + r->out.result = _lsa_CreateTrustedDomainEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CloseTrustedDomainEx(pipes_struct *p) @@ -3907,69 +4011,71 @@ static bool api_lsa_CloseTrustedDomainEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CloseTrustedDomainEx *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CLOSETRUSTEDDOMAINEX]; - + r = talloc(NULL, struct lsa_CloseTrustedDomainEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CloseTrustedDomainEx, r); - + } + ZERO_STRUCT(r->out); r->out.handle = r->in.handle; r->out.result = _lsa_CloseTrustedDomainEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CloseTrustedDomainEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_QueryDomainInformationPolicy(pipes_struct *p) @@ -3980,74 +4086,76 @@ static bool api_lsa_QueryDomainInformationPolicy(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_QueryDomainInformationPolicy *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_QUERYDOMAININFORMATIONPOLICY]; - + r = talloc(NULL, struct lsa_QueryDomainInformationPolicy); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_QueryDomainInformationPolicy, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union lsa_DomainInformationPolicy); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_QueryDomainInformationPolicy(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_QueryDomainInformationPolicy, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_SetDomainInformationPolicy(pipes_struct *p) @@ -4058,67 +4166,69 @@ static bool api_lsa_SetDomainInformationPolicy(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_SetDomainInformationPolicy *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_SETDOMAININFORMATIONPOLICY]; - + r = talloc(NULL, struct lsa_SetDomainInformationPolicy); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetDomainInformationPolicy, r); - + } + r->out.result = _lsa_SetDomainInformationPolicy(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_SetDomainInformationPolicy, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_OpenTrustedDomainByName(pipes_struct *p) @@ -4129,74 +4239,76 @@ static bool api_lsa_OpenTrustedDomainByName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_OpenTrustedDomainByName *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_OPENTRUSTEDDOMAINBYNAME]; - + r = talloc(NULL, struct lsa_OpenTrustedDomainByName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_OpenTrustedDomainByName, r); - + } + ZERO_STRUCT(r->out); r->out.trustdom_handle = talloc_zero(r, struct policy_handle); if (r->out.trustdom_handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _lsa_OpenTrustedDomainByName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomainByName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_TestCall(pipes_struct *p) @@ -4207,67 +4319,69 @@ static bool api_lsa_TestCall(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_TestCall *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_TESTCALL]; - + r = talloc(NULL, struct lsa_TestCall); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_TestCall, r); - + } + r->out.result = _lsa_TestCall(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_TestCall, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupSids2(pipes_struct *p) @@ -4278,76 +4392,78 @@ static bool api_lsa_LookupSids2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupSids2 *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPSIDS2]; - + r = talloc(NULL, struct lsa_LookupSids2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupSids2, r); - + } + ZERO_STRUCT(r->out); r->out.domains = talloc_zero(r, struct lsa_RefDomainList); if (r->out.domains == NULL) { talloc_free(r); - return False; + return false; } - + r->out.names = r->in.names; r->out.count = r->in.count; r->out.result = _lsa_LookupSids2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupSids2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupNames2(pipes_struct *p) @@ -4358,76 +4474,78 @@ static bool api_lsa_LookupNames2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupNames2 *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES2]; - + r = talloc(NULL, struct lsa_LookupNames2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupNames2, r); - + } + ZERO_STRUCT(r->out); r->out.domains = talloc_zero(r, struct lsa_RefDomainList); if (r->out.domains == NULL) { talloc_free(r); - return False; + return false; } - + r->out.sids = r->in.sids; r->out.count = r->in.count; r->out.result = _lsa_LookupNames2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupNames2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CreateTrustedDomainEx2(pipes_struct *p) @@ -4438,67 +4556,69 @@ static bool api_lsa_CreateTrustedDomainEx2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CreateTrustedDomainEx2 *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREATETRUSTEDDOMAINEX2]; - + r = talloc(NULL, struct lsa_CreateTrustedDomainEx2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, r); - + } + r->out.result = _lsa_CreateTrustedDomainEx2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRWRITE(pipes_struct *p) @@ -4509,67 +4629,69 @@ static bool api_lsa_CREDRWRITE(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRWRITE *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRWRITE]; - + r = talloc(NULL, struct lsa_CREDRWRITE); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRWRITE, r); - + } + r->out.result = _lsa_CREDRWRITE(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITE, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRREAD(pipes_struct *p) @@ -4580,67 +4702,69 @@ static bool api_lsa_CREDRREAD(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRREAD *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRREAD]; - + r = talloc(NULL, struct lsa_CREDRREAD); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRREAD, r); - + } + r->out.result = _lsa_CREDRREAD(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRREAD, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRENUMERATE(pipes_struct *p) @@ -4651,67 +4775,69 @@ static bool api_lsa_CREDRENUMERATE(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRENUMERATE *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRENUMERATE]; - + r = talloc(NULL, struct lsa_CREDRENUMERATE); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRENUMERATE, r); - + } + r->out.result = _lsa_CREDRENUMERATE(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRENUMERATE, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p) @@ -4722,67 +4848,69 @@ static bool api_lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRWRITEDOMAINCREDENTIALS *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRWRITEDOMAINCREDENTIALS]; - + r = talloc(NULL, struct lsa_CREDRWRITEDOMAINCREDENTIALS); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, r); - + } + r->out.result = _lsa_CREDRWRITEDOMAINCREDENTIALS(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p) @@ -4793,67 +4921,69 @@ static bool api_lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRREADDOMAINCREDENTIALS *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRREADDOMAINCREDENTIALS]; - + r = talloc(NULL, struct lsa_CREDRREADDOMAINCREDENTIALS); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, r); - + } + r->out.result = _lsa_CREDRREADDOMAINCREDENTIALS(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRDELETE(pipes_struct *p) @@ -4864,67 +4994,69 @@ static bool api_lsa_CREDRDELETE(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRDELETE *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRDELETE]; - + r = talloc(NULL, struct lsa_CREDRDELETE); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRDELETE, r); - + } + r->out.result = _lsa_CREDRDELETE(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRDELETE, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRGETTARGETINFO(pipes_struct *p) @@ -4935,67 +5067,69 @@ static bool api_lsa_CREDRGETTARGETINFO(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRGETTARGETINFO *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRGETTARGETINFO]; - + r = talloc(NULL, struct lsa_CREDRGETTARGETINFO); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRGETTARGETINFO, r); - + } + r->out.result = _lsa_CREDRGETTARGETINFO(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRGETTARGETINFO, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRPROFILELOADED(pipes_struct *p) @@ -5006,67 +5140,69 @@ static bool api_lsa_CREDRPROFILELOADED(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRPROFILELOADED *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRPROFILELOADED]; - + r = talloc(NULL, struct lsa_CREDRPROFILELOADED); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRPROFILELOADED, r); - + } + r->out.result = _lsa_CREDRPROFILELOADED(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRPROFILELOADED, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupNames3(pipes_struct *p) @@ -5077,76 +5213,78 @@ static bool api_lsa_LookupNames3(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupNames3 *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES3]; - + r = talloc(NULL, struct lsa_LookupNames3); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupNames3, r); - + } + ZERO_STRUCT(r->out); r->out.domains = talloc_zero(r, struct lsa_RefDomainList); if (r->out.domains == NULL) { talloc_free(r); - return False; + return false; } - + r->out.sids = r->in.sids; r->out.count = r->in.count; r->out.result = _lsa_LookupNames3(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupNames3, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRGETSESSIONTYPES(pipes_struct *p) @@ -5157,67 +5295,69 @@ static bool api_lsa_CREDRGETSESSIONTYPES(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRGETSESSIONTYPES *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRGETSESSIONTYPES]; - + r = talloc(NULL, struct lsa_CREDRGETSESSIONTYPES); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRGETSESSIONTYPES, r); - + } + r->out.result = _lsa_CREDRGETSESSIONTYPES(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRGETSESSIONTYPES, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LSARREGISTERAUDITEVENT(pipes_struct *p) @@ -5228,67 +5368,69 @@ static bool api_lsa_LSARREGISTERAUDITEVENT(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LSARREGISTERAUDITEVENT *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARREGISTERAUDITEVENT]; - + r = talloc(NULL, struct lsa_LSARREGISTERAUDITEVENT); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARREGISTERAUDITEVENT, r); - + } + r->out.result = _lsa_LSARREGISTERAUDITEVENT(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARREGISTERAUDITEVENT, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LSARGENAUDITEVENT(pipes_struct *p) @@ -5299,67 +5441,69 @@ static bool api_lsa_LSARGENAUDITEVENT(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LSARGENAUDITEVENT *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARGENAUDITEVENT]; - + r = talloc(NULL, struct lsa_LSARGENAUDITEVENT); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARGENAUDITEVENT, r); - + } + r->out.result = _lsa_LSARGENAUDITEVENT(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARGENAUDITEVENT, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p) @@ -5370,67 +5514,69 @@ static bool api_lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LSARUNREGISTERAUDITEVENT *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARUNREGISTERAUDITEVENT]; - + r = talloc(NULL, struct lsa_LSARUNREGISTERAUDITEVENT); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, r); - + } + r->out.result = _lsa_LSARUNREGISTERAUDITEVENT(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p) @@ -5441,67 +5587,69 @@ static bool api_lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION]; - + r = talloc(NULL, struct lsa_LSARQUERYFORESTTRUSTINFORMATION); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, r); - + } + r->out.result = _lsa_LSARQUERYFORESTTRUSTINFORMATION(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p) @@ -5512,67 +5660,69 @@ static bool api_lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LSARSETFORESTTRUSTINFORMATION *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARSETFORESTTRUSTINFORMATION]; - + r = talloc(NULL, struct lsa_LSARSETFORESTTRUSTINFORMATION); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, r); - + } + r->out.result = _lsa_LSARSETFORESTTRUSTINFORMATION(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_CREDRRENAME(pipes_struct *p) @@ -5583,67 +5733,69 @@ static bool api_lsa_CREDRRENAME(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_CREDRRENAME *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_CREDRRENAME]; - + r = talloc(NULL, struct lsa_CREDRRENAME); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_CREDRRENAME, r); - + } + r->out.result = _lsa_CREDRRENAME(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_CREDRRENAME, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupSids3(pipes_struct *p) @@ -5654,76 +5806,78 @@ static bool api_lsa_LookupSids3(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupSids3 *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPSIDS3]; - + r = talloc(NULL, struct lsa_LookupSids3); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupSids3, r); - + } + ZERO_STRUCT(r->out); r->out.domains = talloc_zero(r, struct lsa_RefDomainList); if (r->out.domains == NULL) { talloc_free(r); - return False; + return false; } - + r->out.names = r->in.names; r->out.count = r->in.count; r->out.result = _lsa_LookupSids3(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupSids3, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LookupNames4(pipes_struct *p) @@ -5734,76 +5888,78 @@ static bool api_lsa_LookupNames4(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LookupNames4 *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LOOKUPNAMES4]; - + r = talloc(NULL, struct lsa_LookupNames4); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LookupNames4, r); - + } + ZERO_STRUCT(r->out); r->out.domains = talloc_zero(r, struct lsa_RefDomainList); if (r->out.domains == NULL) { talloc_free(r); - return False; + return false; } - + r->out.sids = r->in.sids; r->out.count = r->in.count; r->out.result = _lsa_LookupNames4(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LookupNames4, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LSAROPENPOLICYSCE(pipes_struct *p) @@ -5814,67 +5970,69 @@ static bool api_lsa_LSAROPENPOLICYSCE(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LSAROPENPOLICYSCE *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LSAROPENPOLICYSCE]; - + r = talloc(NULL, struct lsa_LSAROPENPOLICYSCE); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSAROPENPOLICYSCE, r); - + } + r->out.result = _lsa_LSAROPENPOLICYSCE(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSAROPENPOLICYSCE, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p) @@ -5885,67 +6043,69 @@ static bool api_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARADTREGISTERSECURITYEVENTSOURCE]; - + r = talloc(NULL, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, r); - + } + r->out.result = _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p) @@ -5956,67 +6116,69 @@ static bool api_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARADTUNREGISTERSECURITYEVENTSOURCE]; - + r = talloc(NULL, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, r); - + } + r->out.result = _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p) @@ -6027,67 +6189,69 @@ static bool api_lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct lsa_LSARADTREPORTSECURITYEVENT *r; - + call = &ndr_table_lsarpc.calls[NDR_LSA_LSARADTREPORTSECURITYEVENT]; - + r = talloc(NULL, struct lsa_LSARADTREPORTSECURITYEVENT); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, r); - + } + r->out.result = _lsa_LSARADTREPORTSECURITYEVENT(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c index 899e1bf6b0..163de46ca8 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.c +++ b/source3/librpc/gen_ndr/srv_netlogon.c @@ -14,74 +14,76 @@ static bool api_netr_LogonUasLogon(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonUasLogon *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONUASLOGON]; - + r = talloc(NULL, struct netr_LogonUasLogon); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonUasLogon, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, struct netr_UasInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_LogonUasLogon(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_LogonUasLogoff(pipes_struct *p) @@ -92,74 +94,76 @@ static bool api_netr_LogonUasLogoff(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonUasLogoff *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONUASLOGOFF]; - + r = talloc(NULL, struct netr_LogonUasLogoff); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonUasLogoff, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, struct netr_UasLogoffInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_LogonUasLogoff(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_LogonSamLogon(pipes_struct *p) @@ -170,81 +174,83 @@ static bool api_netr_LogonSamLogon(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonSamLogon *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGON]; - + r = talloc(NULL, struct netr_LogonSamLogon); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonSamLogon, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.validation = talloc_zero(r, union netr_Validation); if (r->out.validation == NULL) { talloc_free(r); - return False; + return false; } - + r->out.authoritative = talloc_zero(r, uint8_t); if (r->out.authoritative == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_LogonSamLogon(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_LogonSamLogoff(pipes_struct *p) @@ -255,69 +261,71 @@ static bool api_netr_LogonSamLogoff(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonSamLogoff *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGOFF]; - + r = talloc(NULL, struct netr_LogonSamLogoff); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonSamLogoff, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.result = _netr_LogonSamLogoff(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_ServerReqChallenge(pipes_struct *p) @@ -328,69 +336,71 @@ static bool api_netr_ServerReqChallenge(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_ServerReqChallenge *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERREQCHALLENGE]; - + r = talloc(NULL, struct netr_ServerReqChallenge); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerReqChallenge, r); - + } + ZERO_STRUCT(r->out); r->out.credentials = r->in.credentials; r->out.result = _netr_ServerReqChallenge(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerReqChallenge, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_ServerAuthenticate(pipes_struct *p) @@ -401,69 +411,71 @@ static bool api_netr_ServerAuthenticate(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_ServerAuthenticate *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE]; - + r = talloc(NULL, struct netr_ServerAuthenticate); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate, r); - + } + ZERO_STRUCT(r->out); r->out.credentials = r->in.credentials; r->out.result = _netr_ServerAuthenticate(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_ServerPasswordSet(pipes_struct *p) @@ -474,74 +486,76 @@ static bool api_netr_ServerPasswordSet(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_ServerPasswordSet *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDSET]; - + r = talloc(NULL, struct netr_ServerPasswordSet); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator); if (r->out.return_authenticator == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_ServerPasswordSet(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DatabaseDeltas(pipes_struct *p) @@ -552,76 +566,78 @@ static bool api_netr_DatabaseDeltas(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DatabaseDeltas *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DATABASEDELTAS]; - + r = talloc(NULL, struct netr_DatabaseDeltas); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DatabaseDeltas, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.sequence_num = r->in.sequence_num; r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY); if (r->out.delta_enum_array == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_DatabaseDeltas(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DatabaseSync(pipes_struct *p) @@ -632,76 +648,78 @@ static bool api_netr_DatabaseSync(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DatabaseSync *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DATABASESYNC]; - + r = talloc(NULL, struct netr_DatabaseSync); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DatabaseSync, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.sync_context = r->in.sync_context; r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY); if (r->out.delta_enum_array == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_DatabaseSync(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_AccountDeltas(pipes_struct *p) @@ -712,93 +730,95 @@ static bool api_netr_AccountDeltas(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_AccountDeltas *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_ACCOUNTDELTAS]; - + r = talloc(NULL, struct netr_AccountDeltas); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_AccountDeltas, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.buffer = talloc_zero(r, struct netr_AccountBuffer); if (r->out.buffer == NULL) { talloc_free(r); - return False; + return false; } - + r->out.count_returned = talloc_zero(r, uint32_t); if (r->out.count_returned == NULL) { talloc_free(r); - return False; + return false; } - + r->out.total_entries = talloc_zero(r, uint32_t); if (r->out.total_entries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.recordid = talloc_zero(r, struct netr_UAS_INFO_0); if (r->out.recordid == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_AccountDeltas(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_AccountSync(pipes_struct *p) @@ -809,94 +829,96 @@ static bool api_netr_AccountSync(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_AccountSync *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_ACCOUNTSYNC]; - + r = talloc(NULL, struct netr_AccountSync); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_AccountSync, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.buffer = talloc_zero(r, struct netr_AccountBuffer); if (r->out.buffer == NULL) { talloc_free(r); - return False; + return false; } - + r->out.count_returned = talloc_zero(r, uint32_t); if (r->out.count_returned == NULL) { talloc_free(r); - return False; + return false; } - + r->out.total_entries = talloc_zero(r, uint32_t); if (r->out.total_entries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.next_reference = talloc_zero(r, uint32_t); if (r->out.next_reference == NULL) { talloc_free(r); - return False; + return false; } - + r->out.recordid = r->in.recordid; r->out.result = _netr_AccountSync(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_AccountSync, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_GetDcName(pipes_struct *p) @@ -907,74 +929,76 @@ static bool api_netr_GetDcName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_GetDcName *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_GETDCNAME]; - + r = talloc(NULL, struct netr_GetDcName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_GetDcName, r); - + } + ZERO_STRUCT(r->out); r->out.dcname = talloc_zero(r, const char *); if (r->out.dcname == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_GetDcName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_GetDcName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_LogonControl(pipes_struct *p) @@ -985,74 +1009,76 @@ static bool api_netr_LogonControl(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonControl *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL]; - + r = talloc(NULL, struct netr_LogonControl); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonControl, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_LogonControl(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonControl, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_GetAnyDCName(pipes_struct *p) @@ -1063,74 +1089,76 @@ static bool api_netr_GetAnyDCName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_GetAnyDCName *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_GETANYDCNAME]; - + r = talloc(NULL, struct netr_GetAnyDCName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_GetAnyDCName, r); - + } + ZERO_STRUCT(r->out); r->out.dcname = talloc_zero(r, const char *); if (r->out.dcname == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_GetAnyDCName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_LogonControl2(pipes_struct *p) @@ -1141,74 +1169,76 @@ static bool api_netr_LogonControl2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonControl2 *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL2]; - + r = talloc(NULL, struct netr_LogonControl2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonControl2, r); - + } + ZERO_STRUCT(r->out); r->out.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION); if (r->out.query == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_LogonControl2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonControl2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_ServerAuthenticate2(pipes_struct *p) @@ -1219,70 +1249,72 @@ static bool api_netr_ServerAuthenticate2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_ServerAuthenticate2 *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE2]; - + r = talloc(NULL, struct netr_ServerAuthenticate2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate2, r); - + } + ZERO_STRUCT(r->out); r->out.credentials = r->in.credentials; r->out.negotiate_flags = r->in.negotiate_flags; r->out.result = _netr_ServerAuthenticate2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DatabaseSync2(pipes_struct *p) @@ -1293,76 +1325,78 @@ static bool api_netr_DatabaseSync2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DatabaseSync2 *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DATABASESYNC2]; - + r = talloc(NULL, struct netr_DatabaseSync2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DatabaseSync2, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.sync_context = r->in.sync_context; r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY); if (r->out.delta_enum_array == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_DatabaseSync2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DatabaseRedo(pipes_struct *p) @@ -1373,75 +1407,77 @@ static bool api_netr_DatabaseRedo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DatabaseRedo *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DATABASEREDO]; - + r = talloc(NULL, struct netr_DatabaseRedo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DatabaseRedo, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.delta_enum_array = talloc_zero(r, struct netr_DELTA_ENUM_ARRAY); if (r->out.delta_enum_array == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_DatabaseRedo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_LogonControl2Ex(pipes_struct *p) @@ -1452,74 +1488,76 @@ static bool api_netr_LogonControl2Ex(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonControl2Ex *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONCONTROL2EX]; - + r = talloc(NULL, struct netr_LogonControl2Ex); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonControl2Ex, r); - + } + ZERO_STRUCT(r->out); r->out.query = talloc_zero(r, union netr_CONTROL_QUERY_INFORMATION); if (r->out.query == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_LogonControl2Ex(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRENUMERATETRUSTEDDOMAINS(pipes_struct *p) @@ -1530,67 +1568,69 @@ static bool api_netr_NETRENUMERATETRUSTEDDOMAINS(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRENUMERATETRUSTEDDOMAINS *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINS]; - + r = talloc(NULL, struct netr_NETRENUMERATETRUSTEDDOMAINS); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, r); - + } + r->out.result = _netr_NETRENUMERATETRUSTEDDOMAINS(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DsRGetDCName(pipes_struct *p) @@ -1601,74 +1641,76 @@ static bool api_netr_DsRGetDCName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DsRGetDCName *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAME]; - + r = talloc(NULL, struct netr_DsRGetDCName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsRGetDCName, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_DsRGetDCName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p) @@ -1679,67 +1721,69 @@ static bool api_netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRLOGONDUMMYROUTINE1 *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONDUMMYROUTINE1]; - + r = talloc(NULL, struct netr_NETRLOGONDUMMYROUTINE1); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONDUMMYROUTINE1, r); - + } + r->out.result = _netr_NETRLOGONDUMMYROUTINE1(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONDUMMYROUTINE1, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p) @@ -1750,67 +1794,69 @@ static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRLOGONSETSERVICEBITS *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSETSERVICEBITS]; - + r = talloc(NULL, struct netr_NETRLOGONSETSERVICEBITS); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONSETSERVICEBITS, r); - + } + r->out.result = _netr_NETRLOGONSETSERVICEBITS(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRLOGONGETTRUSTRID(pipes_struct *p) @@ -1821,67 +1867,69 @@ static bool api_netr_NETRLOGONGETTRUSTRID(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRLOGONGETTRUSTRID *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTRUSTRID]; - + r = talloc(NULL, struct netr_NETRLOGONGETTRUSTRID); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTRUSTRID, r); - + } + r->out.result = _netr_NETRLOGONGETTRUSTRID(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTRUSTRID, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p) @@ -1892,67 +1940,69 @@ static bool api_netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRLOGONCOMPUTESERVERDIGEST *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTESERVERDIGEST]; - + r = talloc(NULL, struct netr_NETRLOGONCOMPUTESERVERDIGEST); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r); - + } + r->out.result = _netr_NETRLOGONCOMPUTESERVERDIGEST(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p) @@ -1963,67 +2013,69 @@ static bool api_netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONCOMPUTECLIENTDIGEST]; - + r = talloc(NULL, struct netr_NETRLOGONCOMPUTECLIENTDIGEST); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r); - + } + r->out.result = _netr_NETRLOGONCOMPUTECLIENTDIGEST(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_ServerAuthenticate3(pipes_struct *p) @@ -2034,76 +2086,78 @@ static bool api_netr_ServerAuthenticate3(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_ServerAuthenticate3 *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERAUTHENTICATE3]; - + r = talloc(NULL, struct netr_ServerAuthenticate3); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerAuthenticate3, r); - + } + ZERO_STRUCT(r->out); r->out.credentials = r->in.credentials; r->out.negotiate_flags = r->in.negotiate_flags; r->out.rid = talloc_zero(r, uint32_t); if (r->out.rid == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_ServerAuthenticate3(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DsRGetDCNameEx(pipes_struct *p) @@ -2114,74 +2168,76 @@ static bool api_netr_DsRGetDCNameEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DsRGetDCNameEx *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX]; - + r = talloc(NULL, struct netr_DsRGetDCNameEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_DsRGetDCNameEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DsRGetSiteName(pipes_struct *p) @@ -2192,74 +2248,76 @@ static bool api_netr_DsRGetSiteName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DsRGetSiteName *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETSITENAME]; - + r = talloc(NULL, struct netr_DsRGetSiteName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsRGetSiteName, r); - + } + ZERO_STRUCT(r->out); r->out.site = talloc_zero(r, const char *); if (r->out.site == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_DsRGetSiteName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_LogonGetDomainInfo(pipes_struct *p) @@ -2270,75 +2328,77 @@ static bool api_netr_LogonGetDomainInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonGetDomainInfo *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONGETDOMAININFO]; - + r = talloc(NULL, struct netr_LogonGetDomainInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonGetDomainInfo, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.info = talloc_zero(r, union netr_DomainInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_LogonGetDomainInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_ServerPasswordSet2(pipes_struct *p) @@ -2349,74 +2409,76 @@ static bool api_netr_ServerPasswordSet2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_ServerPasswordSet2 *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDSET2]; - + r = talloc(NULL, struct netr_ServerPasswordSet2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_ServerPasswordSet2, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator); if (r->out.return_authenticator == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_ServerPasswordSet2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRSERVERPASSWORDGET(pipes_struct *p) @@ -2427,67 +2489,69 @@ static bool api_netr_NETRSERVERPASSWORDGET(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRSERVERPASSWORDGET *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERPASSWORDGET]; - + r = talloc(NULL, struct netr_NETRSERVERPASSWORDGET); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRSERVERPASSWORDGET, r); - + } + r->out.result = _netr_NETRSERVERPASSWORDGET(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRSERVERPASSWORDGET, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRLOGONSENDTOSAM(pipes_struct *p) @@ -2498,67 +2562,69 @@ static bool api_netr_NETRLOGONSENDTOSAM(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRLOGONSENDTOSAM *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONSENDTOSAM]; - + r = talloc(NULL, struct netr_NETRLOGONSENDTOSAM); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONSENDTOSAM, r); - + } + r->out.result = _netr_NETRLOGONSENDTOSAM(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DSRADDRESSTOSITENAMESW(pipes_struct *p) @@ -2569,67 +2635,69 @@ static bool api_netr_DSRADDRESSTOSITENAMESW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DSRADDRESSTOSITENAMESW *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESW]; - + r = talloc(NULL, struct netr_DSRADDRESSTOSITENAMESW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESW, r); - + } + r->out.result = _netr_DSRADDRESSTOSITENAMESW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DsRGetDCNameEx2(pipes_struct *p) @@ -2640,74 +2708,76 @@ static bool api_netr_DsRGetDCNameEx2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DsRGetDCNameEx2 *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCNAMEEX2]; - + r = talloc(NULL, struct netr_DsRGetDCNameEx2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsRGetDCNameEx2, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, struct netr_DsRGetDCNameInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_DsRGetDCNameEx2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p) @@ -2718,67 +2788,69 @@ static bool api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN]; - + r = talloc(NULL, struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r); - + } + r->out.result = _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p) @@ -2789,67 +2861,69 @@ static bool api_netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX]; - + r = talloc(NULL, struct netr_NETRENUMERATETRUSTEDDOMAINSEX); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, r); - + } + r->out.result = _netr_NETRENUMERATETRUSTEDDOMAINSEX(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p) @@ -2860,67 +2934,69 @@ static bool api_netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DSRADDRESSTOSITENAMESEXW *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESEXW]; - + r = talloc(NULL, struct netr_DSRADDRESSTOSITENAMESEXW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, r); - + } + r->out.result = _netr_DSRADDRESSTOSITENAMESEXW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DSRGETDCSITECOVERAGEW(pipes_struct *p) @@ -2931,67 +3007,69 @@ static bool api_netr_DSRGETDCSITECOVERAGEW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DSRGETDCSITECOVERAGEW *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCSITECOVERAGEW]; - + r = talloc(NULL, struct netr_DSRGETDCSITECOVERAGEW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRGETDCSITECOVERAGEW, r); - + } + r->out.result = _netr_DSRGETDCSITECOVERAGEW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRGETDCSITECOVERAGEW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_LogonSamLogonEx(pipes_struct *p) @@ -3002,81 +3080,83 @@ static bool api_netr_LogonSamLogonEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonSamLogonEx *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONEX]; - + r = talloc(NULL, struct netr_LogonSamLogonEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonSamLogonEx, r); - + } + ZERO_STRUCT(r->out); r->out.validation = talloc_zero(r, union netr_Validation); if (r->out.validation == NULL) { talloc_free(r); - return False; + return false; } - + r->out.authoritative = talloc_zero(r, uint8_t); if (r->out.authoritative == NULL) { talloc_free(r); - return False; + return false; } - + r->out.flags = r->in.flags; r->out.result = _netr_LogonSamLogonEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p) @@ -3087,80 +3167,82 @@ static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DsrEnumerateDomainTrusts *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRENUMERATEDOMAINTRUSTS]; - + r = talloc(NULL, struct netr_DsrEnumerateDomainTrusts); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DsrEnumerateDomainTrusts, r); - + } + ZERO_STRUCT(r->out); r->out.count = talloc_zero(r, uint32_t); if (r->out.count == NULL) { talloc_free(r); - return False; + return false; } - + r->out.trusts = talloc_zero_array(r, struct netr_DomainTrust *, r->out.count); if (r->out.trusts == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _netr_DsrEnumerateDomainTrusts(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p) @@ -3171,67 +3253,69 @@ static bool api_netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DSRDEREGISTERDNSHOSTRECORDS *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS]; - + r = talloc(NULL, struct netr_DSRDEREGISTERDNSHOSTRECORDS); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, r); - + } + r->out.result = _netr_DSRDEREGISTERDNSHOSTRECORDS(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRDEREGISTERDNSHOSTRECORDS, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p) @@ -3242,67 +3326,69 @@ static bool api_netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRSERVERTRUSTPASSWORDSGET *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERTRUSTPASSWORDSGET]; - + r = talloc(NULL, struct netr_NETRSERVERTRUSTPASSWORDSGET); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, r); - + } + r->out.result = _netr_NETRSERVERTRUSTPASSWORDSGET(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p) @@ -3313,67 +3399,69 @@ static bool api_netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_DSRGETFORESTTRUSTINFORMATION *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETFORESTTRUSTINFORMATION]; - + r = talloc(NULL, struct netr_DSRGETFORESTTRUSTINFORMATION); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, r); - + } + r->out.result = _netr_DSRGETFORESTTRUSTINFORMATION(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRGETFORESTTRUSTINFORMATION(pipes_struct *p) @@ -3384,67 +3472,69 @@ static bool api_netr_NETRGETFORESTTRUSTINFORMATION(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRGETFORESTTRUSTINFORMATION *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRGETFORESTTRUSTINFORMATION]; - + r = talloc(NULL, struct netr_NETRGETFORESTTRUSTINFORMATION); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, r); - + } + r->out.result = _netr_NETRGETFORESTTRUSTINFORMATION(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p) @@ -3455,82 +3545,84 @@ static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_LogonSamLogonWithFlags *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_LOGONSAMLOGONWITHFLAGS]; - + r = talloc(NULL, struct netr_LogonSamLogonWithFlags); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_LogonSamLogonWithFlags, r); - + } + ZERO_STRUCT(r->out); r->out.return_authenticator = r->in.return_authenticator; r->out.validation = talloc_zero(r, union netr_Validation); if (r->out.validation == NULL) { talloc_free(r); - return False; + return false; } - + r->out.authoritative = talloc_zero(r, uint8_t); if (r->out.authoritative == NULL) { talloc_free(r); - return False; + return false; } - + r->out.flags = r->in.flags; r->out.result = _netr_LogonSamLogonWithFlags(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_netr_NETRSERVERGETTRUSTINFO(pipes_struct *p) @@ -3541,67 +3633,69 @@ static bool api_netr_NETRSERVERGETTRUSTINFO(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct netr_NETRSERVERGETTRUSTINFO *r; - + call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERGETTRUSTINFO]; - + r = talloc(NULL, struct netr_NETRSERVERGETTRUSTINFO); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(netr_NETRSERVERGETTRUSTINFO, r); - + } + r->out.result = _netr_NETRSERVERGETTRUSTINFO(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(netr_NETRSERVERGETTRUSTINFO, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_srvsvc.c b/source3/librpc/gen_ndr/srv_srvsvc.c index 88a3f272c7..44fe358a84 100644 --- a/source3/librpc/gen_ndr/srv_srvsvc.c +++ b/source3/librpc/gen_ndr/srv_srvsvc.c @@ -14,77 +14,79 @@ static bool api_srvsvc_NetCharDevEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetCharDevEnum *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVENUM]; - + r = talloc(NULL, struct srvsvc_NetCharDevEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevEnum, r); - + } + ZERO_STRUCT(r->out); r->out.level = r->in.level; r->out.ctr = r->in.ctr; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetCharDevEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetCharDevGetInfo(pipes_struct *p) @@ -95,74 +97,76 @@ static bool api_srvsvc_NetCharDevGetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetCharDevGetInfo *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVGETINFO]; - + r = talloc(NULL, struct srvsvc_NetCharDevGetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevGetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union srvsvc_NetCharDevInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetCharDevGetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevGetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetCharDevControl(pipes_struct *p) @@ -173,67 +177,69 @@ static bool api_srvsvc_NetCharDevControl(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetCharDevControl *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVCONTROL]; - + r = talloc(NULL, struct srvsvc_NetCharDevControl); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevControl, r); - + } + r->out.result = _srvsvc_NetCharDevControl(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevControl, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetCharDevQEnum(pipes_struct *p) @@ -244,77 +250,79 @@ static bool api_srvsvc_NetCharDevQEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetCharDevQEnum *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQENUM]; - + r = talloc(NULL, struct srvsvc_NetCharDevQEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQEnum, r); - + } + ZERO_STRUCT(r->out); r->out.level = r->in.level; r->out.ctr = r->in.ctr; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetCharDevQEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetCharDevQGetInfo(pipes_struct *p) @@ -325,74 +333,76 @@ static bool api_srvsvc_NetCharDevQGetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetCharDevQGetInfo *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQGETINFO]; - + r = talloc(NULL, struct srvsvc_NetCharDevQGetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQGetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union srvsvc_NetCharDevQInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetCharDevQGetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQGetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetCharDevQSetInfo(pipes_struct *p) @@ -403,69 +413,71 @@ static bool api_srvsvc_NetCharDevQSetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetCharDevQSetInfo *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQSETINFO]; - + r = talloc(NULL, struct srvsvc_NetCharDevQSetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQSetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.parm_error = r->in.parm_error; r->out.result = _srvsvc_NetCharDevQSetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQSetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetCharDevQPurge(pipes_struct *p) @@ -476,67 +488,69 @@ static bool api_srvsvc_NetCharDevQPurge(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetCharDevQPurge *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQPURGE]; - + r = talloc(NULL, struct srvsvc_NetCharDevQPurge); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurge, r); - + } + r->out.result = _srvsvc_NetCharDevQPurge(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurge, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetCharDevQPurgeSelf(pipes_struct *p) @@ -547,67 +561,69 @@ static bool api_srvsvc_NetCharDevQPurgeSelf(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetCharDevQPurgeSelf *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCHARDEVQPURGESELF]; - + r = talloc(NULL, struct srvsvc_NetCharDevQPurgeSelf); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetCharDevQPurgeSelf, r); - + } + r->out.result = _srvsvc_NetCharDevQPurgeSelf(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurgeSelf, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetConnEnum(pipes_struct *p) @@ -618,77 +634,79 @@ static bool api_srvsvc_NetConnEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetConnEnum *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETCONNENUM]; - + r = talloc(NULL, struct srvsvc_NetConnEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetConnEnum, r); - + } + ZERO_STRUCT(r->out); r->out.level = r->in.level; r->out.ctr = r->in.ctr; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetConnEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetConnEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetFileEnum(pipes_struct *p) @@ -699,77 +717,79 @@ static bool api_srvsvc_NetFileEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetFileEnum *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETFILEENUM]; - + r = talloc(NULL, struct srvsvc_NetFileEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetFileEnum, r); - + } + ZERO_STRUCT(r->out); r->out.level = r->in.level; r->out.ctr = r->in.ctr; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetFileEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetFileEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetFileGetInfo(pipes_struct *p) @@ -780,74 +800,76 @@ static bool api_srvsvc_NetFileGetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetFileGetInfo *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETFILEGETINFO]; - + r = talloc(NULL, struct srvsvc_NetFileGetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetFileGetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union srvsvc_NetFileInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetFileGetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetFileGetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetFileClose(pipes_struct *p) @@ -858,67 +880,69 @@ static bool api_srvsvc_NetFileClose(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetFileClose *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETFILECLOSE]; - + r = talloc(NULL, struct srvsvc_NetFileClose); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetFileClose, r); - + } + r->out.result = _srvsvc_NetFileClose(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetFileClose, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetSessEnum(pipes_struct *p) @@ -929,77 +953,79 @@ static bool api_srvsvc_NetSessEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetSessEnum *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSESSENUM]; - + r = talloc(NULL, struct srvsvc_NetSessEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSessEnum, r); - + } + ZERO_STRUCT(r->out); r->out.level = r->in.level; r->out.ctr = r->in.ctr; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetSessEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSessEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetSessDel(pipes_struct *p) @@ -1010,67 +1036,69 @@ static bool api_srvsvc_NetSessDel(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetSessDel *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSESSDEL]; - + r = talloc(NULL, struct srvsvc_NetSessDel); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSessDel, r); - + } + r->out.result = _srvsvc_NetSessDel(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSessDel, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareAdd(pipes_struct *p) @@ -1081,69 +1109,71 @@ static bool api_srvsvc_NetShareAdd(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareAdd *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREADD]; - + r = talloc(NULL, struct srvsvc_NetShareAdd); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareAdd, r); - + } + ZERO_STRUCT(r->out); r->out.parm_error = r->in.parm_error; r->out.result = _srvsvc_NetShareAdd(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareAdd, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareEnumAll(pipes_struct *p) @@ -1154,77 +1184,79 @@ static bool api_srvsvc_NetShareEnumAll(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareEnumAll *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREENUMALL]; - + r = talloc(NULL, struct srvsvc_NetShareEnumAll); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnumAll, r); - + } + ZERO_STRUCT(r->out); r->out.level = r->in.level; r->out.ctr = r->in.ctr; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetShareEnumAll(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnumAll, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareGetInfo(pipes_struct *p) @@ -1235,74 +1267,76 @@ static bool api_srvsvc_NetShareGetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareGetInfo *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREGETINFO]; - + r = talloc(NULL, struct srvsvc_NetShareGetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareGetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union srvsvc_NetShareInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetShareGetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareGetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareSetInfo(pipes_struct *p) @@ -1313,69 +1347,71 @@ static bool api_srvsvc_NetShareSetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareSetInfo *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHARESETINFO]; - + r = talloc(NULL, struct srvsvc_NetShareSetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareSetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.parm_error = r->in.parm_error; r->out.result = _srvsvc_NetShareSetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareSetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareDel(pipes_struct *p) @@ -1386,67 +1422,69 @@ static bool api_srvsvc_NetShareDel(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareDel *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDEL]; - + r = talloc(NULL, struct srvsvc_NetShareDel); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareDel, r); - + } + r->out.result = _srvsvc_NetShareDel(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDel, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareDelSticky(pipes_struct *p) @@ -1457,67 +1495,69 @@ static bool api_srvsvc_NetShareDelSticky(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareDelSticky *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDELSTICKY]; - + r = talloc(NULL, struct srvsvc_NetShareDelSticky); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelSticky, r); - + } + r->out.result = _srvsvc_NetShareDelSticky(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelSticky, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareCheck(pipes_struct *p) @@ -1528,74 +1568,76 @@ static bool api_srvsvc_NetShareCheck(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareCheck *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHARECHECK]; - + r = talloc(NULL, struct srvsvc_NetShareCheck); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareCheck, r); - + } + ZERO_STRUCT(r->out); r->out.type = talloc_zero(r, enum srvsvc_ShareType); if (r->out.type == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetShareCheck(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareCheck, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetSrvGetInfo(pipes_struct *p) @@ -1606,74 +1648,76 @@ static bool api_srvsvc_NetSrvGetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetSrvGetInfo *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSRVGETINFO]; - + r = talloc(NULL, struct srvsvc_NetSrvGetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSrvGetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union srvsvc_NetSrvInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetSrvGetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvGetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetSrvSetInfo(pipes_struct *p) @@ -1684,69 +1728,71 @@ static bool api_srvsvc_NetSrvSetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetSrvSetInfo *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSRVSETINFO]; - + r = talloc(NULL, struct srvsvc_NetSrvSetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSrvSetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.parm_error = r->in.parm_error; r->out.result = _srvsvc_NetSrvSetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvSetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetDiskEnum(pipes_struct *p) @@ -1757,76 +1803,78 @@ static bool api_srvsvc_NetDiskEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetDiskEnum *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETDISKENUM]; - + r = talloc(NULL, struct srvsvc_NetDiskEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetDiskEnum, r); - + } + ZERO_STRUCT(r->out); r->out.info = r->in.info; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetDiskEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetDiskEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetServerStatisticsGet(pipes_struct *p) @@ -1837,74 +1885,76 @@ static bool api_srvsvc_NetServerStatisticsGet(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetServerStatisticsGet *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSERVERSTATISTICSGET]; - + r = talloc(NULL, struct srvsvc_NetServerStatisticsGet); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetServerStatisticsGet, r); - + } + ZERO_STRUCT(r->out); r->out.stats = talloc_zero(r, struct srvsvc_Statistics); if (r->out.stats == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetServerStatisticsGet(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetServerStatisticsGet, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetTransportAdd(pipes_struct *p) @@ -1915,67 +1965,69 @@ static bool api_srvsvc_NetTransportAdd(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetTransportAdd *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETTRANSPORTADD]; - + r = talloc(NULL, struct srvsvc_NetTransportAdd); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetTransportAdd, r); - + } + r->out.result = _srvsvc_NetTransportAdd(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportAdd, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetTransportEnum(pipes_struct *p) @@ -1986,77 +2038,79 @@ static bool api_srvsvc_NetTransportEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetTransportEnum *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETTRANSPORTENUM]; - + r = talloc(NULL, struct srvsvc_NetTransportEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetTransportEnum, r); - + } + ZERO_STRUCT(r->out); r->out.level = r->in.level; r->out.transports = r->in.transports; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetTransportEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetTransportDel(pipes_struct *p) @@ -2067,67 +2121,69 @@ static bool api_srvsvc_NetTransportDel(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetTransportDel *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETTRANSPORTDEL]; - + r = talloc(NULL, struct srvsvc_NetTransportDel); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetTransportDel, r); - + } + r->out.result = _srvsvc_NetTransportDel(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportDel, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetRemoteTOD(pipes_struct *p) @@ -2138,74 +2194,76 @@ static bool api_srvsvc_NetRemoteTOD(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetRemoteTOD *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETREMOTETOD]; - + r = talloc(NULL, struct srvsvc_NetRemoteTOD); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetRemoteTOD, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, struct srvsvc_NetRemoteTODInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetRemoteTOD(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetRemoteTOD, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetSetServiceBits(pipes_struct *p) @@ -2216,67 +2274,69 @@ static bool api_srvsvc_NetSetServiceBits(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetSetServiceBits *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSETSERVICEBITS]; - + r = talloc(NULL, struct srvsvc_NetSetServiceBits); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSetServiceBits, r); - + } + r->out.result = _srvsvc_NetSetServiceBits(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSetServiceBits, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetPathType(pipes_struct *p) @@ -2287,74 +2347,76 @@ static bool api_srvsvc_NetPathType(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetPathType *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPATHTYPE]; - + r = talloc(NULL, struct srvsvc_NetPathType); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetPathType, r); - + } + ZERO_STRUCT(r->out); r->out.pathtype = talloc_zero(r, uint32_t); if (r->out.pathtype == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetPathType(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetPathType, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetPathCanonicalize(pipes_struct *p) @@ -2365,75 +2427,77 @@ static bool api_srvsvc_NetPathCanonicalize(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetPathCanonicalize *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPATHCANONICALIZE]; - + r = talloc(NULL, struct srvsvc_NetPathCanonicalize); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetPathCanonicalize, r); - + } + ZERO_STRUCT(r->out); r->out.can_path = talloc_zero_array(r, uint8_t, r->in.maxbuf); if (r->out.can_path == NULL) { talloc_free(r); - return False; + return false; } - + r->out.pathtype = r->in.pathtype; r->out.result = _srvsvc_NetPathCanonicalize(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCanonicalize, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetPathCompare(pipes_struct *p) @@ -2444,67 +2508,69 @@ static bool api_srvsvc_NetPathCompare(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetPathCompare *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPATHCOMPARE]; - + r = talloc(NULL, struct srvsvc_NetPathCompare); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetPathCompare, r); - + } + r->out.result = _srvsvc_NetPathCompare(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCompare, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetNameValidate(pipes_struct *p) @@ -2515,67 +2581,69 @@ static bool api_srvsvc_NetNameValidate(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetNameValidate *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETNAMEVALIDATE]; - + r = talloc(NULL, struct srvsvc_NetNameValidate); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetNameValidate, r); - + } + r->out.result = _srvsvc_NetNameValidate(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetNameValidate, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p) @@ -2586,67 +2654,69 @@ static bool api_srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRPRNAMECANONICALIZE *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRPRNAMECANONICALIZE]; - + r = talloc(NULL, struct srvsvc_NETRPRNAMECANONICALIZE); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, r); - + } + r->out.result = _srvsvc_NETRPRNAMECANONICALIZE(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetPRNameCompare(pipes_struct *p) @@ -2657,67 +2727,69 @@ static bool api_srvsvc_NetPRNameCompare(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetPRNameCompare *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETPRNAMECOMPARE]; - + r = talloc(NULL, struct srvsvc_NetPRNameCompare); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetPRNameCompare, r); - + } + r->out.result = _srvsvc_NetPRNameCompare(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetPRNameCompare, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareEnum(pipes_struct *p) @@ -2728,77 +2800,79 @@ static bool api_srvsvc_NetShareEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareEnum *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREENUM]; - + r = talloc(NULL, struct srvsvc_NetShareEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareEnum, r); - + } + ZERO_STRUCT(r->out); r->out.level = r->in.level; r->out.ctr = r->in.ctr; r->out.totalentries = talloc_zero(r, uint32_t); if (r->out.totalentries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _srvsvc_NetShareEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareDelStart(pipes_struct *p) @@ -2809,74 +2883,76 @@ static bool api_srvsvc_NetShareDelStart(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareDelStart *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDELSTART]; - + r = talloc(NULL, struct srvsvc_NetShareDelStart); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelStart, r); - + } + ZERO_STRUCT(r->out); r->out.hnd = talloc_zero(r, struct policy_handle); if (r->out.hnd == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetShareDelStart(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelStart, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetShareDelCommit(pipes_struct *p) @@ -2887,69 +2963,71 @@ static bool api_srvsvc_NetShareDelCommit(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetShareDelCommit *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSHAREDELCOMMIT]; - + r = talloc(NULL, struct srvsvc_NetShareDelCommit); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetShareDelCommit, r); - + } + ZERO_STRUCT(r->out); r->out.hnd = r->in.hnd; r->out.result = _srvsvc_NetShareDelCommit(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelCommit, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetGetFileSecurity(pipes_struct *p) @@ -2960,74 +3038,76 @@ static bool api_srvsvc_NetGetFileSecurity(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetGetFileSecurity *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETGETFILESECURITY]; - + r = talloc(NULL, struct srvsvc_NetGetFileSecurity); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetGetFileSecurity, r); - + } + ZERO_STRUCT(r->out); r->out.sd_buf = talloc_zero(r, struct sec_desc_buf); if (r->out.sd_buf == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _srvsvc_NetGetFileSecurity(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetGetFileSecurity, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetSetFileSecurity(pipes_struct *p) @@ -3038,67 +3118,69 @@ static bool api_srvsvc_NetSetFileSecurity(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetSetFileSecurity *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSETFILESECURITY]; - + r = talloc(NULL, struct srvsvc_NetSetFileSecurity); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetSetFileSecurity, r); - + } + r->out.result = _srvsvc_NetSetFileSecurity(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetSetFileSecurity, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetServerTransportAddEx(pipes_struct *p) @@ -3109,67 +3191,69 @@ static bool api_srvsvc_NetServerTransportAddEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetServerTransportAddEx *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSERVERTRANSPORTADDEX]; - + r = talloc(NULL, struct srvsvc_NetServerTransportAddEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetServerTransportAddEx, r); - + } + r->out.result = _srvsvc_NetServerTransportAddEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetServerTransportAddEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NetServerSetServiceBitsEx(pipes_struct *p) @@ -3180,67 +3264,69 @@ static bool api_srvsvc_NetServerSetServiceBitsEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NetServerSetServiceBitsEx *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETSERVERSETSERVICEBITSEX]; - + r = talloc(NULL, struct srvsvc_NetServerSetServiceBitsEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NetServerSetServiceBitsEx, r); - + } + r->out.result = _srvsvc_NetServerSetServiceBitsEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NetServerSetServiceBitsEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSGETVERSION(pipes_struct *p) @@ -3251,67 +3337,69 @@ static bool api_srvsvc_NETRDFSGETVERSION(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSGETVERSION *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSGETVERSION]; - + r = talloc(NULL, struct srvsvc_NETRDFSGETVERSION); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSGETVERSION, r); - + } + r->out.result = _srvsvc_NETRDFSGETVERSION(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSGETVERSION, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p) @@ -3322,67 +3410,69 @@ static bool api_srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSCREATELOCALPARTITION *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSCREATELOCALPARTITION]; - + r = talloc(NULL, struct srvsvc_NETRDFSCREATELOCALPARTITION); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, r); - + } + r->out.result = _srvsvc_NETRDFSCREATELOCALPARTITION(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p) @@ -3393,67 +3483,69 @@ static bool api_srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSDELETELOCALPARTITION *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSDELETELOCALPARTITION]; - + r = talloc(NULL, struct srvsvc_NETRDFSDELETELOCALPARTITION); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, r); - + } + r->out.result = _srvsvc_NETRDFSDELETELOCALPARTITION(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p) @@ -3464,67 +3556,69 @@ static bool api_srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSSETLOCALVOLUMESTATE]; - + r = talloc(NULL, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, r); - + } + r->out.result = _srvsvc_NETRDFSSETLOCALVOLUMESTATE(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p) @@ -3535,67 +3629,69 @@ static bool api_srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSSETSERVERINFO *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSSETSERVERINFO]; - + r = talloc(NULL, struct srvsvc_NETRDFSSETSERVERINFO); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSSETSERVERINFO, r); - + } + r->out.result = _srvsvc_NETRDFSSETSERVERINFO(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETSERVERINFO, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p) @@ -3606,67 +3702,69 @@ static bool api_srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSCREATEEXITPOINT *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSCREATEEXITPOINT]; - + r = talloc(NULL, struct srvsvc_NETRDFSCREATEEXITPOINT); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, r); - + } + r->out.result = _srvsvc_NETRDFSCREATEEXITPOINT(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p) @@ -3677,67 +3775,69 @@ static bool api_srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSDELETEEXITPOINT *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSDELETEEXITPOINT]; - + r = talloc(NULL, struct srvsvc_NETRDFSDELETEEXITPOINT); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, r); - + } + r->out.result = _srvsvc_NETRDFSDELETEEXITPOINT(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p) @@ -3748,67 +3848,69 @@ static bool api_srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSMODIFYPREFIX *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSMODIFYPREFIX]; - + r = talloc(NULL, struct srvsvc_NETRDFSMODIFYPREFIX); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, r); - + } + r->out.result = _srvsvc_NETRDFSMODIFYPREFIX(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p) @@ -3819,67 +3921,69 @@ static bool api_srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSFIXLOCALVOLUME *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSFIXLOCALVOLUME]; - + r = talloc(NULL, struct srvsvc_NETRDFSFIXLOCALVOLUME); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, r); - + } + r->out.result = _srvsvc_NETRDFSFIXLOCALVOLUME(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p) @@ -3890,67 +3994,69 @@ static bool api_srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRDFSMANAGERREPORTSITEINFO]; - + r = talloc(NULL, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, r); - + } + r->out.result = _srvsvc_NETRDFSMANAGERREPORTSITEINFO(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p) @@ -3961,67 +4067,69 @@ static bool api_srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct srvsvc_NETRSERVERTRANSPORTDELEX *r; - + call = &ndr_table_srvsvc.calls[NDR_SRVSVC_NETRSERVERTRANSPORTDELEX]; - + r = talloc(NULL, struct srvsvc_NETRSERVERTRANSPORTDELEX); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, r); - + } + r->out.result = _srvsvc_NETRSERVERTRANSPORTDELEX(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_svcctl.c b/source3/librpc/gen_ndr/srv_svcctl.c index 1d4719858d..4a0a2591ab 100644 --- a/source3/librpc/gen_ndr/srv_svcctl.c +++ b/source3/librpc/gen_ndr/srv_svcctl.c @@ -14,69 +14,71 @@ static bool api_svcctl_CloseServiceHandle(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_CloseServiceHandle *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CLOSESERVICEHANDLE]; - + r = talloc(NULL, struct svcctl_CloseServiceHandle); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, r); - + } + ZERO_STRUCT(r->out); r->out.handle = r->in.handle; r->out.result = _svcctl_CloseServiceHandle(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_ControlService(pipes_struct *p) @@ -87,74 +89,76 @@ static bool api_svcctl_ControlService(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_ControlService *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CONTROLSERVICE]; - + r = talloc(NULL, struct svcctl_ControlService); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ControlService, r); - + } + ZERO_STRUCT(r->out); r->out.service_status = talloc_zero(r, struct SERVICE_STATUS); if (r->out.service_status == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_ControlService(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ControlService, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_DeleteService(pipes_struct *p) @@ -165,67 +169,69 @@ static bool api_svcctl_DeleteService(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_DeleteService *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_DELETESERVICE]; - + r = talloc(NULL, struct svcctl_DeleteService); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_DeleteService, r); - + } + r->out.result = _svcctl_DeleteService(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_LockServiceDatabase(pipes_struct *p) @@ -236,74 +242,76 @@ static bool api_svcctl_LockServiceDatabase(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_LockServiceDatabase *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_LOCKSERVICEDATABASE]; - + r = talloc(NULL, struct svcctl_LockServiceDatabase); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, r); - + } + ZERO_STRUCT(r->out); r->out.lock = talloc_zero(r, struct policy_handle); if (r->out.lock == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_LockServiceDatabase(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_QueryServiceObjectSecurity(pipes_struct *p) @@ -314,67 +322,69 @@ static bool api_svcctl_QueryServiceObjectSecurity(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_QueryServiceObjectSecurity *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY]; - + r = talloc(NULL, struct svcctl_QueryServiceObjectSecurity); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, r); - + } + r->out.result = _svcctl_QueryServiceObjectSecurity(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_SetServiceObjectSecurity(pipes_struct *p) @@ -385,67 +395,69 @@ static bool api_svcctl_SetServiceObjectSecurity(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_SetServiceObjectSecurity *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SETSERVICEOBJECTSECURITY]; - + r = talloc(NULL, struct svcctl_SetServiceObjectSecurity); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, r); - + } + r->out.result = _svcctl_SetServiceObjectSecurity(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_QueryServiceStatus(pipes_struct *p) @@ -456,74 +468,76 @@ static bool api_svcctl_QueryServiceStatus(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_QueryServiceStatus *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICESTATUS]; - + r = talloc(NULL, struct svcctl_QueryServiceStatus); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, r); - + } + ZERO_STRUCT(r->out); r->out.service_status = talloc_zero(r, struct SERVICE_STATUS); if (r->out.service_status == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_QueryServiceStatus(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_SetServiceStatus(pipes_struct *p) @@ -534,67 +548,69 @@ static bool api_svcctl_SetServiceStatus(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_SetServiceStatus *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SETSERVICESTATUS]; - + r = talloc(NULL, struct svcctl_SetServiceStatus); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, r); - + } + r->out.result = _svcctl_SetServiceStatus(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_UnlockServiceDatabase(pipes_struct *p) @@ -605,69 +621,71 @@ static bool api_svcctl_UnlockServiceDatabase(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_UnlockServiceDatabase *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_UNLOCKSERVICEDATABASE]; - + r = talloc(NULL, struct svcctl_UnlockServiceDatabase); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, r); - + } + ZERO_STRUCT(r->out); r->out.lock = r->in.lock; r->out.result = _svcctl_UnlockServiceDatabase(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_NotifyBootConfigStatus(pipes_struct *p) @@ -678,67 +696,69 @@ static bool api_svcctl_NotifyBootConfigStatus(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_NotifyBootConfigStatus *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS]; - + r = talloc(NULL, struct svcctl_NotifyBootConfigStatus); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, r); - + } + r->out.result = _svcctl_NotifyBootConfigStatus(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_SCSetServiceBitsW(pipes_struct *p) @@ -749,67 +769,69 @@ static bool api_svcctl_SCSetServiceBitsW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_SCSetServiceBitsW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSETSERVICEBITSW]; - + r = talloc(NULL, struct svcctl_SCSetServiceBitsW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, r); - + } + r->out.result = _svcctl_SCSetServiceBitsW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_ChangeServiceConfigW(pipes_struct *p) @@ -820,74 +842,76 @@ static bool api_svcctl_ChangeServiceConfigW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_ChangeServiceConfigW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIGW]; - + r = talloc(NULL, struct svcctl_ChangeServiceConfigW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, r); - + } + ZERO_STRUCT(r->out); r->out.tag_id = talloc_zero(r, uint32_t); if (r->out.tag_id == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_ChangeServiceConfigW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_CreateServiceW(pipes_struct *p) @@ -898,75 +922,77 @@ static bool api_svcctl_CreateServiceW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_CreateServiceW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CREATESERVICEW]; - + r = talloc(NULL, struct svcctl_CreateServiceW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, r); - + } + ZERO_STRUCT(r->out); r->out.TagId = r->in.TagId; r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_CreateServiceW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_EnumDependentServicesW(pipes_struct *p) @@ -977,86 +1003,88 @@ static bool api_svcctl_EnumDependentServicesW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_EnumDependentServicesW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMDEPENDENTSERVICESW]; - + r = talloc(NULL, struct svcctl_EnumDependentServicesW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, r); - + } + ZERO_STRUCT(r->out); r->out.service_status = talloc_zero(r, struct ENUM_SERVICE_STATUS); if (r->out.service_status == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.services_returned = talloc_zero(r, uint32_t); if (r->out.services_returned == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_EnumDependentServicesW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_EnumServicesStatusW(pipes_struct *p) @@ -1067,87 +1095,89 @@ static bool api_svcctl_EnumServicesStatusW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_EnumServicesStatusW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICESSTATUSW]; - + r = talloc(NULL, struct svcctl_EnumServicesStatusW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, r); - + } + ZERO_STRUCT(r->out); r->out.service = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.service == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.services_returned = talloc_zero(r, uint32_t); if (r->out.services_returned == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _svcctl_EnumServicesStatusW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_OpenSCManagerW(pipes_struct *p) @@ -1158,74 +1188,76 @@ static bool api_svcctl_OpenSCManagerW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_OpenSCManagerW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSCMANAGERW]; - + r = talloc(NULL, struct svcctl_OpenSCManagerW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_OpenSCManagerW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_OpenServiceW(pipes_struct *p) @@ -1236,74 +1268,76 @@ static bool api_svcctl_OpenServiceW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_OpenServiceW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSERVICEW]; - + r = talloc(NULL, struct svcctl_OpenServiceW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_OpenServiceW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_QueryServiceConfigW(pipes_struct *p) @@ -1314,80 +1348,82 @@ static bool api_svcctl_QueryServiceConfigW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_QueryServiceConfigW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIGW]; - + r = talloc(NULL, struct svcctl_QueryServiceConfigW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, r); - + } + ZERO_STRUCT(r->out); r->out.query = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.query == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_QueryServiceConfigW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_QueryServiceLockStatusW(pipes_struct *p) @@ -1398,80 +1434,82 @@ static bool api_svcctl_QueryServiceLockStatusW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_QueryServiceLockStatusW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICELOCKSTATUSW]; - + r = talloc(NULL, struct svcctl_QueryServiceLockStatusW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, r); - + } + ZERO_STRUCT(r->out); r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS); if (r->out.lock_status == NULL) { talloc_free(r); - return False; + return false; } - + r->out.required_buf_size = talloc_zero(r, uint32_t); if (r->out.required_buf_size == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_QueryServiceLockStatusW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_StartServiceW(pipes_struct *p) @@ -1482,67 +1520,69 @@ static bool api_svcctl_StartServiceW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_StartServiceW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_STARTSERVICEW]; - + r = talloc(NULL, struct svcctl_StartServiceW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, r); - + } + r->out.result = _svcctl_StartServiceW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_GetServiceDisplayNameW(pipes_struct *p) @@ -1553,75 +1593,77 @@ static bool api_svcctl_GetServiceDisplayNameW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_GetServiceDisplayNameW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEDISPLAYNAMEW]; - + r = talloc(NULL, struct svcctl_GetServiceDisplayNameW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, r); - + } + ZERO_STRUCT(r->out); r->out.display_name = talloc_zero(r, const char *); if (r->out.display_name == NULL) { talloc_free(r); - return False; + return false; } - + r->out.display_name_length = r->in.display_name_length; r->out.result = _svcctl_GetServiceDisplayNameW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_GetServiceKeyNameW(pipes_struct *p) @@ -1632,75 +1674,77 @@ static bool api_svcctl_GetServiceKeyNameW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_GetServiceKeyNameW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEKEYNAMEW]; - + r = talloc(NULL, struct svcctl_GetServiceKeyNameW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, r); - + } + ZERO_STRUCT(r->out); r->out.key_name = talloc_zero(r, const char *); if (r->out.key_name == NULL) { talloc_free(r); - return False; + return false; } - + r->out.display_name_length = r->in.display_name_length; r->out.result = _svcctl_GetServiceKeyNameW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_SCSetServiceBitsA(pipes_struct *p) @@ -1711,67 +1755,69 @@ static bool api_svcctl_SCSetServiceBitsA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_SCSetServiceBitsA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSETSERVICEBITSA]; - + r = talloc(NULL, struct svcctl_SCSetServiceBitsA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, r); - + } + r->out.result = _svcctl_SCSetServiceBitsA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_ChangeServiceConfigA(pipes_struct *p) @@ -1782,74 +1828,76 @@ static bool api_svcctl_ChangeServiceConfigA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_ChangeServiceConfigA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIGA]; - + r = talloc(NULL, struct svcctl_ChangeServiceConfigA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, r); - + } + ZERO_STRUCT(r->out); r->out.tag_id = talloc_zero(r, uint32_t); if (r->out.tag_id == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_ChangeServiceConfigA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_CreateServiceA(pipes_struct *p) @@ -1860,74 +1908,76 @@ static bool api_svcctl_CreateServiceA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_CreateServiceA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CREATESERVICEA]; - + r = talloc(NULL, struct svcctl_CreateServiceA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, r); - + } + ZERO_STRUCT(r->out); r->out.TagId = talloc_zero(r, uint32_t); if (r->out.TagId == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_CreateServiceA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_EnumDependentServicesA(pipes_struct *p) @@ -1938,86 +1988,88 @@ static bool api_svcctl_EnumDependentServicesA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_EnumDependentServicesA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMDEPENDENTSERVICESA]; - + r = talloc(NULL, struct svcctl_EnumDependentServicesA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, r); - + } + ZERO_STRUCT(r->out); r->out.service_status = talloc_zero(r, struct ENUM_SERVICE_STATUS); if (r->out.service_status == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.services_returned = talloc_zero(r, uint32_t); if (r->out.services_returned == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_EnumDependentServicesA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_EnumServicesStatusA(pipes_struct *p) @@ -2028,87 +2080,89 @@ static bool api_svcctl_EnumServicesStatusA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_EnumServicesStatusA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICESSTATUSA]; - + r = talloc(NULL, struct svcctl_EnumServicesStatusA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, r); - + } + ZERO_STRUCT(r->out); r->out.service = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.service == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.services_returned = talloc_zero(r, uint32_t); if (r->out.services_returned == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _svcctl_EnumServicesStatusA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_OpenSCManagerA(pipes_struct *p) @@ -2119,74 +2173,76 @@ static bool api_svcctl_OpenSCManagerA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_OpenSCManagerA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSCMANAGERA]; - + r = talloc(NULL, struct svcctl_OpenSCManagerA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_OpenSCManagerA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_OpenServiceA(pipes_struct *p) @@ -2197,67 +2253,69 @@ static bool api_svcctl_OpenServiceA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_OpenServiceA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSERVICEA]; - + r = talloc(NULL, struct svcctl_OpenServiceA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, r); - + } + r->out.result = _svcctl_OpenServiceA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_QueryServiceConfigA(pipes_struct *p) @@ -2268,80 +2326,82 @@ static bool api_svcctl_QueryServiceConfigA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_QueryServiceConfigA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIGA]; - + r = talloc(NULL, struct svcctl_QueryServiceConfigA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, r); - + } + ZERO_STRUCT(r->out); r->out.query = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.query == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_QueryServiceConfigA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_QueryServiceLockStatusA(pipes_struct *p) @@ -2352,80 +2412,82 @@ static bool api_svcctl_QueryServiceLockStatusA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_QueryServiceLockStatusA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICELOCKSTATUSA]; - + r = talloc(NULL, struct svcctl_QueryServiceLockStatusA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, r); - + } + ZERO_STRUCT(r->out); r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS); if (r->out.lock_status == NULL) { talloc_free(r); - return False; + return false; } - + r->out.required_buf_size = talloc_zero(r, uint32_t); if (r->out.required_buf_size == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_QueryServiceLockStatusA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_StartServiceA(pipes_struct *p) @@ -2436,67 +2498,69 @@ static bool api_svcctl_StartServiceA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_StartServiceA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_STARTSERVICEA]; - + r = talloc(NULL, struct svcctl_StartServiceA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, r); - + } + r->out.result = _svcctl_StartServiceA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_GetServiceDisplayNameA(pipes_struct *p) @@ -2507,75 +2571,77 @@ static bool api_svcctl_GetServiceDisplayNameA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_GetServiceDisplayNameA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEDISPLAYNAMEA]; - + r = talloc(NULL, struct svcctl_GetServiceDisplayNameA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, r); - + } + ZERO_STRUCT(r->out); r->out.display_name = talloc_zero(r, const char *); if (r->out.display_name == NULL) { talloc_free(r); - return False; + return false; } - + r->out.display_name_length = r->in.display_name_length; r->out.result = _svcctl_GetServiceDisplayNameA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_GetServiceKeyNameA(pipes_struct *p) @@ -2586,75 +2652,77 @@ static bool api_svcctl_GetServiceKeyNameA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_GetServiceKeyNameA *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEKEYNAMEA]; - + r = talloc(NULL, struct svcctl_GetServiceKeyNameA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, r); - + } + ZERO_STRUCT(r->out); r->out.key_name = talloc_zero(r, const char *); if (r->out.key_name == NULL) { talloc_free(r); - return False; + return false; } - + r->out.display_name_length = r->in.display_name_length; r->out.result = _svcctl_GetServiceKeyNameA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_GetCurrentGroupeStateW(pipes_struct *p) @@ -2665,67 +2733,69 @@ static bool api_svcctl_GetCurrentGroupeStateW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_GetCurrentGroupeStateW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETCURRENTGROUPESTATEW]; - + r = talloc(NULL, struct svcctl_GetCurrentGroupeStateW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, r); - + } + r->out.result = _svcctl_GetCurrentGroupeStateW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_EnumServiceGroupW(pipes_struct *p) @@ -2736,67 +2806,69 @@ static bool api_svcctl_EnumServiceGroupW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_EnumServiceGroupW *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICEGROUPW]; - + r = talloc(NULL, struct svcctl_EnumServiceGroupW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, r); - + } + r->out.result = _svcctl_EnumServiceGroupW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_ChangeServiceConfig2A(pipes_struct *p) @@ -2807,67 +2879,69 @@ static bool api_svcctl_ChangeServiceConfig2A(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_ChangeServiceConfig2A *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIG2A]; - + r = talloc(NULL, struct svcctl_ChangeServiceConfig2A); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, r); - + } + r->out.result = _svcctl_ChangeServiceConfig2A(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_ChangeServiceConfig2W(pipes_struct *p) @@ -2878,67 +2952,69 @@ static bool api_svcctl_ChangeServiceConfig2W(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_ChangeServiceConfig2W *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIG2W]; - + r = talloc(NULL, struct svcctl_ChangeServiceConfig2W); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, r); - + } + r->out.result = _svcctl_ChangeServiceConfig2W(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_QueryServiceConfig2A(pipes_struct *p) @@ -2949,80 +3025,82 @@ static bool api_svcctl_QueryServiceConfig2A(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_QueryServiceConfig2A *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIG2A]; - + r = talloc(NULL, struct svcctl_QueryServiceConfig2A); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, r); - + } + ZERO_STRUCT(r->out); r->out.buffer = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.buffer == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_QueryServiceConfig2A(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_QueryServiceConfig2W(pipes_struct *p) @@ -3033,80 +3111,82 @@ static bool api_svcctl_QueryServiceConfig2W(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_QueryServiceConfig2W *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIG2W]; - + r = talloc(NULL, struct svcctl_QueryServiceConfig2W); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, r); - + } + ZERO_STRUCT(r->out); r->out.buffer = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.buffer == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_QueryServiceConfig2W(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_QueryServiceStatusEx(pipes_struct *p) @@ -3117,80 +3197,82 @@ static bool api_svcctl_QueryServiceStatusEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_QueryServiceStatusEx *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICESTATUSEX]; - + r = talloc(NULL, struct svcctl_QueryServiceStatusEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, r); - + } + ZERO_STRUCT(r->out); r->out.buffer = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.buffer == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _svcctl_QueryServiceStatusEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_EnumServicesStatusExA(pipes_struct *p) @@ -3201,93 +3283,95 @@ static bool api_EnumServicesStatusExA(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct EnumServicesStatusExA *r; - + call = &ndr_table_svcctl.calls[NDR_ENUMSERVICESSTATUSEXA]; - + r = talloc(NULL, struct EnumServicesStatusExA); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, r); - + } + ZERO_STRUCT(r->out); r->out.services = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.services == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.service_returned = talloc_zero(r, uint32_t); if (r->out.service_returned == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.group_name = talloc_zero(r, const char *); if (r->out.group_name == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _EnumServicesStatusExA(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_EnumServicesStatusExW(pipes_struct *p) @@ -3298,93 +3382,95 @@ static bool api_EnumServicesStatusExW(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct EnumServicesStatusExW *r; - + call = &ndr_table_svcctl.calls[NDR_ENUMSERVICESSTATUSEXW]; - + r = talloc(NULL, struct EnumServicesStatusExW); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, r); - + } + ZERO_STRUCT(r->out); r->out.services = talloc_zero_array(r, uint8_t, r->in.buf_size); if (r->out.services == NULL) { talloc_free(r); - return False; + return false; } - + r->out.bytes_needed = talloc_zero(r, uint32_t); if (r->out.bytes_needed == NULL) { talloc_free(r); - return False; + return false; } - + r->out.service_returned = talloc_zero(r, uint32_t); if (r->out.service_returned == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.group_name = talloc_zero(r, const char *); if (r->out.group_name == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _EnumServicesStatusExW(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_svcctl_SCSendTSMessage(pipes_struct *p) @@ -3395,67 +3481,69 @@ static bool api_svcctl_SCSendTSMessage(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct svcctl_SCSendTSMessage *r; - + call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSENDTSMESSAGE]; - + r = talloc(NULL, struct svcctl_SCSendTSMessage); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, r); - + } + r->out.result = _svcctl_SCSendTSMessage(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_unixinfo.c b/source3/librpc/gen_ndr/srv_unixinfo.c index 19863d798f..36a6250ad0 100644 --- a/source3/librpc/gen_ndr/srv_unixinfo.c +++ b/source3/librpc/gen_ndr/srv_unixinfo.c @@ -14,74 +14,76 @@ static bool api_unixinfo_SidToUid(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct unixinfo_SidToUid *r; - + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_SIDTOUID]; - + r = talloc(NULL, struct unixinfo_SidToUid); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_SidToUid, r); - + } + ZERO_STRUCT(r->out); r->out.uid = talloc_zero(r, uint64_t); if (r->out.uid == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _unixinfo_SidToUid(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_SidToUid, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_unixinfo_UidToSid(pipes_struct *p) @@ -92,74 +94,76 @@ static bool api_unixinfo_UidToSid(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct unixinfo_UidToSid *r; - + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_UIDTOSID]; - + r = talloc(NULL, struct unixinfo_UidToSid); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_UidToSid, r); - + } + ZERO_STRUCT(r->out); r->out.sid = talloc_zero(r, struct dom_sid); if (r->out.sid == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _unixinfo_UidToSid(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_UidToSid, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_unixinfo_SidToGid(pipes_struct *p) @@ -170,74 +174,76 @@ static bool api_unixinfo_SidToGid(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct unixinfo_SidToGid *r; - + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_SIDTOGID]; - + r = talloc(NULL, struct unixinfo_SidToGid); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_SidToGid, r); - + } + ZERO_STRUCT(r->out); r->out.gid = talloc_zero(r, uint64_t); if (r->out.gid == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _unixinfo_SidToGid(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_SidToGid, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_unixinfo_GidToSid(pipes_struct *p) @@ -248,74 +254,76 @@ static bool api_unixinfo_GidToSid(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct unixinfo_GidToSid *r; - + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_GIDTOSID]; - + r = talloc(NULL, struct unixinfo_GidToSid); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_GidToSid, r); - + } + ZERO_STRUCT(r->out); r->out.sid = talloc_zero(r, struct dom_sid); if (r->out.sid == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _unixinfo_GidToSid(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_GidToSid, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_unixinfo_GetPWUid(pipes_struct *p) @@ -326,75 +334,77 @@ static bool api_unixinfo_GetPWUid(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct unixinfo_GetPWUid *r; - + call = &ndr_table_unixinfo.calls[NDR_UNIXINFO_GETPWUID]; - + r = talloc(NULL, struct unixinfo_GetPWUid); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(unixinfo_GetPWUid, r); - + } + ZERO_STRUCT(r->out); r->out.count = r->in.count; r->out.infos = talloc_zero_array(r, struct unixinfo_GetPWUidInfo, *r->out.count); if (r->out.infos == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _unixinfo_GetPWUid(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(unixinfo_GetPWUid, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c index 51918bcb97..ecce99f67a 100644 --- a/source3/librpc/gen_ndr/srv_winreg.c +++ b/source3/librpc/gen_ndr/srv_winreg.c @@ -14,74 +14,76 @@ static bool api_winreg_OpenHKCR(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenHKCR *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCR]; - + r = talloc(NULL, struct winreg_OpenHKCR); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenHKCR(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_OpenHKCU(pipes_struct *p) @@ -92,74 +94,76 @@ static bool api_winreg_OpenHKCU(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenHKCU *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCU]; - + r = talloc(NULL, struct winreg_OpenHKCU); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenHKCU(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_OpenHKLM(pipes_struct *p) @@ -170,74 +174,76 @@ static bool api_winreg_OpenHKLM(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenHKLM *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKLM]; - + r = talloc(NULL, struct winreg_OpenHKLM); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenHKLM(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_OpenHKPD(pipes_struct *p) @@ -248,74 +254,76 @@ static bool api_winreg_OpenHKPD(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenHKPD *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPD]; - + r = talloc(NULL, struct winreg_OpenHKPD); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenHKPD(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_OpenHKU(pipes_struct *p) @@ -326,74 +334,76 @@ static bool api_winreg_OpenHKU(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenHKU *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKU]; - + r = talloc(NULL, struct winreg_OpenHKU); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKU, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenHKU(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_CloseKey(pipes_struct *p) @@ -404,69 +414,71 @@ static bool api_winreg_CloseKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_CloseKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_CLOSEKEY]; - + r = talloc(NULL, struct winreg_CloseKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_CloseKey, r); - + } + ZERO_STRUCT(r->out); r->out.handle = r->in.handle; r->out.result = _winreg_CloseKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_CloseKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_CreateKey(pipes_struct *p) @@ -477,75 +489,77 @@ static bool api_winreg_CreateKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_CreateKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_CREATEKEY]; - + r = talloc(NULL, struct winreg_CreateKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_CreateKey, r); - + } + ZERO_STRUCT(r->out); r->out.new_handle = talloc_zero(r, struct policy_handle); if (r->out.new_handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.action_taken = r->in.action_taken; r->out.result = _winreg_CreateKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_CreateKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_DeleteKey(pipes_struct *p) @@ -556,67 +570,69 @@ static bool api_winreg_DeleteKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_DeleteKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_DELETEKEY]; - + r = talloc(NULL, struct winreg_DeleteKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_DeleteKey, r); - + } + r->out.result = _winreg_DeleteKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_DeleteValue(pipes_struct *p) @@ -627,67 +643,69 @@ static bool api_winreg_DeleteValue(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_DeleteValue *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_DELETEVALUE]; - + r = talloc(NULL, struct winreg_DeleteValue); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_DeleteValue, r); - + } + r->out.result = _winreg_DeleteValue(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_EnumKey(pipes_struct *p) @@ -698,71 +716,73 @@ static bool api_winreg_EnumKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_EnumKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_ENUMKEY]; - + r = talloc(NULL, struct winreg_EnumKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_EnumKey, r); - + } + ZERO_STRUCT(r->out); r->out.name = r->in.name; r->out.keyclass = r->in.keyclass; r->out.last_changed_time = r->in.last_changed_time; r->out.result = _winreg_EnumKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_EnumKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_EnumValue(pipes_struct *p) @@ -773,35 +793,36 @@ static bool api_winreg_EnumValue(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_EnumValue *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_ENUMVALUE]; - + r = talloc(NULL, struct winreg_EnumValue); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_EnumValue, r); - + } + ZERO_STRUCT(r->out); r->out.name = r->in.name; r->out.type = r->in.type; @@ -809,37 +830,38 @@ static bool api_winreg_EnumValue(pipes_struct *p) r->out.size = r->in.size; r->out.length = r->in.length; r->out.result = _winreg_EnumValue(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_EnumValue, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_FlushKey(pipes_struct *p) @@ -850,67 +872,69 @@ static bool api_winreg_FlushKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_FlushKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_FLUSHKEY]; - + r = talloc(NULL, struct winreg_FlushKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_FlushKey, r); - + } + r->out.result = _winreg_FlushKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_FlushKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_GetKeySecurity(pipes_struct *p) @@ -921,69 +945,71 @@ static bool api_winreg_GetKeySecurity(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_GetKeySecurity *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_GETKEYSECURITY]; - + r = talloc(NULL, struct winreg_GetKeySecurity); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, r); - + } + ZERO_STRUCT(r->out); r->out.sd = r->in.sd; r->out.result = _winreg_GetKeySecurity(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_LoadKey(pipes_struct *p) @@ -994,67 +1020,69 @@ static bool api_winreg_LoadKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_LoadKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_LOADKEY]; - + r = talloc(NULL, struct winreg_LoadKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_LoadKey, r); - + } + r->out.result = _winreg_LoadKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_LoadKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_NotifyChangeKeyValue(pipes_struct *p) @@ -1065,67 +1093,69 @@ static bool api_winreg_NotifyChangeKeyValue(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_NotifyChangeKeyValue *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_NOTIFYCHANGEKEYVALUE]; - + r = talloc(NULL, struct winreg_NotifyChangeKeyValue); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, r); - + } + r->out.result = _winreg_NotifyChangeKeyValue(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_OpenKey(pipes_struct *p) @@ -1136,74 +1166,76 @@ static bool api_winreg_OpenKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENKEY]; - + r = talloc(NULL, struct winreg_OpenKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenKey, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_QueryInfoKey(pipes_struct *p) @@ -1214,117 +1246,119 @@ static bool api_winreg_QueryInfoKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_QueryInfoKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYINFOKEY]; - + r = talloc(NULL, struct winreg_QueryInfoKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, r); - + } + ZERO_STRUCT(r->out); r->out.classname = r->in.classname; r->out.num_subkeys = talloc_zero(r, uint32_t); if (r->out.num_subkeys == NULL) { talloc_free(r); - return False; + return false; } - + r->out.max_subkeylen = talloc_zero(r, uint32_t); if (r->out.max_subkeylen == NULL) { talloc_free(r); - return False; + return false; } - + r->out.max_classlen = talloc_zero(r, uint32_t); if (r->out.max_classlen == NULL) { talloc_free(r); - return False; + return false; } - + r->out.num_values = talloc_zero(r, uint32_t); if (r->out.num_values == NULL) { talloc_free(r); - return False; + return false; } - + r->out.max_valnamelen = talloc_zero(r, uint32_t); if (r->out.max_valnamelen == NULL) { talloc_free(r); - return False; + return false; } - + r->out.max_valbufsize = talloc_zero(r, uint32_t); if (r->out.max_valbufsize == NULL) { talloc_free(r); - return False; + return false; } - + r->out.secdescsize = talloc_zero(r, uint32_t); if (r->out.secdescsize == NULL) { talloc_free(r); - return False; + return false; } - + r->out.last_changed_time = talloc_zero(r, NTTIME); if (r->out.last_changed_time == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_QueryInfoKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_QueryValue(pipes_struct *p) @@ -1335,72 +1369,74 @@ static bool api_winreg_QueryValue(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_QueryValue *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYVALUE]; - + r = talloc(NULL, struct winreg_QueryValue); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_QueryValue, r); - + } + ZERO_STRUCT(r->out); r->out.type = r->in.type; r->out.data = r->in.data; r->out.data_size = r->in.data_size; r->out.value_length = r->in.value_length; r->out.result = _winreg_QueryValue(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_QueryValue, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_ReplaceKey(pipes_struct *p) @@ -1411,67 +1447,69 @@ static bool api_winreg_ReplaceKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_ReplaceKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_REPLACEKEY]; - + r = talloc(NULL, struct winreg_ReplaceKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, r); - + } + r->out.result = _winreg_ReplaceKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_RestoreKey(pipes_struct *p) @@ -1482,67 +1520,69 @@ static bool api_winreg_RestoreKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_RestoreKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_RESTOREKEY]; - + r = talloc(NULL, struct winreg_RestoreKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_RestoreKey, r); - + } + r->out.result = _winreg_RestoreKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_SaveKey(pipes_struct *p) @@ -1553,67 +1593,69 @@ static bool api_winreg_SaveKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_SaveKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_SAVEKEY]; - + r = talloc(NULL, struct winreg_SaveKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_SaveKey, r); - + } + r->out.result = _winreg_SaveKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_SaveKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_SetKeySecurity(pipes_struct *p) @@ -1624,67 +1666,69 @@ static bool api_winreg_SetKeySecurity(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_SetKeySecurity *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_SETKEYSECURITY]; - + r = talloc(NULL, struct winreg_SetKeySecurity); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, r); - + } + r->out.result = _winreg_SetKeySecurity(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_SetValue(pipes_struct *p) @@ -1695,67 +1739,69 @@ static bool api_winreg_SetValue(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_SetValue *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_SETVALUE]; - + r = talloc(NULL, struct winreg_SetValue); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_SetValue, r); - + } + r->out.result = _winreg_SetValue(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_SetValue, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_UnLoadKey(pipes_struct *p) @@ -1766,67 +1812,69 @@ static bool api_winreg_UnLoadKey(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_UnLoadKey *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_UNLOADKEY]; - + r = talloc(NULL, struct winreg_UnLoadKey); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, r); - + } + r->out.result = _winreg_UnLoadKey(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_InitiateSystemShutdown(pipes_struct *p) @@ -1837,67 +1885,69 @@ static bool api_winreg_InitiateSystemShutdown(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_InitiateSystemShutdown *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_INITIATESYSTEMSHUTDOWN]; - + r = talloc(NULL, struct winreg_InitiateSystemShutdown); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, r); - + } + r->out.result = _winreg_InitiateSystemShutdown(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_AbortSystemShutdown(pipes_struct *p) @@ -1908,67 +1958,69 @@ static bool api_winreg_AbortSystemShutdown(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_AbortSystemShutdown *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_ABORTSYSTEMSHUTDOWN]; - + r = talloc(NULL, struct winreg_AbortSystemShutdown); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, r); - + } + r->out.result = _winreg_AbortSystemShutdown(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_GetVersion(pipes_struct *p) @@ -1979,74 +2031,76 @@ static bool api_winreg_GetVersion(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_GetVersion *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_GETVERSION]; - + r = talloc(NULL, struct winreg_GetVersion); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_GetVersion, r); - + } + ZERO_STRUCT(r->out); r->out.version = talloc_zero(r, uint32_t); if (r->out.version == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_GetVersion(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_GetVersion, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_OpenHKCC(pipes_struct *p) @@ -2057,74 +2111,76 @@ static bool api_winreg_OpenHKCC(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenHKCC *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCC]; - + r = talloc(NULL, struct winreg_OpenHKCC); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenHKCC(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_OpenHKDD(pipes_struct *p) @@ -2135,74 +2191,76 @@ static bool api_winreg_OpenHKDD(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenHKDD *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKDD]; - + r = talloc(NULL, struct winreg_OpenHKDD); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenHKDD(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_QueryMultipleValues(pipes_struct *p) @@ -2213,71 +2271,73 @@ static bool api_winreg_QueryMultipleValues(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_QueryMultipleValues *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYMULTIPLEVALUES]; - + r = talloc(NULL, struct winreg_QueryMultipleValues); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, r); - + } + ZERO_STRUCT(r->out); r->out.values = r->in.values; r->out.buffer = r->in.buffer; r->out.buffer_size = r->in.buffer_size; r->out.result = _winreg_QueryMultipleValues(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_InitiateSystemShutdownEx(pipes_struct *p) @@ -2288,67 +2348,69 @@ static bool api_winreg_InitiateSystemShutdownEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_InitiateSystemShutdownEx *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_INITIATESYSTEMSHUTDOWNEX]; - + r = talloc(NULL, struct winreg_InitiateSystemShutdownEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, r); - + } + r->out.result = _winreg_InitiateSystemShutdownEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_SaveKeyEx(pipes_struct *p) @@ -2359,67 +2421,69 @@ static bool api_winreg_SaveKeyEx(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_SaveKeyEx *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_SAVEKEYEX]; - + r = talloc(NULL, struct winreg_SaveKeyEx); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, r); - + } + r->out.result = _winreg_SaveKeyEx(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_OpenHKPT(pipes_struct *p) @@ -2430,74 +2494,76 @@ static bool api_winreg_OpenHKPT(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenHKPT *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPT]; - + r = talloc(NULL, struct winreg_OpenHKPT); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenHKPT(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_OpenHKPN(pipes_struct *p) @@ -2508,74 +2574,76 @@ static bool api_winreg_OpenHKPN(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_OpenHKPN *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPN]; - + r = talloc(NULL, struct winreg_OpenHKPN); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, r); - + } + ZERO_STRUCT(r->out); r->out.handle = talloc_zero(r, struct policy_handle); if (r->out.handle == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _winreg_OpenHKPN(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_winreg_QueryMultipleValues2(pipes_struct *p) @@ -2586,67 +2654,69 @@ static bool api_winreg_QueryMultipleValues2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct winreg_QueryMultipleValues2 *r; - + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYMULTIPLEVALUES2]; - + r = talloc(NULL, struct winreg_QueryMultipleValues2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, r); - + } + r->out.result = _winreg_QueryMultipleValues2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } diff --git a/source3/librpc/gen_ndr/srv_wkssvc.c b/source3/librpc/gen_ndr/srv_wkssvc.c index ff8c1e2603..ddbf3aa373 100644 --- a/source3/librpc/gen_ndr/srv_wkssvc.c +++ b/source3/librpc/gen_ndr/srv_wkssvc.c @@ -14,74 +14,76 @@ static bool api_wkssvc_NetWkstaGetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetWkstaGetInfo *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTAGETINFO]; - + r = talloc(NULL, struct wkssvc_NetWkstaGetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaGetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union wkssvc_NetWkstaInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _wkssvc_NetWkstaGetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaGetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetWkstaSetInfo(pipes_struct *p) @@ -92,69 +94,71 @@ static bool api_wkssvc_NetWkstaSetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetWkstaSetInfo *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTASETINFO]; - + r = talloc(NULL, struct wkssvc_NetWkstaSetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaSetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.parm_error = r->in.parm_error; r->out.result = _wkssvc_NetWkstaSetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaSetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetWkstaEnumUsers(pipes_struct *p) @@ -165,76 +169,78 @@ static bool api_wkssvc_NetWkstaEnumUsers(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetWkstaEnumUsers *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTAENUMUSERS]; - + r = talloc(NULL, struct wkssvc_NetWkstaEnumUsers); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaEnumUsers, r); - + } + ZERO_STRUCT(r->out); r->out.info = r->in.info; r->out.entries_read = talloc_zero(r, uint32_t); if (r->out.entries_read == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _wkssvc_NetWkstaEnumUsers(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaEnumUsers, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrWkstaUserGetInfo(pipes_struct *p) @@ -245,74 +251,76 @@ static bool api_wkssvc_NetrWkstaUserGetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrWkstaUserGetInfo *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTAUSERGETINFO]; - + r = talloc(NULL, struct wkssvc_NetrWkstaUserGetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserGetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, union wkssvc_NetrWkstaUserInfo); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _wkssvc_NetrWkstaUserGetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserGetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrWkstaUserSetInfo(pipes_struct *p) @@ -323,69 +331,71 @@ static bool api_wkssvc_NetrWkstaUserSetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrWkstaUserSetInfo *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTAUSERSETINFO]; - + r = talloc(NULL, struct wkssvc_NetrWkstaUserSetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaUserSetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.parm_err = r->in.parm_err; r->out.result = _wkssvc_NetrWkstaUserSetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserSetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetWkstaTransportEnum(pipes_struct *p) @@ -396,76 +406,78 @@ static bool api_wkssvc_NetWkstaTransportEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetWkstaTransportEnum *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETWKSTATRANSPORTENUM]; - + r = talloc(NULL, struct wkssvc_NetWkstaTransportEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetWkstaTransportEnum, r); - + } + ZERO_STRUCT(r->out); r->out.info = r->in.info; r->out.total_entries = talloc_zero(r, uint32_t); if (r->out.total_entries == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _wkssvc_NetWkstaTransportEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaTransportEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrWkstaTransportAdd(pipes_struct *p) @@ -476,69 +488,71 @@ static bool api_wkssvc_NetrWkstaTransportAdd(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrWkstaTransportAdd *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTATRANSPORTADD]; - + r = talloc(NULL, struct wkssvc_NetrWkstaTransportAdd); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportAdd, r); - + } + ZERO_STRUCT(r->out); r->out.parm_err = r->in.parm_err; r->out.result = _wkssvc_NetrWkstaTransportAdd(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportAdd, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrWkstaTransportDel(pipes_struct *p) @@ -549,67 +563,69 @@ static bool api_wkssvc_NetrWkstaTransportDel(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrWkstaTransportDel *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWKSTATRANSPORTDEL]; - + r = talloc(NULL, struct wkssvc_NetrWkstaTransportDel); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWkstaTransportDel, r); - + } + r->out.result = _wkssvc_NetrWkstaTransportDel(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportDel, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrUseAdd(pipes_struct *p) @@ -620,69 +636,71 @@ static bool api_wkssvc_NetrUseAdd(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrUseAdd *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEADD]; - + r = talloc(NULL, struct wkssvc_NetrUseAdd); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUseAdd, r); - + } + ZERO_STRUCT(r->out); r->out.parm_err = r->in.parm_err; r->out.result = _wkssvc_NetrUseAdd(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseAdd, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrUseGetInfo(pipes_struct *p) @@ -693,74 +711,76 @@ static bool api_wkssvc_NetrUseGetInfo(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrUseGetInfo *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEGETINFO]; - + r = talloc(NULL, struct wkssvc_NetrUseGetInfo); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUseGetInfo, r); - + } + ZERO_STRUCT(r->out); r->out.ctr = talloc_zero(r, union wkssvc_NetrUseGetInfoCtr); if (r->out.ctr == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _wkssvc_NetrUseGetInfo(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseGetInfo, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrUseDel(pipes_struct *p) @@ -771,67 +791,69 @@ static bool api_wkssvc_NetrUseDel(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrUseDel *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEDEL]; - + r = talloc(NULL, struct wkssvc_NetrUseDel); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUseDel, r); - + } + r->out.result = _wkssvc_NetrUseDel(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseDel, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrUseEnum(pipes_struct *p) @@ -842,76 +864,78 @@ static bool api_wkssvc_NetrUseEnum(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrUseEnum *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUSEENUM]; - + r = talloc(NULL, struct wkssvc_NetrUseEnum); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUseEnum, r); - + } + ZERO_STRUCT(r->out); r->out.info = r->in.info; r->out.entries_read = talloc_zero(r, uint32_t); if (r->out.entries_read == NULL) { talloc_free(r); - return False; + return false; } - + r->out.resume_handle = r->in.resume_handle; r->out.result = _wkssvc_NetrUseEnum(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseEnum, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrMessageBufferSend(pipes_struct *p) @@ -922,67 +946,69 @@ static bool api_wkssvc_NetrMessageBufferSend(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrMessageBufferSend *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRMESSAGEBUFFERSEND]; - + r = talloc(NULL, struct wkssvc_NetrMessageBufferSend); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrMessageBufferSend, r); - + } + r->out.result = _wkssvc_NetrMessageBufferSend(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrMessageBufferSend, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrWorkstationStatisticsGet(pipes_struct *p) @@ -993,74 +1019,76 @@ static bool api_wkssvc_NetrWorkstationStatisticsGet(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrWorkstationStatisticsGet *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRWORKSTATIONSTATISTICSGET]; - + r = talloc(NULL, struct wkssvc_NetrWorkstationStatisticsGet); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrWorkstationStatisticsGet, r); - + } + ZERO_STRUCT(r->out); r->out.info = talloc_zero(r, struct wkssvc_NetrWorkstationStatistics *); if (r->out.info == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _wkssvc_NetrWorkstationStatisticsGet(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrWorkstationStatisticsGet, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrLogonDomainNameAdd(pipes_struct *p) @@ -1071,67 +1099,69 @@ static bool api_wkssvc_NetrLogonDomainNameAdd(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrLogonDomainNameAdd *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRLOGONDOMAINNAMEADD]; - + r = talloc(NULL, struct wkssvc_NetrLogonDomainNameAdd); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameAdd, r); - + } + r->out.result = _wkssvc_NetrLogonDomainNameAdd(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameAdd, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrLogonDomainNameDel(pipes_struct *p) @@ -1142,67 +1172,69 @@ static bool api_wkssvc_NetrLogonDomainNameDel(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrLogonDomainNameDel *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRLOGONDOMAINNAMEDEL]; - + r = talloc(NULL, struct wkssvc_NetrLogonDomainNameDel); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrLogonDomainNameDel, r); - + } + r->out.result = _wkssvc_NetrLogonDomainNameDel(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameDel, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrJoinDomain(pipes_struct *p) @@ -1213,67 +1245,69 @@ static bool api_wkssvc_NetrJoinDomain(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrJoinDomain *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRJOINDOMAIN]; - + r = talloc(NULL, struct wkssvc_NetrJoinDomain); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain, r); - + } + r->out.result = _wkssvc_NetrJoinDomain(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrUnjoinDomain(pipes_struct *p) @@ -1284,67 +1318,69 @@ static bool api_wkssvc_NetrUnjoinDomain(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrUnjoinDomain *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUNJOINDOMAIN]; - + r = talloc(NULL, struct wkssvc_NetrUnjoinDomain); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain, r); - + } + r->out.result = _wkssvc_NetrUnjoinDomain(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrRenameMachineInDomain(pipes_struct *p) @@ -1355,67 +1391,69 @@ static bool api_wkssvc_NetrRenameMachineInDomain(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrRenameMachineInDomain *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN]; - + r = talloc(NULL, struct wkssvc_NetrRenameMachineInDomain); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain, r); - + } + r->out.result = _wkssvc_NetrRenameMachineInDomain(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrValidateName(pipes_struct *p) @@ -1426,67 +1464,69 @@ static bool api_wkssvc_NetrValidateName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrValidateName *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRVALIDATENAME]; - + r = talloc(NULL, struct wkssvc_NetrValidateName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName, r); - + } + r->out.result = _wkssvc_NetrValidateName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrGetJoinInformation(pipes_struct *p) @@ -1497,75 +1537,77 @@ static bool api_wkssvc_NetrGetJoinInformation(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrGetJoinInformation *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRGETJOININFORMATION]; - + r = talloc(NULL, struct wkssvc_NetrGetJoinInformation); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinInformation, r); - + } + ZERO_STRUCT(r->out); r->out.name_buffer = r->in.name_buffer; r->out.name_type = talloc_zero(r, enum wkssvc_NetJoinStatus); if (r->out.name_type == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _wkssvc_NetrGetJoinInformation(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinInformation, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrGetJoinableOus(pipes_struct *p) @@ -1576,75 +1618,77 @@ static bool api_wkssvc_NetrGetJoinableOus(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrGetJoinableOus *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRGETJOINABLEOUS]; - + r = talloc(NULL, struct wkssvc_NetrGetJoinableOus); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus, r); - + } + ZERO_STRUCT(r->out); r->out.num_ous = r->in.num_ous; r->out.ous = talloc_zero_array(r, const char **, *r->out.num_ous); if (r->out.ous == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _wkssvc_NetrGetJoinableOus(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrJoinDomain2(pipes_struct *p) @@ -1655,67 +1699,69 @@ static bool api_wkssvc_NetrJoinDomain2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrJoinDomain2 *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRJOINDOMAIN2]; - + r = talloc(NULL, struct wkssvc_NetrJoinDomain2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrJoinDomain2, r); - + } + r->out.result = _wkssvc_NetrJoinDomain2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrUnjoinDomain2(pipes_struct *p) @@ -1726,67 +1772,69 @@ static bool api_wkssvc_NetrUnjoinDomain2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrUnjoinDomain2 *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRUNJOINDOMAIN2]; - + r = talloc(NULL, struct wkssvc_NetrUnjoinDomain2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrUnjoinDomain2, r); - + } + r->out.result = _wkssvc_NetrUnjoinDomain2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrRenameMachineInDomain2(pipes_struct *p) @@ -1797,67 +1845,69 @@ static bool api_wkssvc_NetrRenameMachineInDomain2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrRenameMachineInDomain2 *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRRENAMEMACHINEINDOMAIN2]; - + r = talloc(NULL, struct wkssvc_NetrRenameMachineInDomain2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrRenameMachineInDomain2, r); - + } + r->out.result = _wkssvc_NetrRenameMachineInDomain2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrValidateName2(pipes_struct *p) @@ -1868,67 +1918,69 @@ static bool api_wkssvc_NetrValidateName2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrValidateName2 *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRVALIDATENAME2]; - + r = talloc(NULL, struct wkssvc_NetrValidateName2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrValidateName2, r); - + } + r->out.result = _wkssvc_NetrValidateName2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrGetJoinableOus2(pipes_struct *p) @@ -1939,75 +1991,77 @@ static bool api_wkssvc_NetrGetJoinableOus2(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrGetJoinableOus2 *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRGETJOINABLEOUS2]; - + r = talloc(NULL, struct wkssvc_NetrGetJoinableOus2); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrGetJoinableOus2, r); - + } + ZERO_STRUCT(r->out); r->out.num_ous = r->in.num_ous; r->out.ous = talloc_zero_array(r, const char **, *r->out.num_ous); if (r->out.ous == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _wkssvc_NetrGetJoinableOus2(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus2, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrAddAlternateComputerName(pipes_struct *p) @@ -2018,67 +2072,69 @@ static bool api_wkssvc_NetrAddAlternateComputerName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrAddAlternateComputerName *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRADDALTERNATECOMPUTERNAME]; - + r = talloc(NULL, struct wkssvc_NetrAddAlternateComputerName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrAddAlternateComputerName, r); - + } + r->out.result = _wkssvc_NetrAddAlternateComputerName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrAddAlternateComputerName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p) @@ -2089,67 +2145,69 @@ static bool api_wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrRemoveAlternateComputerName *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRREMOVEALTERNATECOMPUTERNAME]; - + r = talloc(NULL, struct wkssvc_NetrRemoveAlternateComputerName); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrRemoveAlternateComputerName, r); - + } + r->out.result = _wkssvc_NetrRemoveAlternateComputerName(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrRemoveAlternateComputerName, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrSetPrimaryComputername(pipes_struct *p) @@ -2160,67 +2218,69 @@ static bool api_wkssvc_NetrSetPrimaryComputername(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrSetPrimaryComputername *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRSETPRIMARYCOMPUTERNAME]; - + r = talloc(NULL, struct wkssvc_NetrSetPrimaryComputername); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrSetPrimaryComputername, r); - + } + r->out.result = _wkssvc_NetrSetPrimaryComputername(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrSetPrimaryComputername, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } static bool api_wkssvc_NetrEnumerateComputerNames(pipes_struct *p) @@ -2231,74 +2291,76 @@ static bool api_wkssvc_NetrEnumerateComputerNames(pipes_struct *p) enum ndr_err_code ndr_err; DATA_BLOB blob; struct wkssvc_NetrEnumerateComputerNames *r; - + call = &ndr_table_wkssvc.calls[NDR_WKSSVC_NETRENUMERATECOMPUTERNAMES]; - + r = talloc(NULL, struct wkssvc_NetrEnumerateComputerNames); if (r == NULL) { - return False; + return false; } - + if (!prs_data_blob(&p->in_data.data, &blob, r)) { talloc_free(r); - return False; + return false; } - + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { talloc_free(r); - return False; + return false; } - + pull->flags |= LIBNDR_FLAG_REF_ALLOC; ndr_err = call->ndr_pull(pull, NDR_IN, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(wkssvc_NetrEnumerateComputerNames, r); - + } + ZERO_STRUCT(r->out); r->out.ctr = talloc_zero(r, struct wkssvc_ComputerNamesCtr *); if (r->out.ctr == NULL) { talloc_free(r); - return False; + return false; } - + r->out.result = _wkssvc_NetrEnumerateComputerNames(p, r); - + if (p->rng_fault_state) { talloc_free(r); - /* Return True here, srv_pipe_hnd.c will take care */ - return True; + /* Return true here, srv_pipe_hnd.c will take care */ + return true; } - - if (DEBUGLEVEL >= 10) + + if (DEBUGLEVEL >= 10) { NDR_PRINT_OUT_DEBUG(wkssvc_NetrEnumerateComputerNames, r); - + } + push = ndr_push_init_ctx(r); if (push == NULL) { talloc_free(r); - return False; + return false; } - + ndr_err = call->ndr_push(push, NDR_OUT, r); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(r); - return False; + return false; } - + blob = ndr_push_blob(push); - if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { talloc_free(r); - return False; + return false; } - + talloc_free(r); - - return True; + + return true; } -- cgit From fbd9a15996ba4beb48c12a5632ca812e862e984c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 9 Jan 2008 12:47:13 +0100 Subject: Another attempt to fix builds w/o ldap and/or krb5. Guenther (This used to be commit e73e3da772bd024f1d74fc41b832f181ba5c43bd) --- source3/libnet/libnet_join.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index d139fa04a1..1bb2a82959 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -418,7 +418,7 @@ static ADS_STATUS libnet_join_set_os_attributes(TALLOC_CTX *mem_ctx, return ads_gen_mod(r->in.ads, r->out.dn, mods); } -#endif +#endif /* HAVE_LDAP */ /**************************************************************** ****************************************************************/ @@ -429,16 +429,15 @@ static bool libnet_join_create_keytab(TALLOC_CTX *mem_ctx, if (!lp_use_kerberos_keytab()) { return true; } - -#ifdef WITH_KRB5 +#ifdef HAVE_KRB5 if (!ads_keytab_create_default(r->in.ads)) { return false; } -#endif +#endif /* HAVE_KRB5 */ return true; } -#ifdef HAVE_LDAP +#ifdef HAVE_KRB5 /**************************************************************** ****************************************************************/ @@ -487,7 +486,8 @@ static bool libnet_join_derive_salting_principal(TALLOC_CTX *mem_ctx, return kerberos_secrets_store_des_salt(salt); } -#endif + +#endif /* HAVE_KRB5 */ /**************************************************************** ****************************************************************/ @@ -1034,7 +1034,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE; } -#endif +#endif /* HAVE_LDAP */ status = libnet_join_joindomain_rpc(mem_ctx, r); if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { @@ -1075,7 +1075,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, if (!libnet_join_derive_salting_principal(mem_ctx, r)) { return WERR_GENERAL_FAILURE; } -#endif +#endif /* HAVE_LDAP */ if (!libnet_join_create_keytab(mem_ctx, r)) { libnet_join_set_error_string(mem_ctx, r, "failed to create kerberos keytab\n"); @@ -1150,7 +1150,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, ads_errstr(ads_status)); } } -#endif +#endif /* HAVE_LDAP */ libnet_join_unjoindomain_remove_secrets(mem_ctx, r); return WERR_OK; -- cgit From 7c6d77dd883df958f9231f28d0080573e08e8add Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 22:09:55 +0100 Subject: Fix memleak in ldapsam_rename_sam_account() found by IBM checker. The check for out of memory was the wrong way round. Michael (This used to be commit d7a7b793203b986823859ac5171d2d4c30e52415) --- source3/passdb/pdb_ldap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 28df56bdb1..90a6ff011b 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -1973,7 +1973,7 @@ static NTSTATUS ldapsam_rename_sam_account(struct pdb_methods *my_methods, /* rename the posix user */ rename_script = SMB_STRDUP(lp_renameuser_script()); - if (rename_script) { + if (rename_script == NULL) { return NT_STATUS_NO_MEMORY; } -- cgit From c0c299cb267f6c559a0a407fde536aa32efc29f6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 22:25:52 +0100 Subject: Fix a memleak found by the IBM checker. Michael (This used to be commit b4a37a66bbd8f5346de743d4ab427d6671e29075) --- source3/libsmb/clirap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 54504f608d..aab77a3d54 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -297,6 +297,7 @@ bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, STR_TERMINATE|STR_UPPER); if (len == (size_t)-1) { + SAFE_FREE(last_entry); return false; } p += len; -- cgit From 1c4466cedcab04b9188569238a1e795629f3a007 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 9 Jan 2008 23:15:56 +0100 Subject: Try to fix the build on hosts that HAVE_LDAP but don't HAVE_KRB5. Michael (This used to be commit 829de79051cd1d1cc67c4c40fdc8e08c44450a09) --- source3/libnet/libnet_join.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 1bb2a82959..8e6d91b38b 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1072,9 +1072,12 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, return WERR_GENERAL_FAILURE; } +#ifdef HAVE_KRB5 if (!libnet_join_derive_salting_principal(mem_ctx, r)) { return WERR_GENERAL_FAILURE; } +#endif /* HAVE_KRB5 */ + #endif /* HAVE_LDAP */ if (!libnet_join_create_keytab(mem_ctx, r)) { libnet_join_set_error_string(mem_ctx, r, -- cgit From 66d6eb27a4e14b41b5a6cbaa828b7ccc4b4244b8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Jan 2008 23:00:48 +0100 Subject: Fix the max_dead_record calculations (This used to be commit 2a5c53220a5cc2b4a80fc7c6cb38e87789c5e797) --- source3/lib/tdb/common/open.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source3/lib/tdb/common/open.c b/source3/lib/tdb/common/open.c index 0bd1c91a5e..6efa482ac2 100644 --- a/source3/lib/tdb/common/open.c +++ b/source3/lib/tdb/common/open.c @@ -178,9 +178,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->page_size = 0x2000; } - if (open_flags & TDB_VOLATILE) { - tdb->max_dead_records = 5; - } + tdb->max_dead_records = (open_flags & TDB_VOLATILE) ? 5 : 0; if ((open_flags & O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n", @@ -283,7 +281,6 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; - tdb->max_dead_records = 0; tdb_mmap(tdb); if (locked) { if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) { -- cgit From 817e0d899d2604c8f0feabd6d0b4f20eae8bd2a1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 9 Jan 2008 14:35:00 -0800 Subject: Ensure we don't take address of one past buffer. Jeremy. (This used to be commit 318cbcfae51fc5dae549c60107d12480d8e478c8) --- source3/nmbd/nmbd_incomingrequests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/nmbd/nmbd_incomingrequests.c b/source3/nmbd/nmbd_incomingrequests.c index 90773c1395..ebe1948141 100644 --- a/source3/nmbd/nmbd_incomingrequests.c +++ b/source3/nmbd/nmbd_incomingrequests.c @@ -331,7 +331,7 @@ subnet %s - name not found.\n", nmb_namestr(&nmb->question.question_name), /* this is not an exact calculation. the 46 is for the stats buffer and the 60 is to leave room for the header etc */ - bufend = &rdata[MAX_DGRAM_SIZE] - (18 + 46 + 60); + bufend = &rdata[MAX_DGRAM_SIZE-1] - (18 + 46 + 60); countptr = buf = rdata; buf += 1; buf0 = buf; -- cgit From 381c38688d14ad12f5690bca5b3da2d08faf759d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 9 Jan 2008 14:35:15 -0800 Subject: Try and fix the AIX build. Jeremy. (This used to be commit 231a148badf1f9b868ed1d37532020defa27bbd6) --- source3/libaddns/dns.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source3/libaddns/dns.h b/source3/libaddns/dns.h index a83c0b4f8e..188d139808 100644 --- a/source3/libaddns/dns.h +++ b/source3/libaddns/dns.h @@ -25,7 +25,15 @@ #ifndef _DNS_H #define _DNS_H -#include "config.h" +#include "lib/replace/replace.h" + +/* make sure we have included the correct config.h */ +#ifndef NO_CONFIG_H /* for some tests */ +#ifndef CONFIG_H_IS_FROM_SAMBA +#error "make sure you have removed all config.h files from standalone builds!" +#error "the included config.h isn't from samba!" +#endif +#endif /* NO_CONFIG_H */ #include #include -- cgit From 638b57e5d112d0da0ffe53e4a227e15560f84df8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 00:45:54 +0100 Subject: Enable building the notify_fam module. Found by Timur I. Bakeyev . Michael (This used to be commit ece34fd2fe4bcd3f88a31a42faaba89248da3ba9) --- source3/configure.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/configure.in b/source3/configure.in index 5eb85c727d..d69928cf16 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -6494,6 +6494,8 @@ SMB_MODULE(vfs_readahead, \$(VFS_READAHEAD_OBJ), "bin/readahead.$SHLIBEXT", VFS) SMB_MODULE(vfs_fileid, \$(VFS_FILEID_OBJ), "bin/fileid.$SHLIBEXT", VFS) SMB_MODULE(vfs_syncops, \$(VFS_SYNCOPS_OBJ), "bin/syncops.$SHLIBEXT", VFS) SMB_MODULE(vfs_zfsacl, \$(VFS_ZFSACL_OBJ), "bin/zfsacl.$SHLIBEXT", VFS) +SMB_MODULE(vfs_notify_fam, \$(VFS_NOTIFY_FAM_OBJ), "bin/notify_fam.$SHLIBEXT", VFS) + SMB_SUBSYSTEM(VFS,smbd/vfs.o) -- cgit From ba6eaa690622c8b3202135cb21b690df660afa63 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 01:04:47 +0100 Subject: Try and fix the AIX build. The __ss_family workaround is in lib/replace/system/network.h ... Michael (This used to be commit 778199cf00196f81fd96deae1370d8cbc438c5bf) --- source3/libaddns/dns.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libaddns/dns.h b/source3/libaddns/dns.h index 188d139808..cf842f4d10 100644 --- a/source3/libaddns/dns.h +++ b/source3/libaddns/dns.h @@ -26,6 +26,7 @@ #define _DNS_H #include "lib/replace/replace.h" +#include "system/network.h" /* make sure we have included the correct config.h */ #ifndef NO_CONFIG_H /* for some tests */ -- cgit From 1ed4fcb271b7885c274bd88bafed8116779d8eb6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 5 Jan 2008 18:26:54 +0100 Subject: Implement talloc_pool() A talloc pool is a chunk of memory that can be used as a context for further talloc calls. Allocations with the pool as the parent just chew from that memory by incrementing a pointer. If the talloc pool is full, then we fall back to the normal system-level malloc(3) to get memory. The use case for talloc pools is the transient memory that is used for handling a single SMB request. Incrementing a pointer will be way faster than any malloc implementation. There is a downside of this: If you use talloc_steal() to move something out of the pool, the whole pool memory is kept around until the last object inside the pool is freed. So if you talloc_free() the pool, it might happen that the memory is freed later. So don't hang anything off a talloc pool that should live long. Volker (This used to be commit 287e29d988813007eeebc0c2bef3b46ab8bedee9) --- source3/lib/talloc/talloc.c | 176 +++++++++++++++++++++++++++++++++++++++-- source3/lib/talloc/talloc.h | 1 + source3/lib/talloc/testsuite.c | 37 +++++++++ 3 files changed, 207 insertions(+), 7 deletions(-) diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c index 3e976bc0fc..178bbb97e4 100644 --- a/source3/lib/talloc/talloc.c +++ b/source3/lib/talloc/talloc.c @@ -60,6 +60,8 @@ #define TALLOC_MAGIC 0xe814ec70 #define TALLOC_FLAG_FREE 0x01 #define TALLOC_FLAG_LOOP 0x02 +#define TALLOC_FLAG_POOL 0x04 /* This is a talloc pool */ +#define TALLOC_FLAG_POOLMEM 0x08 /* This is allocated in a pool */ #define TALLOC_MAGIC_REFERENCE ((const char *)1) /* by default we abort when given a bad pointer (such as when talloc_free() is called @@ -109,6 +111,19 @@ struct talloc_chunk { const char *name; size_t size; unsigned flags; + + /* + * "pool" has dual use: + * + * For the talloc pool itself (i.e. TALLOC_FLAG_POOL is set), "pool" + * marks the end of the currently allocated area. + * + * For members of the pool (i.e. TALLOC_FLAG_POOLMEM is set), "pool" + * is a pointer to the struct talloc_chunk of the pool that it was + * allocated from. This way children can quickly find the pool to chew + * from. + */ + void *pool; }; /* 16 byte alignment seems to keep everyone happy */ @@ -200,12 +215,82 @@ const char *talloc_parent_name(const void *ptr) return tc? tc->name : NULL; } +/* + A pool carries an in-pool object count count in the first 16 bytes. + bytes. This is done to support talloc_steal() to a parent outside of the + pool. The count includes the pool itself, so a talloc_free() on a pool will + only destroy the pool if the count has dropped to zero. A talloc_free() of a + pool member will reduce the count, and eventually also call free(3) on the + pool memory. + + The object count is not put into "struct talloc_chunk" because it is only + relevant for talloc pools and the alignment to 16 bytes would increase the + memory footprint of each talloc chunk by those 16 bytes. +*/ + +#define TALLOC_POOL_HDR_SIZE 16 + +static unsigned int *talloc_pool_objectcount(struct talloc_chunk *tc) +{ + return (unsigned int *)((char *)tc + sizeof(struct talloc_chunk)); +} + +/* + Allocate from a pool +*/ + +static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent, + size_t size) +{ + struct talloc_chunk *pool_ctx = NULL; + size_t space_left; + struct talloc_chunk *result; + + if (parent == NULL) { + return NULL; + } + + if (parent->flags & TALLOC_FLAG_POOL) { + pool_ctx = parent; + } + else if (parent->flags & TALLOC_FLAG_POOLMEM) { + pool_ctx = (struct talloc_chunk *)parent->pool; + } + + if (pool_ctx == NULL) { + return NULL; + } + + space_left = ((char *)pool_ctx + TC_HDR_SIZE + pool_ctx->size) + - ((char *)pool_ctx->pool); + + /* + * Align size to 16 bytes + */ + size = ((size + 15) & ~15); + + if (space_left < size) { + return NULL; + } + + result = (struct talloc_chunk *)pool_ctx->pool; + + pool_ctx->pool = (void *)((char *)result + size); + + result->flags = TALLOC_MAGIC | TALLOC_FLAG_POOLMEM; + result->pool = pool_ctx; + + *talloc_pool_objectcount(pool_ctx) += 1; + + return result; +} + /* Allocate a bit of memory as a child of an existing pointer */ static inline void *__talloc(const void *context, size_t size) { - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; if (unlikely(context == NULL)) { context = null_context; @@ -215,11 +300,19 @@ static inline void *__talloc(const void *context, size_t size) return NULL; } - tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size); - if (unlikely(tc == NULL)) return NULL; + if (context != NULL) { + tc = talloc_alloc_pool(talloc_chunk_from_ptr(context), + TC_HDR_SIZE+size); + } + + if (tc == NULL) { + tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size); + if (unlikely(tc == NULL)) return NULL; + tc->flags = TALLOC_MAGIC; + tc->pool = NULL; + } tc->size = size; - tc->flags = TALLOC_MAGIC; tc->destructor = NULL; tc->child = NULL; tc->name = NULL; @@ -245,6 +338,29 @@ static inline void *__talloc(const void *context, size_t size) return TC_PTR_FROM_CHUNK(tc); } +/* + * Create a talloc pool + */ + +void *talloc_pool(const void *context, size_t size) +{ + void *result = __talloc(context, size + TALLOC_POOL_HDR_SIZE); + struct talloc_chunk *tc; + + if (unlikely(result == NULL)) { + return NULL; + } + + tc = talloc_chunk_from_ptr(result); + + tc->flags |= TALLOC_FLAG_POOL; + tc->pool = (char *)result + TALLOC_POOL_HDR_SIZE; + + *talloc_pool_objectcount(tc) = 1; + + return result; +} + /* setup a destructor to be called on free of a pointer the destructor should return 0 on success, or -1 on failure. @@ -420,7 +536,29 @@ static inline int _talloc_free(void *ptr) } tc->flags |= TALLOC_FLAG_FREE; - free(tc); + + if (tc->flags & (TALLOC_FLAG_POOL|TALLOC_FLAG_POOLMEM)) { + struct talloc_chunk *pool; + unsigned int *pool_object_count; + + pool = (tc->flags & TALLOC_FLAG_POOL) + ? tc : (struct talloc_chunk *)tc->pool; + + pool_object_count = talloc_pool_objectcount(pool); + + if (*pool_object_count == 0) { + TALLOC_ABORT("Pool object count zero!"); + } + + *pool_object_count -= 1; + + if (*pool_object_count == 0) { + free(pool); + } + } + else { + free(tc); + } return 0; } @@ -718,6 +856,10 @@ void talloc_free_children(void *ptr) talloc_steal(new_parent, child); } } + + if (tc->flags & TALLOC_FLAG_POOL) { + tc->pool = ((char *)tc + TC_HDR_SIZE + TALLOC_POOL_HDR_SIZE); + } } /* @@ -769,6 +911,7 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n { struct talloc_chunk *tc; void *new_ptr; + bool malloced = false; /* size zero is equivalent to free() */ if (unlikely(size == 0)) { @@ -808,7 +951,23 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n free(tc); } #else - new_ptr = realloc(tc, size + TC_HDR_SIZE); + if (tc->flags & TALLOC_FLAG_POOLMEM) { + + new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE); + *talloc_pool_objectcount(tc->pool) -= 1; + + if (new_ptr == NULL) { + new_ptr = malloc(TC_HDR_SIZE+size); + malloced = true; + } + + if (new_ptr) { + memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE); + } + } + else { + new_ptr = realloc(tc, size + TC_HDR_SIZE); + } #endif if (unlikely(!new_ptr)) { tc->flags &= ~TALLOC_FLAG_FREE; @@ -816,7 +975,10 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n } tc = (struct talloc_chunk *)new_ptr; - tc->flags &= ~TALLOC_FLAG_FREE; + tc->flags &= ~TALLOC_FLAG_FREE; + if (malloced) { + tc->flags &= ~TALLOC_FLAG_POOLMEM; + } if (tc->parent) { tc->parent->child = tc; } diff --git a/source3/lib/talloc/talloc.h b/source3/lib/talloc/talloc.h index e103391681..5431971655 100644 --- a/source3/lib/talloc/talloc.h +++ b/source3/lib/talloc/talloc.h @@ -116,6 +116,7 @@ typedef void TALLOC_CTX; /* The following definitions come from talloc.c */ void *_talloc(const void *context, size_t size); +void *talloc_pool(const void *context, size_t size); void _talloc_set_destructor(const void *ptr, int (*destructor)(void *)); int talloc_increase_ref_count(const void *ptr); size_t talloc_reference_count(const void *ptr); diff --git a/source3/lib/talloc/testsuite.c b/source3/lib/talloc/testsuite.c index e16c91f8b9..fedbda95aa 100644 --- a/source3/lib/talloc/testsuite.c +++ b/source3/lib/talloc/testsuite.c @@ -813,6 +813,25 @@ static bool test_speed(void) talloc_free(ctx); + ctx = talloc_pool(NULL, 1024); + + tv = timeval_current(); + count = 0; + do { + void *p1, *p2, *p3; + for (i=0;i Date: Wed, 9 Jan 2008 17:07:58 -0800 Subject: Add the calls to make use of talloc_pools in a talloc_stackframe. Jeremy. (This used to be commit d27e6c0548d21394f6399d3b737d175ffed8420d) --- source3/include/talloc_stack.h | 1 + source3/lib/talloc_stack.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/source3/include/talloc_stack.h b/source3/include/talloc_stack.h index 331893cbd6..a2a12f8a63 100644 --- a/source3/include/talloc_stack.h +++ b/source3/include/talloc_stack.h @@ -45,6 +45,7 @@ */ TALLOC_CTX *talloc_stackframe(void); +TALLOC_CTX *talloc_stackframe_pool(size_t poolsize); /* * Get us the current top of the talloc stack. diff --git a/source3/lib/talloc_stack.c b/source3/lib/talloc_stack.c index d887b2d415..08ef2281ea 100644 --- a/source3/lib/talloc_stack.c +++ b/source3/lib/talloc_stack.c @@ -64,7 +64,7 @@ static int talloc_pop(TALLOC_CTX *frame) * not explicitly freed. */ -TALLOC_CTX *talloc_stackframe(void) +static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize) { TALLOC_CTX **tmp, *top; @@ -78,7 +78,11 @@ TALLOC_CTX *talloc_stackframe(void) talloc_stack_arraysize = talloc_stacksize + 1; } - top = talloc_new(talloc_stack); + if (poolsize) { + top = talloc_pool(talloc_stack, poolsize); + } else { + top = talloc_new(talloc_stack); + } if (top == NULL) { goto fail; @@ -94,6 +98,16 @@ TALLOC_CTX *talloc_stackframe(void) return NULL; } +TALLOC_CTX *talloc_stackframe(void) +{ + return talloc_stackframe_internal(0); +} + +TALLOC_CTX *talloc_stackframe_pool(size_t poolsize) +{ + return talloc_stackframe_internal(poolsize); +} + /* * Get us the current top of the talloc stack. */ -- cgit From 253fbf1a6ece5c8dc9759e3535b7f9fa46883c1b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 9 Jan 2008 17:11:04 -0800 Subject: Make use of talloc_pool in the main codepaths. Remove the sub-contexts. Jeremy. (This used to be commit bc932b8ad4396f76b71c43efe9a6346f89c3632c) --- source3/smbd/nttrans.c | 8 -------- source3/smbd/open.c | 8 +------- source3/smbd/process.c | 2 +- source3/smbd/service.c | 8 +------- source3/smbd/trans2.c | 25 +++++-------------------- source3/smbd/vfs.c | 13 ++++--------- 6 files changed, 12 insertions(+), 52 deletions(-) diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index ae64c06215..e8df732ea2 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -1604,7 +1604,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, SEC_DESC *psd = NULL; size_t sd_size; uint32 security_info_wanted; - TALLOC_CTX *frame; files_struct *fsp = NULL; NTSTATUS status; DATA_BLOB blob; @@ -1631,8 +1630,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, return; } - frame = talloc_stackframe(); - /* * Get the permissions to return. */ @@ -1651,7 +1648,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, } if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(frame); reply_nterror(req, status); return; } @@ -1665,7 +1661,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, if (max_data_count < sd_size) { send_nt_replies(conn, req, NT_STATUS_BUFFER_TOO_SMALL, params, 4, *ppdata, 0); - TALLOC_FREE(frame); return; } @@ -1675,7 +1670,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, data = nttrans_realloc(ppdata, sd_size); if(data == NULL) { - TALLOC_FREE(frame); reply_doserror(req, ERRDOS, ERRnomem); return; } @@ -1684,7 +1678,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, &blob.data, &blob.length); if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(frame); reply_nterror(req, status); return; } @@ -1694,7 +1687,6 @@ static void call_nt_transact_query_security_desc(connection_struct *conn, send_nt_replies(conn, req, NT_STATUS_OK, params, 4, data, (int)sd_size); - TALLOC_FREE(frame); return; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 6aef99ff0e..037ab633e3 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -125,7 +125,7 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn, char *saved_dir = NULL; SMB_STRUCT_STAT sbuf; SMB_STRUCT_STAT parent_st; - TALLOC_CTX *ctx = talloc_stackframe(); + TALLOC_CTX *ctx = talloc_tos(); NTSTATUS status = NT_STATUS_OK; int ret; @@ -135,7 +135,6 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn, DEBUG(0,("change_dir_owner_to_parent: failed to stat parent " "directory %s. Error was %s\n", inherit_from_dir, strerror(errno) )); - TALLOC_FREE(ctx); return status; } @@ -152,7 +151,6 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn, DEBUG(0,("change_dir_owner_to_parent: failed to get " "current working directory. Error was %s\n", strerror(errno))); - TALLOC_FREE(ctx); return status; } @@ -202,7 +200,6 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn, out: - TALLOC_FREE(ctx); vfs_ChDir(conn,saved_dir); return status; } @@ -2707,7 +2704,6 @@ NTSTATUS create_file(connection_struct *conn, int *pinfo, SMB_STRUCT_STAT *psbuf) { - TALLOC_CTX *frame = talloc_stackframe(); struct case_semantics_state *case_state = NULL; SMB_STRUCT_STAT sbuf; int info = FILE_WAS_OPENED; @@ -2918,7 +2914,6 @@ NTSTATUS create_file(connection_struct *conn, if (psbuf != NULL) { *psbuf = sbuf; } - TALLOC_FREE(frame); return NT_STATUS_OK; fail: @@ -2928,6 +2923,5 @@ NTSTATUS create_file(connection_struct *conn, close_file(fsp, ERROR_CLOSE); fsp = NULL; } - TALLOC_FREE(frame); return status; } diff --git a/source3/smbd/process.c b/source3/smbd/process.c index fe32d57ff7..2d3cf7fbd8 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2071,7 +2071,7 @@ void smbd_process(void) char *inbuf; size_t inbuf_len; bool encrypted = false; - TALLOC_CTX *frame = talloc_stackframe(); + TALLOC_CTX *frame = talloc_stackframe_pool(8192); errno = 0; diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 65fc818144..2588a66b8b 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -357,7 +357,6 @@ void load_registry_shares(void) int find_service(fstring service) { int iService; - TALLOC_CTX *frame = talloc_stackframe(); all_string_sub(service,"\\","/",0); @@ -463,8 +462,6 @@ int find_service(fstring service) if (iService < 0) DEBUG(3,("find_service() failed to find service %s\n", service)); - TALLOC_FREE(frame); - return (iService); } @@ -1150,20 +1147,17 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, #if SOFTLINK_OPTIMISATION /* resolve any soft links early if possible */ if (vfs_ChDir(conn,conn->connectpath) == 0) { - TALLOC_CTX *ctx = talloc_stackframe(); + TALLOC_CTX *ctx = talloc_tos(); char *s = vfs_GetWd(ctx,s); if (!s) { *status = map_nt_error_from_unix(errno); - TALLOC_FREE(ctx); goto err_root_exit; } if (!set_conn_connectpath(conn,s)) { *status = NT_STATUS_NO_MEMORY; - TALLOC_FREE(ctx); goto err_root_exit; } vfs_ChDir(conn,conn->connectpath); - TALLOC_FREE(ctx); } #endif diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 485513c734..ce0b239c4e 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -297,9 +297,8 @@ static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp, if (!lp_ea_support(SNUM(conn))) { return 0; } - mem_ctx = talloc_init("estimate_ea_size"); + mem_ctx = talloc_tos(); (void)get_ea_list_from_file(mem_ctx, conn, fsp, fname, &total_ea_len); - talloc_destroy(mem_ctx); return total_ea_len; } @@ -310,7 +309,7 @@ static unsigned int estimate_ea_size(connection_struct *conn, files_struct *fsp, static void canonicalize_ea_name(connection_struct *conn, files_struct *fsp, const char *fname, fstring unix_ea_name) { size_t total_ea_len; - TALLOC_CTX *mem_ctx = talloc_init("canonicalize_ea_name"); + TALLOC_CTX *mem_ctx = talloc_tos(); struct ea_list *ea_list = get_ea_list_from_file(mem_ctx, conn, fsp, fname, &total_ea_len); for (; ea_list; ea_list = ea_list->next) { @@ -321,7 +320,6 @@ static void canonicalize_ea_name(connection_struct *conn, files_struct *fsp, con break; } } - talloc_destroy(mem_ctx); } /**************************************************************************** @@ -1955,9 +1953,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd out_of_space = True; finished = False; } else { - TALLOC_CTX *sub_ctx = talloc_stackframe(); - - finished = !get_lanman2_dir_entry(sub_ctx, + finished = !get_lanman2_dir_entry(ctx, conn, req->flags2, mask,dirtype,info_level, @@ -1966,8 +1962,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd space_remaining, &out_of_space, &got_exact_match, &last_entry_off, ea_list); - - TALLOC_FREE(sub_ctx); } if (finished && out_of_space) @@ -2303,9 +2297,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd out_of_space = True; finished = False; } else { - TALLOC_CTX *sub_ctx = talloc_stackframe(); - - finished = !get_lanman2_dir_entry(sub_ctx, + finished = !get_lanman2_dir_entry(ctx, conn, req->flags2, mask,dirtype,info_level, @@ -2314,8 +2306,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd space_remaining, &out_of_space, &got_exact_match, &last_entry_off, ea_list); - - TALLOC_FREE(sub_ctx); } if (finished && out_of_space) @@ -4759,17 +4749,12 @@ static NTSTATUS smb_info_set_ea(connection_struct *conn, return NT_STATUS_INVALID_PARAMETER; } - ctx = talloc_init("SMB_INFO_SET_EA"); - if (!ctx) { - return NT_STATUS_NO_MEMORY; - } + ctx = talloc_tos(); ea_list = read_ea_list(ctx, pdata + 4, total_data - 4); if (!ea_list) { - talloc_destroy(ctx); return NT_STATUS_INVALID_PARAMETER; } status = set_ea(conn, fsp, fname, ea_list); - talloc_destroy(ctx); return status; } diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 9a5e0aff60..bb4e77ed31 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -869,14 +869,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname) return map_nt_error_from_unix(errno); case ENOENT: { - TALLOC_CTX *tmp_ctx = talloc_stackframe(); + TALLOC_CTX *ctx = talloc_tos(); char *tmp_fname = NULL; char *last_component = NULL; /* Last component didn't exist. Remove it and try and canonicalise the directory. */ - tmp_fname = talloc_strdup(tmp_ctx, fname); + tmp_fname = talloc_strdup(ctx, fname); if (!tmp_fname) { - TALLOC_FREE(tmp_ctx); return NT_STATUS_NO_MEMORY; } p = strrchr_m(tmp_fname, '/'); @@ -885,10 +884,9 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname) last_component = p; } else { last_component = tmp_fname; - tmp_fname = talloc_strdup(tmp_ctx, + tmp_fname = talloc_strdup(ctx, "."); if (!tmp_fname) { - TALLOC_FREE(tmp_ctx); return NT_STATUS_NO_MEMORY; } } @@ -900,15 +898,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname) #endif if (!resolved_name) { DEBUG(3,("reduce_name: couldn't get realpath for %s\n", fname)); - TALLOC_FREE(tmp_ctx); return map_nt_error_from_unix(errno); } - tmp_fname = talloc_asprintf(tmp_ctx, + tmp_fname = talloc_asprintf(ctx, "%s/%s", resolved_name, last_component); if (!tmp_fname) { - TALLOC_FREE(tmp_ctx); return NT_STATUS_NO_MEMORY; } #ifdef REALPATH_TAKES_NULL @@ -922,7 +918,6 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname) safe_strcpy(resolved_name_buf, tmp_fname, PATH_MAX); resolved_name = resolved_name_buf; #endif - TALLOC_FREE(tmp_ctx); break; } default: -- cgit From 980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 9 Jan 2008 17:32:26 -0800 Subject: Fixup hot paths - add macro for toupper (c < 0x80). This now matches 3.0.x on my micro-tests. Jeremy. (This used to be commit 329b924cba8225002ca40db26c45b31d141a0925) --- source3/include/smb_macros.h | 8 ++++++++ source3/lib/charcnv.c | 18 ++++++++++++------ source3/lib/util_str.c | 21 ++++++++++++++++----- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 3324f3fc02..463a2bdb0b 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -385,4 +385,12 @@ do { \ #define ISDOTDOT(p) (*(p) == '.' && *((p) + 1) == '.' && *((p) + 2) == '\0') #endif /* ISDOTDOT */ +#ifndef toupper_ascii_fast +/* 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[]; +#define toupper_ascii_fast(c) toupper_ascii_fast_table[(unsigned int)(c)]; +#endif + #endif /* _SMB_MACROS_H */ diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 8a00b235cc..eeff805459 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -614,10 +614,16 @@ size_t convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to, out: destlen = destlen - o_len; - if (ctx) { - ob = (char *)TALLOC_REALLOC(ctx,ob,destlen); - } else { - ob = (char *)SMB_REALLOC(ob,destlen); + /* Don't shrink unless we're reclaiming a lot of + * space. This is in the hot codepath and these + * reallocs *cost*. JRA. + */ + if (o_len > 1024) { + if (ctx) { + ob = (char *)TALLOC_REALLOC(ctx,ob,destlen); + } else { + ob = (char *)SMB_REALLOC(ob,destlen); + } } if (destlen && !ob) { @@ -778,7 +784,7 @@ char *strdup_upper(const char *s) while (*p) { if (*p & 0x80) break; - *q++ = toupper_ascii(*p); + *q++ = toupper_ascii_fast(*p); p++; } @@ -844,7 +850,7 @@ char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s) while (*p) { if (*p & 0x80) break; - *q++ = toupper_ascii(*p); + *q++ = toupper_ascii_fast(*p); p++; } diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 7e21fe1195..3e3268104c 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -24,6 +24,17 @@ #include "includes.h" +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, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f +}; + /** * @file * @brief String utilities. @@ -187,8 +198,8 @@ int StrCaseCmp(const char *s, const char *t) * from here on in */ break; - us = toupper_ascii(*ps); - ut = toupper_ascii(*pt); + us = toupper_ascii_fast(*ps); + ut = toupper_ascii_fast(*pt); if (us == ut) continue; else if (us < ut) @@ -246,8 +257,8 @@ int StrnCaseCmp(const char *s, const char *t, size_t len) * hard way from here on in */ break; - us = toupper_ascii(*ps); - ut = toupper_ascii(*pt); + us = toupper_ascii_fast(*ps); + ut = toupper_ascii_fast(*pt); if (us == ut) continue; else if (us < ut) @@ -1679,7 +1690,7 @@ void strupper_m(char *s) (ie. they match for the first 128 chars) */ while (*s && !(((unsigned char)s[0]) & 0x80)) { - *s = toupper_ascii((unsigned char)*s); + *s = toupper_ascii_fast((unsigned char)*s); s++; } -- cgit From 7579e08599dd2139617da5639144700774233c08 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 10 Jan 2008 09:53:51 +0100 Subject: Form a proper hierarchy in talloc_stack This way talloc_stackframe() can benefit from a pool put on the stack further up. No need to remove talloc_stackframe(). (This used to be commit be6fe381168321ae62e079cd977cbef675c532d4) --- source3/lib/talloc_stack.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source3/lib/talloc_stack.c b/source3/lib/talloc_stack.c index 08ef2281ea..2722fb9676 100644 --- a/source3/lib/talloc_stack.c +++ b/source3/lib/talloc_stack.c @@ -66,7 +66,7 @@ static int talloc_pop(TALLOC_CTX *frame) static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize) { - TALLOC_CTX **tmp, *top; + TALLOC_CTX **tmp, *top, *parent; if (talloc_stack_arraysize < talloc_stacksize + 1) { tmp = TALLOC_REALLOC_ARRAY(NULL, talloc_stack, TALLOC_CTX *, @@ -78,10 +78,17 @@ static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize) talloc_stack_arraysize = talloc_stacksize + 1; } + if (talloc_stacksize == 0) { + parent = talloc_stack; + } + else { + parent = talloc_stack[talloc_stacksize-1]; + } + if (poolsize) { - top = talloc_pool(talloc_stack, poolsize); + top = talloc_pool(parent, poolsize); } else { - top = talloc_new(talloc_stack); + top = talloc_new(parent); } if (top == NULL) { -- cgit From e8909e284040b0a3fd55e3abe33ad57c94e20b7d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 10 Jan 2008 10:55:20 +0100 Subject: Fix suspicious Makefile line If @WINBIND_KRB5_LOCATOR@ is not defined, this leads to a line with just one tab in. (This used to be commit af07adaf4293899fcbded666289ffa7479ca0501) --- source3/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index a3a7e5628f..71150df7a3 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1046,8 +1046,8 @@ replacetort : SHOWFLAGS bin/replacetort@EXEEXT@ timelimit : SHOWFLAGS bin/timelimit@EXEEXT@ nsswitch : SHOWFLAGS bin/winbindd@EXEEXT@ bin/wbinfo@EXEEXT@ @WINBIND_NSS@ \ - @WINBIND_WINS_NSS@ bin/pam_winbind.@SHLIBEXT@ bin/smbcontrol@EXEEXT@ \ - @WINBIND_KRB5_LOCATOR@ + @WINBIND_WINS_NSS@ @WINBIND_KRB5_LOCATOR@ \ + bin/pam_winbind.@SHLIBEXT@ bin/smbcontrol@EXEEXT@ wins : SHOWFLAGS @WINBIND_WINS_NSS@ -- cgit From 4803cc5d3ce7db872bd21f6a1232f7cabc46186e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 10 Jan 2008 11:34:07 +0100 Subject: Mark talloc_pool memory for valgrind (This used to be commit d89e42f1d2faa018c584025296d6be8195cbcf20) --- source3/lib/talloc/talloc.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c index 178bbb97e4..ea4480286e 100644 --- a/source3/lib/talloc/talloc.c +++ b/source3/lib/talloc/talloc.c @@ -245,6 +245,7 @@ static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent, struct talloc_chunk *pool_ctx = NULL; size_t space_left; struct talloc_chunk *result; + size_t chunk_size; if (parent == NULL) { return NULL; @@ -267,15 +268,19 @@ static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent, /* * Align size to 16 bytes */ - size = ((size + 15) & ~15); + chunk_size = ((size + 15) & ~15); - if (space_left < size) { + if (space_left < chunk_size) { return NULL; } result = (struct talloc_chunk *)pool_ctx->pool; - pool_ctx->pool = (void *)((char *)result + size); +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED) + VALGRIND_MAKE_MEM_UNDEFINED(result, size); +#endif + + pool_ctx->pool = (void *)((char *)result + chunk_size); result->flags = TALLOC_MAGIC | TALLOC_FLAG_POOLMEM; result->pool = pool_ctx; @@ -358,6 +363,10 @@ void *talloc_pool(const void *context, size_t size) *talloc_pool_objectcount(tc) = 1; +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS) + VALGRIND_MAKE_MEM_NOACCESS(tc->pool, size); +#endif + return result; } @@ -859,6 +868,10 @@ void talloc_free_children(void *ptr) if (tc->flags & TALLOC_FLAG_POOL) { tc->pool = ((char *)tc + TC_HDR_SIZE + TALLOC_POOL_HDR_SIZE); +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS) + VALGRIND_MAKE_MEM_NOACCESS( + tc->pool, tc->size - TALLOC_POOL_HDR_SIZE); +#endif } } -- cgit From 97a50593fe86456a72762ba4a768614de23c3f14 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 10 Jan 2008 11:35:17 +0100 Subject: talloc_free_children can only reset pool if it's empty (This used to be commit 0272b46515b4c4515d5cad8e86fab61d8e91e29e) --- source3/lib/talloc/talloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c index ea4480286e..8683e361a6 100644 --- a/source3/lib/talloc/talloc.c +++ b/source3/lib/talloc/talloc.c @@ -866,7 +866,8 @@ void talloc_free_children(void *ptr) } } - if (tc->flags & TALLOC_FLAG_POOL) { + if ((tc->flags & TALLOC_FLAG_POOL) + && (*talloc_pool_objectcount(tc) == 1)) { tc->pool = ((char *)tc + TC_HDR_SIZE + TALLOC_POOL_HDR_SIZE); #if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS) VALGRIND_MAKE_MEM_NOACCESS( -- cgit From 138954e70e18e53f1ae81bad4641380bc8ab3bd3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 10 Jan 2008 11:35:40 +0100 Subject: Fix a c++ warning (This used to be commit ee905a085fff5410d02c3e5fa2664e989de4afd4) --- source3/lib/talloc/talloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c index 8683e361a6..9dcd8a2a83 100644 --- a/source3/lib/talloc/talloc.c +++ b/source3/lib/talloc/talloc.c @@ -968,7 +968,8 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n if (tc->flags & TALLOC_FLAG_POOLMEM) { new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE); - *talloc_pool_objectcount(tc->pool) -= 1; + *talloc_pool_objectcount((struct talloc_chunk *) + (tc->pool)) -= 1; if (new_ptr == NULL) { new_ptr = malloc(TC_HDR_SIZE+size); -- cgit From 83b1751615ef3892d44c7826228fbb3b0826d2b2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 10 Jan 2008 11:13:23 +0100 Subject: Remove unused string. Guenther (This used to be commit 88d6683872f4bb9c3074280f385f73c7af9de784) --- examples/libsmbclient/Makefile | 4 ++-- source3/utils/net_ads.c | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index be383aea67..6500707e75 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -5,7 +5,7 @@ SAMBA_INCL = ../../source/include EXTLIB_INCL = -I/usr/include/gtk-1.2 \ -I/usr/include/glib-1.2 \ -I/usr/lib/glib/include - +EXTLIB_INCL = `gtk-config --cflags` DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS) @@ -13,7 +13,7 @@ CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS) LDFLAGS = -L/usr/local/samba/lib \ -lldap -lkrb5 -lgssapi_krb5 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so -LIBSMBCLIENT = ../../source/bin/libsmbclient.a -ldl -lresolv +LIBSMBCLIENT = -lsmbclient -ldl -lresolv TESTS= testsmbc \ testacl \ diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index 310af82beb..80f6ba9001 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -1446,7 +1446,6 @@ int net_ads_join(int argc, const char **argv) ADS_STRUCT *ads = NULL; ADS_STATUS status; NTSTATUS nt_status; - char *machine_account = NULL; char *short_domain_name = NULL; char *tmp_password, *password; TALLOC_CTX *ctx = NULL; @@ -1684,7 +1683,6 @@ int net_ads_join(int argc, const char **argv) d_printf("Joined '%s' to realm '%s'\n", global_myname(), ads->server.realm); - SAFE_FREE(machine_account); TALLOC_FREE( ctx ); ads_destroy(&ads); @@ -1694,7 +1692,6 @@ fail: /* issue an overall failure message at the end. */ d_printf("Failed to join domain: %s\n", get_friendly_nt_error_msg(nt_status)); - SAFE_FREE(machine_account); TALLOC_FREE( ctx ); ads_destroy(&ads); -- cgit From 3cc3b9e1879d3d9714ac2914364418a140e8389c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 6 Jan 2008 14:21:25 +0100 Subject: use talloc_tos in a few more places (This used to be commit 65dd869bea351010c67f02046ae4134bdada1a4c) --- source3/locking/locking.c | 4 ++-- source3/smbd/close.c | 4 ++-- source3/smbd/connection.c | 2 +- source3/smbd/open.c | 8 ++++---- source3/smbd/oplock.c | 6 +++--- source3/smbd/reply.c | 8 +++++--- source3/smbd/trans2.c | 2 +- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 2ec8cd2938..ce7ba8fa66 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -925,7 +925,7 @@ bool get_delete_on_close_flag(struct file_id id) bool result; struct share_mode_lock *lck; - if (!(lck = fetch_share_mode_unlocked(NULL, id, NULL, NULL))) { + if (!(lck = fetch_share_mode_unlocked(talloc_tos(), id, NULL, NULL))) { return False; } result = lck->delete_on_close; @@ -1328,7 +1328,7 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close, UNIX_USER_TOKE return True; } - lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL); if (lck == NULL) { return False; } diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 5d30e467d0..c74e13348e 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -176,7 +176,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, * This prevents race conditions with the file being created. JRA. */ - lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL); if (lck == NULL) { DEBUG(0, ("close_remove_share_mode: Could not get share mode " @@ -441,7 +441,7 @@ static NTSTATUS close_directory(files_struct *fsp, enum file_close_type close_ty * reference to a directory also. */ - lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL); if (lck == NULL) { DEBUG(0, ("close_directory: Could not get share mode lock for %s\n", fsp->fsp_name)); diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 95e45a6990..016c8adb1b 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -132,7 +132,7 @@ bool claim_connection(connection_struct *conn, const char *name, DEBUG(5,("claiming [%s]\n", name)); - if (!(rec = connections_fetch_entry(NULL, conn, name))) { + if (!(rec = connections_fetch_entry(talloc_tos(), conn, name))) { DEBUG(0, ("connections_fetch_entry failed\n")); return False; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 037ab633e3..59699dfbd0 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1221,7 +1221,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, request_time = pml->request_time; /* Remove the deferred open entry under lock. */ - lck = get_share_mode_lock(NULL, state->id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), state->id, NULL, NULL); if (lck == NULL) { DEBUG(0, ("could not get share mode lock\n")); } else { @@ -1451,7 +1451,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, if (file_existed) { id = vfs_file_id_from_sbuf(conn, psbuf); - lck = get_share_mode_lock(NULL, id, + lck = get_share_mode_lock(talloc_tos(), id, conn->connectpath, fname); @@ -1678,7 +1678,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, id = fsp->file_id; - lck = get_share_mode_lock(NULL, id, + lck = get_share_mode_lock(talloc_tos(), id, conn->connectpath, fname); @@ -2212,7 +2212,7 @@ NTSTATUS open_directory(connection_struct *conn, string_set(&fsp->fsp_name,fname); - lck = get_share_mode_lock(NULL, fsp->file_id, + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, conn->connectpath, fname); diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 277e07c178..420aa94fe6 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -181,7 +181,7 @@ bool remove_oplock(files_struct *fsp) struct share_mode_lock *lck; /* Remove the oplock flag from the sharemode. */ - lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL); if (lck == NULL) { DEBUG(0,("remove_oplock: failed to lock share entry for " "file %s\n", fsp->fsp_name )); @@ -206,7 +206,7 @@ bool downgrade_oplock(files_struct *fsp) bool ret; struct share_mode_lock *lck; - lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL); if (lck == NULL) { DEBUG(0,("downgrade_oplock: failed to lock share entry for " "file %s\n", fsp->fsp_name )); @@ -757,7 +757,7 @@ void release_level_2_oplocks_on_change(files_struct *fsp) if (!LEVEL_II_OPLOCK_TYPE(fsp->oplock_type)) return; - lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL); if (lck == NULL) { DEBUG(0,("release_level_2_oplocks_on_change: failed to lock " "share mode entry for file %s.\n", fsp->fsp_name )); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index a796a3193b..79c0176e64 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -592,7 +592,8 @@ void reply_tcon_and_X(struct smb_request *req) } if (global_encrypted_passwords_negotiated) { - password = data_blob(smb_buf(req->inbuf),passlen); + password = data_blob_talloc(talloc_tos(), smb_buf(req->inbuf), + passlen); if (lp_security() == SEC_SHARE) { /* * Security = share always has a pad byte @@ -603,7 +604,8 @@ void reply_tcon_and_X(struct smb_request *req) p = smb_buf(req->inbuf) + passlen; } } else { - password = data_blob(smb_buf(req->inbuf),passlen+1); + password = data_blob_talloc(talloc_tos(), smb_buf(req->inbuf), + passlen+1); /* Ensure correct termination */ password.data[passlen]=0; p = smb_buf(req->inbuf) + passlen + 1; @@ -5508,7 +5510,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, return NT_STATUS_ACCESS_DENIED; } - lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL); /* * We have the file open ourselves, so not being able to get the diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index ce0b239c4e..bf6802f2a6 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -6193,7 +6193,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn, * non-POSIX opens return SHARING_VIOLATION. */ - lck = get_share_mode_lock(NULL, fsp->file_id, NULL, NULL); + lck = get_share_mode_lock(talloc_tos(), fsp->file_id, NULL, NULL); if (lck == NULL) { DEBUG(0, ("smb_posix_unlink: Could not get share mode " "lock for file %s\n", fsp->fsp_name)); -- cgit From 5ddb2abf7611a93960056075ea56f992329c3678 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 6 Jan 2008 16:15:45 +0100 Subject: Some more talloc_tos() (This used to be commit 444e35e7df1f13fc285183da8fb41b30ad99a3fa) --- source3/locking/locking.c | 14 +++++++------- source3/rpc_server/srv_srvsvc_nt.c | 2 +- source3/smbd/blocking.c | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index ce7ba8fa66..113b994bc7 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -102,7 +102,7 @@ bool is_locked(files_struct *fsp, DEBUG(10,("is_locked: optimisation - level II oplock on file %s\n", fsp->fsp_name )); ret = False; } else { - struct byte_range_lock *br_lck = brl_get_locks_readonly(NULL, fsp); + struct byte_range_lock *br_lck = brl_get_locks_readonly(talloc_tos(), fsp); if (!br_lck) { return False; } @@ -116,7 +116,7 @@ bool is_locked(files_struct *fsp, TALLOC_FREE(br_lck); } } else { - struct byte_range_lock *br_lck = brl_get_locks_readonly(NULL, fsp); + struct byte_range_lock *br_lck = brl_get_locks_readonly(talloc_tos(), fsp); if (!br_lck) { return False; } @@ -160,7 +160,7 @@ NTSTATUS query_lock(files_struct *fsp, return NT_STATUS_OK; } - br_lck = brl_get_locks_readonly(NULL, fsp); + br_lck = brl_get_locks_readonly(talloc_tos(), fsp); if (!br_lck) { return NT_STATUS_NO_MEMORY; } @@ -210,7 +210,7 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx, lock_flav_name(lock_flav), lock_type_name(lock_type), (double)offset, (double)count, fsp->fnum, fsp->fsp_name )); - br_lck = brl_get_locks(NULL, fsp); + br_lck = brl_get_locks(talloc_tos(), fsp); if (!br_lck) { *perr = NT_STATUS_NO_MEMORY; return NULL; @@ -269,7 +269,7 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx, DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for fnum %d file %s\n", (double)offset, (double)count, fsp->fnum, fsp->fsp_name )); - br_lck = brl_get_locks(NULL, fsp); + br_lck = brl_get_locks(talloc_tos(), fsp); if (!br_lck) { return NT_STATUS_NO_MEMORY; } @@ -323,7 +323,7 @@ NTSTATUS do_lock_cancel(files_struct *fsp, DEBUG(10,("do_lock_cancel: cancel start=%.0f len=%.0f requested for fnum %d file %s\n", (double)offset, (double)count, fsp->fnum, fsp->fsp_name )); - br_lck = brl_get_locks(NULL, fsp); + br_lck = brl_get_locks(talloc_tos(), fsp); if (!br_lck) { return NT_STATUS_NO_MEMORY; } @@ -372,7 +372,7 @@ void locking_close_file(struct messaging_context *msg_ctx, return; } - br_lck = brl_get_locks(NULL,fsp); + br_lck = brl_get_locks(talloc_tos(),fsp); if (br_lck) { cancel_pending_lock_requests_by_fid(fsp, br_lck); diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 01e5cf2cda..1b877ee5b4 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -167,7 +167,7 @@ static void enum_file_fn( const struct share_mode_entry *e, ZERO_STRUCT( fsp ); fsp.file_id = e->id; - if ( (brl = brl_get_locks(NULL,&fsp)) != NULL ) { + if ( (brl = brl_get_locks(talloc_tos(), &fsp)) != NULL ) { num_locks = brl->num_locks; TALLOC_FREE(brl); } diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 4e0d5289f8..479361a8c1 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -625,7 +625,7 @@ void remove_pending_lock_requests_by_mid(int mid) next = blr->next; if(SVAL(blr->inbuf,smb_mid) == mid) { files_struct *fsp = blr->fsp; - struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp); + struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp); if (br_lck) { DEBUG(10,("remove_pending_lock_requests_by_mid - removing request type %d for \ @@ -715,7 +715,7 @@ static void process_blocking_lock_queue(void) fsp->fnum, fsp->fsp_name )); if(!change_to_user(conn,vuid)) { - struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp); + struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp); /* * Remove the entry and return an error to the client. @@ -741,7 +741,7 @@ static void process_blocking_lock_queue(void) } if(!set_current_service(conn,SVAL(blr->inbuf,smb_flg),True)) { - struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp); + struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp); /* * Remove the entry and return an error to the client. @@ -773,7 +773,7 @@ static void process_blocking_lock_queue(void) */ if(blocking_lock_record_process(blr)) { - struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp); + struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp); if (br_lck) { brl_lock_cancel(br_lck, @@ -800,7 +800,7 @@ static void process_blocking_lock_queue(void) */ if (!timeval_is_zero(&blr->expire_time) && timeval_compare(&blr->expire_time, &tv_curr) <= 0) { - struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp); + struct byte_range_lock *br_lck = brl_get_locks(talloc_tos(), fsp); /* * Lock expired - throw away all previously -- cgit From 9f67ee6334f36f30ddfc2e86459cb764bccf1edf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 6 Jan 2008 14:17:15 +0100 Subject: use talloc_tos() in share_access_check() (This used to be commit ac2bb838d537ca563ad2fe770b3e1c2fe8b1d9e7) --- source3/lib/sharesec.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index ba025dacc1..f6ff701d5b 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -228,25 +228,20 @@ bool share_access_check(const NT_USER_TOKEN *token, const char *sharename, { uint32 granted; NTSTATUS status; - TALLOC_CTX *mem_ctx = NULL; SEC_DESC *psd = NULL; size_t sd_size; bool ret = True; - if (!(mem_ctx = talloc_init("share_access_check"))) { - return False; - } - - psd = get_share_security(mem_ctx, sharename, &sd_size); + psd = get_share_security(talloc_tos(), sharename, &sd_size); if (!psd) { - TALLOC_FREE(mem_ctx); return True; } ret = se_access_check(psd, token, desired_access, &granted, &status); - talloc_destroy(mem_ctx); + TALLOC_FREE(psd); + return ret; } -- cgit From 5661ac6a389620ac543a384832de9ee9b64893c7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 13:30:43 +0100 Subject: Correctly abstract the transfer_file mechanism with callbacks and void ptrs. This removes the in_fsp and out_fsp global variables hack from smbd/vfs.c. Michael (This used to be commit b2e7cdc6e899ca3c16edbb6c8786ff9aa999fa6e) --- source3/lib/util.c | 28 +++++++++++++++++++++++----- source3/smbd/vfs.c | 20 +++++++++----------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/source3/lib/util.c b/source3/lib/util.c index 25b2700ae3..3509294e8e 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -905,8 +905,12 @@ int set_blocking(int fd, bool set) #define TRANSFER_BUF_SIZE 65536 #endif -ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn)(int, void *, size_t), - ssize_t (*write_fn)(int, const void *, size_t)) + +ssize_t transfer_file_internal(void *in_file, + void *out_file, + size_t n, + ssize_t (*read_fn)(void *, void *, size_t), + ssize_t (*write_fn)(void *, void *, size_t)) { char *buf; size_t total = 0; @@ -921,7 +925,7 @@ ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn) while (total < n) { num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE); - read_ret = (*read_fn)(infd, buf, num_to_read_thistime); + read_ret = (*read_fn)(in_file, buf, num_to_read_thistime); if (read_ret == -1) { DEBUG(0,("transfer_file_internal: read failure. Error = %s\n", strerror(errno) )); SAFE_FREE(buf); @@ -933,7 +937,7 @@ ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn) num_written = 0; while (num_written < read_ret) { - write_ret = (*write_fn)(outfd,buf + num_written, read_ret - num_written); + write_ret = (*write_fn)(out_file, buf + num_written, read_ret - num_written); if (write_ret == -1) { DEBUG(0,("transfer_file_internal: write failure. Error = %s\n", strerror(errno) )); @@ -953,9 +957,23 @@ ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn) return (ssize_t)total; } +static ssize_t sys_read_fn(void *file, void *buf, size_t len) +{ + int *fd = (int *)file; + + return sys_read(*fd, buf, len); +} + +static ssize_t sys_write_fn(void *file, void *buf, size_t len) +{ + int *fd = (int *)file; + + return sys_read(*fd, buf, len); +} + SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n) { - return (SMB_OFF_T)transfer_file_internal(infd, outfd, (size_t)n, sys_read, sys_write); + return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, sys_read_fn, sys_write_fn); } /******************************************************************* diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index bb4e77ed31..b6b6b1c0f1 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -662,25 +662,23 @@ int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len) Transfer some data (n bytes) between two file_struct's. ****************************************************************************/ -static files_struct *in_fsp; -static files_struct *out_fsp; - -static ssize_t read_fn(int fd, void *buf, size_t len) +static ssize_t vfs_read_fn(void *file, void *buf, size_t len) { - return SMB_VFS_READ(in_fsp, fd, buf, len); + struct files_struct *fsp = (struct files_struct *)file; + + return SMB_VFS_READ(fsp, fsp->fh->fd, buf, len); } -static ssize_t write_fn(int fd, const void *buf, size_t len) +static ssize_t vfs_write_fn(void *file, const void *buf, size_t len) { - return SMB_VFS_WRITE(out_fsp, fd, buf, len); + struct files_struct *fsp = (struct files_struct *)file; + + return SMB_VFS_WRITE(fsp, fsp->fh->fd, buf, len); } SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n) { - in_fsp = in; - out_fsp = out; - - return transfer_file_internal(in_fsp->fh->fd, out_fsp->fh->fd, n, read_fn, write_fn); + return transfer_file_internal(in, out, n, vfs_read_fn, vfs_write_fn); } /******************************************************************* -- cgit From 9f6d0479d795ca4f8d91a3e170f66e29cf16a16b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 14:18:46 +0100 Subject: Fix a really silly typo. Michael (This used to be commit 7b0af7cdc97d4bbcbd73a9474871217511b92c3a) --- source3/lib/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/util.c b/source3/lib/util.c index 3509294e8e..d635078f37 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -968,7 +968,7 @@ static ssize_t sys_write_fn(void *file, void *buf, size_t len) { int *fd = (int *)file; - return sys_read(*fd, buf, len); + return sys_write(*fd, buf, len); } SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n) -- cgit From 10da70325b899bfbebf5a6eeef69838fe9d346bb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 13:55:16 +0100 Subject: Make casts to (void *) explicit to remove compiler warnings. Michael (This used to be commit cbbfbd7a63fe0fc479a1b63b4552c713633dd6be) --- source3/smbd/vfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index b6b6b1c0f1..a57dcddade 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -678,7 +678,8 @@ static ssize_t vfs_write_fn(void *file, const void *buf, size_t len) SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n) { - return transfer_file_internal(in, out, n, vfs_read_fn, vfs_write_fn); + return transfer_file_internal((void *)in, (void *)out, n, + vfs_read_fn, vfs_write_fn); } /******************************************************************* -- cgit From 386caead47e97b9fdc991b713cb597f1a1c4a365 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 13:55:46 +0100 Subject: Reformat some code I just touched. Michael (This used to be commit 4ed238b1e46f7680a29ebdbfe9500d16718f9057) --- source3/lib/util.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/source3/lib/util.c b/source3/lib/util.c index d635078f37..44eaa85ab0 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -919,34 +919,41 @@ ssize_t transfer_file_internal(void *in_file, size_t num_to_read_thistime; size_t num_written = 0; - if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL) + if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL) { return -1; + } while (total < n) { num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE); read_ret = (*read_fn)(in_file, buf, num_to_read_thistime); if (read_ret == -1) { - DEBUG(0,("transfer_file_internal: read failure. Error = %s\n", strerror(errno) )); + DEBUG(0,("transfer_file_internal: read failure. " + "Error = %s\n", strerror(errno) )); SAFE_FREE(buf); return -1; } - if (read_ret == 0) + if (read_ret == 0) { break; + } num_written = 0; - + while (num_written < read_ret) { - write_ret = (*write_fn)(out_file, buf + num_written, read_ret - num_written); - + write_ret = (*write_fn)(out_file, buf + num_written, + read_ret - num_written); + if (write_ret == -1) { - DEBUG(0,("transfer_file_internal: write failure. Error = %s\n", strerror(errno) )); + DEBUG(0,("transfer_file_internal: " + "write failure. Error = %s\n", + strerror(errno) )); SAFE_FREE(buf); return -1; } - if (write_ret == 0) + if (write_ret == 0) { return (ssize_t)total; - + } + num_written += (size_t)write_ret; } @@ -954,7 +961,7 @@ ssize_t transfer_file_internal(void *in_file, } SAFE_FREE(buf); - return (ssize_t)total; + return (ssize_t)total; } static ssize_t sys_read_fn(void *file, void *buf, size_t len) @@ -971,9 +978,10 @@ static ssize_t sys_write_fn(void *file, void *buf, size_t len) return sys_write(*fd, buf, len); } -SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n) +SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n) { - return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, sys_read_fn, sys_write_fn); + return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, + sys_read_fn, sys_write_fn); } /******************************************************************* -- cgit From ba2a2552822ded95358c11972005f2c353580439 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 14:27:52 +0100 Subject: Move transfer_file and transfer_file_internal to a module of their own. Also, don't auto-generate prototypes of the (two) exported functions but make a start in having handwritten prototypes in dedicated header files (not in includes.h ... :-) Michael (This used to be commit 395f29d8b768a56af20b37f185eccdc5f37b68d5) --- source3/Makefile.in | 3 +- source3/include/includes.h | 3 ++ source3/include/transfer_file.h | 32 ++++++++++++ source3/lib/util.c | 87 ------------------------------- source3/lib/util_transfer_file.c | 110 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 147 insertions(+), 88 deletions(-) create mode 100644 source3/include/transfer_file.h create mode 100644 source3/lib/util_transfer_file.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 71150df7a3..94c3e7b839 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -290,7 +290,8 @@ LIBSAMBAUTIL_OBJ = $(TALLOC_OBJ) $(LIBREPLACE_OBJ) LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(NSS_WRAPPER_OBJ) $(TALLOC_OBJ) \ lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \ lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \ - lib/interfaces.o lib/rbtree.o lib/memcache.o + lib/interfaces.o lib/rbtree.o lib/memcache.o \ + lib/util_transfer_file.o LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/interface.o lib/md4.o \ diff --git a/source3/include/includes.h b/source3/include/includes.h index 14ef2258e6..e9477d8ba1 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -811,6 +811,9 @@ enum flush_reason_enum { #include "srvstr.h" #include "safe_string.h" +/* prototypes from lib/util_transfer_file.c */ +#include "transfer_file.h" + #ifdef __COMPAR_FN_T #define QSORT_CAST (__compar_fn_t) #endif diff --git a/source3/include/transfer_file.h b/source3/include/transfer_file.h new file mode 100644 index 0000000000..79ad9c4c34 --- /dev/null +++ b/source3/include/transfer_file.h @@ -0,0 +1,32 @@ +/* + * Unix SMB/CIFS implementation. + * Utility functions to transfer files. + * + * Copyright (C) Michael Adam 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __TRANSFER_FILE_H__ +#define __TRANSFER_FILE_H__ + +ssize_t transfer_file_internal(void *in_file, + void *out_file, + size_t n, + ssize_t (*read_fn)(void *, void *, size_t), + ssize_t (*write_fn)(void *, const void *, size_t)); + +SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n); + +#endif /* __TRANSFER_FILE_H__ */ diff --git a/source3/lib/util.c b/source3/lib/util.c index 44eaa85ab0..0653fc9d3f 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -897,93 +897,6 @@ int set_blocking(int fd, bool set) #undef FLAG_TO_SET } -/**************************************************************************** - Transfer some data between two fd's. -****************************************************************************/ - -#ifndef TRANSFER_BUF_SIZE -#define TRANSFER_BUF_SIZE 65536 -#endif - - -ssize_t transfer_file_internal(void *in_file, - void *out_file, - size_t n, - ssize_t (*read_fn)(void *, void *, size_t), - ssize_t (*write_fn)(void *, void *, size_t)) -{ - char *buf; - size_t total = 0; - ssize_t read_ret; - ssize_t write_ret; - size_t num_to_read_thistime; - size_t num_written = 0; - - if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL) { - return -1; - } - - while (total < n) { - num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE); - - read_ret = (*read_fn)(in_file, buf, num_to_read_thistime); - if (read_ret == -1) { - DEBUG(0,("transfer_file_internal: read failure. " - "Error = %s\n", strerror(errno) )); - SAFE_FREE(buf); - return -1; - } - if (read_ret == 0) { - break; - } - - num_written = 0; - - while (num_written < read_ret) { - write_ret = (*write_fn)(out_file, buf + num_written, - read_ret - num_written); - - if (write_ret == -1) { - DEBUG(0,("transfer_file_internal: " - "write failure. Error = %s\n", - strerror(errno) )); - SAFE_FREE(buf); - return -1; - } - if (write_ret == 0) { - return (ssize_t)total; - } - - num_written += (size_t)write_ret; - } - - total += (size_t)read_ret; - } - - SAFE_FREE(buf); - return (ssize_t)total; -} - -static ssize_t sys_read_fn(void *file, void *buf, size_t len) -{ - int *fd = (int *)file; - - return sys_read(*fd, buf, len); -} - -static ssize_t sys_write_fn(void *file, void *buf, size_t len) -{ - int *fd = (int *)file; - - return sys_write(*fd, buf, len); -} - -SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n) -{ - return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, - sys_read_fn, sys_write_fn); -} - /******************************************************************* Sleep for a specified number of milliseconds. ********************************************************************/ diff --git a/source3/lib/util_transfer_file.c b/source3/lib/util_transfer_file.c new file mode 100644 index 0000000000..1e3b76fc77 --- /dev/null +++ b/source3/lib/util_transfer_file.c @@ -0,0 +1,110 @@ +/* + * Unix SMB/CIFS implementation. + * Utility functions to transfer files. + * + * Copyright (C) Jeremy Allison 2001-2002 + * Copyright (C) Michael Adam 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#include + +/**************************************************************************** + Transfer some data between two fd's. +****************************************************************************/ + +#ifndef TRANSFER_BUF_SIZE +#define TRANSFER_BUF_SIZE 65536 +#endif + + +ssize_t transfer_file_internal(void *in_file, + void *out_file, + size_t n, + ssize_t (*read_fn)(void *, void *, size_t), + ssize_t (*write_fn)(void *, const void *, size_t)) +{ + char *buf; + size_t total = 0; + ssize_t read_ret; + ssize_t write_ret; + size_t num_to_read_thistime; + size_t num_written = 0; + + if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL) { + return -1; + } + + while (total < n) { + num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE); + + read_ret = (*read_fn)(in_file, buf, num_to_read_thistime); + if (read_ret == -1) { + DEBUG(0,("transfer_file_internal: read failure. " + "Error = %s\n", strerror(errno) )); + SAFE_FREE(buf); + return -1; + } + if (read_ret == 0) { + break; + } + + num_written = 0; + + while (num_written < read_ret) { + write_ret = (*write_fn)(out_file, buf + num_written, + read_ret - num_written); + + if (write_ret == -1) { + DEBUG(0,("transfer_file_internal: " + "write failure. Error = %s\n", + strerror(errno) )); + SAFE_FREE(buf); + return -1; + } + if (write_ret == 0) { + return (ssize_t)total; + } + + num_written += (size_t)write_ret; + } + + total += (size_t)read_ret; + } + + SAFE_FREE(buf); + return (ssize_t)total; +} + +static ssize_t sys_read_fn(void *file, void *buf, size_t len) +{ + int *fd = (int *)file; + + return sys_read(*fd, buf, len); +} + +static ssize_t sys_write_fn(void *file, const void *buf, size_t len) +{ + int *fd = (int *)file; + + return sys_write(*fd, buf, len); +} + +SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n) +{ + return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, + sys_read_fn, sys_write_fn); +} -- cgit From 1d66f4d58b5fdd9c4e0c022cd2724e05d144510b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 15:33:51 +0100 Subject: Remove redundant parameter fd from SMB_VFS_READ(). Michael (This used to be commit a8fc2ddad8d5f7c6c00cb36c74a32a02d69d1d04) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_cacheprime.c | 2 +- source3/modules/vfs_default.c | 10 +++++----- source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/vfs.c | 6 +++--- source3/torture/cmd_vfs.c | 2 +- 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 8c05479a62..eda1ceb1d1 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -130,9 +130,9 @@ static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) return vfswrap_close(NULL, fsp, fd); } -static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n) +static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n) { - return vfswrap_read(NULL, fsp, fd, data, n); + return vfswrap_read(NULL, fsp, data, n); } static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index f15cdfdb70..7b09e3369c 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -124,9 +124,9 @@ static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd) return SMB_VFS_NEXT_CLOSE(handle, fsp, fd); } -static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n) +static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n) { - return SMB_VFS_NEXT_READ(handle, fsp, fd, data, n); + return SMB_VFS_NEXT_READ(handle, fsp, data, n); } static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 02cfb12836..3fc7156bf4 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -99,6 +99,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from fremovexattr. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from fsetxattr. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from aio_cancel. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from read. - obnox */ @@ -290,7 +291,7 @@ struct vfs_ops { int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode); int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); - ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n); + ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n); ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n); ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 63e566b334..6d36095e84 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -48,7 +48,7 @@ /* File operations */ #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp), (fd))) -#define SMB_VFS_READ(fsp, fd, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (fd), (data), (n))) +#define SMB_VFS_READ(fsp, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (data), (n))) #define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (data), (n), (off))) @@ -167,7 +167,7 @@ /* File operations */ #define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp), (fd))) -#define SMB_VFS_OPAQUE_READ(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (fd), (data), (n))) +#define SMB_VFS_OPAQUE_READ(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (data), (n))) #define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_OPAQUE_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_OPAQUE_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (data), (n), (off))) @@ -287,7 +287,7 @@ /* File operations */ #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp), (fd))) -#define SMB_VFS_NEXT_READ(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (fd), (data), (n))) +#define SMB_VFS_NEXT_READ(handle, fsp, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (data), (n))) #define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off))) #define SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (fd), (data), (n))) #define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (data), (n), (off))) diff --git a/source3/modules/vfs_cacheprime.c b/source3/modules/vfs_cacheprime.c index 6eb74e66ed..4ac78437c3 100644 --- a/source3/modules/vfs_cacheprime.c +++ b/source3/modules/vfs_cacheprime.c @@ -154,7 +154,7 @@ static ssize_t cprime_read( SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET); } - return SMB_VFS_NEXT_READ(handle, fsp, fd, data, count); + return SMB_VFS_NEXT_READ(handle, fsp, data, count); } static ssize_t cprime_pread( diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 97138bdacf..920c05c338 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -208,12 +208,12 @@ static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp, int fd) return result; } -static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n) +static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n) { ssize_t result; START_PROFILE_BYTES(syscall_read, n); - result = sys_read(fd, data, n); + result = sys_read(fsp->fh->fd, data, n); END_PROFILE(syscall_read); return result; } @@ -230,7 +230,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void if (result == -1 && errno == ESPIPE) { /* Maintain the fiction that pipes can be seeked (sought?) on. */ - result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); + result = SMB_VFS_READ(fsp, data, n); fsp->fh->pos = 0; } @@ -241,7 +241,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); if (curr == -1 && errno == ESPIPE) { /* Maintain the fiction that pipes can be seeked (sought?) on. */ - result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); + result = SMB_VFS_READ(fsp, data, n); fsp->fh->pos = 0; return result; } @@ -251,7 +251,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void } errno = 0; - result = SMB_VFS_READ(fsp, fsp->fh->fd, data, n); + result = SMB_VFS_READ(fsp, data, n); lerrno = errno; SMB_VFS_LSEEK(fsp, curr, SEEK_SET); diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 95fdc17d56..18ee5ba50f 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -113,7 +113,7 @@ static int smb_full_audit_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode); static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd); static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp, - int fd, void *data, size_t n); + void *data, size_t n); static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp, @@ -1087,11 +1087,11 @@ static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, in } static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp, - int fd, void *data, size_t n) + void *data, size_t n) { ssize_t result; - result = SMB_VFS_NEXT_READ(handle, fsp, fd, data, n); + result = SMB_VFS_NEXT_READ(handle, fsp, data, n); do_log(SMB_VFS_OP_READ, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index a57dcddade..53a0001515 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -389,8 +389,8 @@ ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count) while (total < byte_count) { - ssize_t ret = SMB_VFS_READ(fsp, fsp->fh->fd, buf + total, - byte_count - total); + ssize_t ret = SMB_VFS_READ(fsp, buf + total, + byte_count - total); if (ret == 0) return total; if (ret == -1) { @@ -666,7 +666,7 @@ static ssize_t vfs_read_fn(void *file, void *buf, size_t len) { struct files_struct *fsp = (struct files_struct *)file; - return SMB_VFS_READ(fsp, fsp->fh->fd, buf, len); + return SMB_VFS_READ(fsp, buf, len); } static ssize_t vfs_write_fn(void *file, const void *buf, size_t len) diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index e349df6061..45da7ffa54 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -389,7 +389,7 @@ static NTSTATUS cmd_read(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c } vfs->data_size = size; - rsize = SMB_VFS_READ(vfs->files[fd], fd, vfs->data, size); + rsize = SMB_VFS_READ(vfs->files[fd], vfs->data, size); if (rsize == -1) { printf("read: error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; -- cgit From e9a3a62e7448bef72d9c17c90ff2b404082f067c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 15:49:35 +0100 Subject: Remove redundant parameter fd from SMB_VFS_WRITE(). Michael (This used to be commit c8ae7d095a2a6a7eac920a68ca7244e3a423e1b1) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_commit.c | 3 +-- source3/modules/vfs_default.c | 12 ++++++------ source3/modules/vfs_full_audit.c | 6 +++--- source3/smbd/vfs.c | 4 ++-- source3/torture/cmd_vfs.c | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index eda1ceb1d1..6b1f29b12d 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -140,9 +140,9 @@ static ssize_t skel_pread(vfs_handle_struct *handle, struct files_struct *fsp, v return vfswrap_pread(NULL, fsp, data, n, offset); } -static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) +static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n) { - return vfswrap_write(NULL, fsp, fd, data, n); + return vfswrap_write(NULL, fsp, data, n); } ssize_t skel_pwrite(vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 7b09e3369c..c168b461ba 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -134,9 +134,9 @@ static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *da return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); } -static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) +static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n) { - return SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n); + return SMB_VFS_NEXT_WRITE(handle, fsp, data, n); } static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 3fc7156bf4..8aa8057982 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -100,6 +100,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from fsetxattr. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from aio_cancel. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from read. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from write. - obnox */ @@ -293,7 +294,7 @@ struct vfs_ops { int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n); ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); - ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n); + ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n); ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset); SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence); ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 6d36095e84..48f5fcf1f4 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -50,7 +50,7 @@ #define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp), (fd))) #define SMB_VFS_READ(fsp, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (data), (n))) #define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off))) -#define SMB_VFS_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (fd), (data), (n))) +#define SMB_VFS_WRITE(fsp, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (data), (n))) #define SMB_VFS_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (offset), (whence))) #define SMB_VFS_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) @@ -169,7 +169,7 @@ #define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp), (fd))) #define SMB_VFS_OPAQUE_READ(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (data), (n))) #define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off))) -#define SMB_VFS_OPAQUE_WRITE(fsp, fd, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (fd), (data), (n))) +#define SMB_VFS_OPAQUE_WRITE(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (data), (n))) #define SMB_VFS_OPAQUE_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_OPAQUE_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (offset), (whence))) #define SMB_VFS_OPAQUE_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) @@ -289,7 +289,7 @@ #define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp), (fd))) #define SMB_VFS_NEXT_READ(handle, fsp, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (data), (n))) #define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off))) -#define SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (fd), (data), (n))) +#define SMB_VFS_NEXT_WRITE(handle, fsp, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (data), (n))) #define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (offset), (whence))) #define SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c index fe7324122f..ac391cf007 100644 --- a/source3/modules/vfs_commit.c +++ b/source3/modules/vfs_commit.c @@ -229,12 +229,11 @@ static int commit_open( static ssize_t commit_write( vfs_handle_struct * handle, files_struct * fsp, - int fd, void * data, size_t count) { ssize_t ret; - ret = SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, count); + ret = SMB_VFS_NEXT_WRITE(handle, fsp, data, count); if (ret > 0) { if (commit(handle, fsp, fsp->fh->pos, ret) == -1) { diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 920c05c338..e57d24cb1a 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -262,12 +262,12 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void return result; } -static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n) +static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n) { ssize_t result; START_PROFILE_BYTES(syscall_write, n); - result = sys_write(fd, data, n); + result = sys_write(fsp->fh->fd, data, n); END_PROFILE(syscall_write); return result; } @@ -284,7 +284,7 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons if (result == -1 && errno == ESPIPE) { /* Maintain the fiction that pipes can be sought on. */ - result = SMB_VFS_WRITE(fsp, fsp->fh->fd, data, n); + result = SMB_VFS_WRITE(fsp, data, n); } #else /* HAVE_PWRITE */ @@ -300,7 +300,7 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons return -1; } - result = SMB_VFS_WRITE(fsp, fsp->fh->fd, data, n); + result = SMB_VFS_WRITE(fsp, data, n); lerrno = errno; SMB_VFS_LSEEK(fsp, curr, SEEK_SET); @@ -712,7 +712,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs SMB_OFF_T retlen; SMB_OFF_T current_len_to_write = MIN(sizeof(zero_space),space_to_write); - retlen = SMB_VFS_WRITE(fsp,fsp->fh->fd,(char *)zero_space,current_len_to_write); + retlen = SMB_VFS_WRITE(fsp,(char *)zero_space,current_len_to_write); if (retlen <= 0) return -1; @@ -787,7 +787,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O if (SMB_VFS_LSEEK(fsp, len-1, SEEK_SET) != len -1) goto done; - if (SMB_VFS_WRITE(fsp, fsp->fh->fd, &c, 1)!=1) + if (SMB_VFS_WRITE(fsp, &c, 1)!=1) goto done; /* Seek to where we were */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 18ee5ba50f..00512678b1 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -117,7 +117,7 @@ static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp, static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp, - int fd, const void *data, size_t n); + const void *data, size_t n); static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset); @@ -1111,11 +1111,11 @@ static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp } static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp, - int fd, const void *data, size_t n) + const void *data, size_t n) { ssize_t result; - result = SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n); + result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n); do_log(SMB_VFS_OP_WRITE, (result >= 0), handle, "%s", fsp->fsp_name); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 53a0001515..1e71da742c 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -451,7 +451,7 @@ ssize_t vfs_write_data(struct smb_request *req, } while (total < N) { - ret = SMB_VFS_WRITE(fsp,fsp->fh->fd,buffer + total,N - total); + ret = SMB_VFS_WRITE(fsp, buffer + total, N - total); if (ret == -1) return -1; @@ -673,7 +673,7 @@ static ssize_t vfs_write_fn(void *file, const void *buf, size_t len) { struct files_struct *fsp = (struct files_struct *)file; - return SMB_VFS_WRITE(fsp, fsp->fh->fd, buf, len); + return SMB_VFS_WRITE(fsp, buf, len); } SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n) diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 45da7ffa54..f3b98862fe 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -422,7 +422,7 @@ static NTSTATUS cmd_write(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, return NT_STATUS_UNSUCCESSFUL; } - wsize = SMB_VFS_WRITE(vfs->files[fd], fd, vfs->data, size); + wsize = SMB_VFS_WRITE(vfs->files[fd], vfs->data, size); if (wsize == -1) { printf("write: error=%d (%s)\n", errno, strerror(errno)); -- cgit From b7d222c690a8b5e2b15b694c95015f735eff9cda Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 10 Jan 2008 13:22:51 +0100 Subject: Tiny cosmetic fix (This used to be commit c82c1d462be6ddccd6e395b4a9630df91dacbda2) --- source3/lib/dbwrap_tdb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c index 83a0d111aa..710e45de6b 100644 --- a/source3/lib/dbwrap_tdb.c +++ b/source3/lib/dbwrap_tdb.c @@ -160,8 +160,7 @@ static int db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, state.mem_ctx = mem_ctx; state.result = 0; - state.data.dptr = NULL; - state.data.dsize = 0; + state.data = tdb_null; tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state); -- cgit From 0bfa8671598dd52cd7c97e8d05c940f92df1ffd1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 Jan 2008 18:27:10 +0100 Subject: --enable-libwbclient-shared This patch adds the configure option --enable-libwbclient-shared that defaults to yes. If you set --enable-developer=yes, then you can say --enable-libwbclient-shared=no to avoid problems you might have with the wrong shared libaries. Jerry, is this acceptable to you? If yes, please push. Thanks! Volker (This used to be commit 7a88cd61e09f6db9db38916704ae65e03b33139c) --- source3/Makefile.in | 47 +++++++++++++++++++++++------------------------ source3/configure.in | 13 ++++++++++++- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 94c3e7b839..5257b6fcac 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -337,8 +337,7 @@ LIBADDNS_OBJ0 = libaddns/dnsrecord.o libaddns/dnsutils.o libaddns/dnssock.o \ libaddns/dnsgss.o libaddns/dnsmarshall.o LIBADDNS_OBJ = $(LIBADDNS_OBJ0) $(TALLOC_OBJ) -LIBWBCLIENT_OBJ = nsswitch/wb_common.o lib/talloc/talloc.o \ - nsswitch/libwbclient/wbclient.o \ +LIBWBCLIENT_OBJ = nsswitch/libwbclient/wbclient.o \ nsswitch/libwbclient/wbc_util.o \ nsswitch/libwbclient/wbc_pwd.o \ nsswitch/libwbclient/wbc_idmap.o \ @@ -573,7 +572,7 @@ SMBD_OBJ_BASE = $(PARAM_WITHOUT_REG_OBJ) $(SMBD_OBJ_SRV) $(LIBSMB_OBJ) \ $(NOTIFY_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \ $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(LIBADS_SERVER_OBJ) \ - $(REGISTRY_OBJ) $(POPT_LIB_OBJ) \ + $(REGISTRY_OBJ) $(POPT_LIB_OBJ) @LIBWBCLIENT_STATIC@ \ $(BUILDOPT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) $(LIBNET_OBJ) PRINTING_OBJ = printing/pcap.o printing/print_svid.o printing/print_aix.o \ @@ -606,7 +605,7 @@ SWAT_OBJ1 = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \ web/swat.o web/neg_lang.o SWAT_OBJ = $(SWAT_OBJ1) $(PARAM_OBJ) $(PRINTING_OBJ) $(LIBSMB_OBJ) \ - $(LOCKING_OBJ) $(PASSDB_OBJ) $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \ + $(LOCKING_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \ $(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) $(PLAINTEXT_AUTH_OBJ) \ $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \ $(PASSCHANGE_OBJ) $(LDB_OBJ) @@ -627,7 +626,7 @@ SMBTREE_OBJ = utils/smbtree.o $(PARAM_OBJ) \ $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \ rpc_client/cli_pipe.o $(RPC_PARSE_OBJ2) \ $(RPC_CLIENT_OBJ1) \ - $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) $(GROUPDB_OBJ) \ + $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(LDB_OBJ) $(GROUPDB_OBJ) \ $(LIBMSRPC_GEN_OBJ) TESTPARM_OBJ = utils/testparm.o \ @@ -637,12 +636,12 @@ TESTPARM_OBJ = utils/testparm.o \ PASSWD_UTIL_OBJ = utils/passwd_util.o SMBPASSWD_OBJ = utils/smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \ - $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \ + $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ \ $(GROUPDB_OBJ) $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \ $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) \ $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) $(LDB_OBJ) -PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) \ +PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ \ $(LIBSAMBA_OBJ) $(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) \ $(SECRETS_OBJ) $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) libsmb/asn1.o \ $(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LDB_OBJ) $(ERRORMAP_OBJ) @@ -663,7 +662,7 @@ RPCCLIENT_OBJ1 = rpcclient/rpcclient.o rpcclient/cmd_lsarpc.o \ RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \ $(PARAM_OBJ) $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) \ - $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \ + $(RPC_PARSE_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \ $(READLINE_OBJ) $(GROUPDB_OBJ) $(KRBCLIENT_OBJ) \ $(LIBADS_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) \ $(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(LDB_OBJ) @@ -676,7 +675,7 @@ LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o libsmb/libsmb_compat.o \ $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \ $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \ - $(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) + $(SECRETS_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o $(TDBBASE_OBJ) @@ -687,7 +686,7 @@ LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o $(TDBBASE_OBJ) LIBBIGBALLOFMUD_MAJOR = 0 LIBBIGBALLOFMUD_OBJ = $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) \ - $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ) \ + $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ \ $(GROUPDB_OBJ) $(KRBCLIENT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) CLIENT_OBJ1 = client/client.o client/clitar.o rpc_client/cli_pipe.o \ @@ -698,7 +697,7 @@ CLIENT_OBJ1 = client/client.o client/clitar.o rpc_client/cli_pipe.o \ CLIENT_OBJ = $(CLIENT_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \ $(READLINE_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \ - $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ + $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ $(DISPLAY_SEC_OBJ) UTIL_REG_OBJ = lib/util_reg.o @@ -734,7 +733,7 @@ LIBNETAPI_OBJ = $(LIBNETAPI_OBJ1) $(LIBNET_OBJ) \ $(PARAM_WITHOUT_REG_OBJ) $(LIB_NONSMBD_OBJ) \ $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \ - $(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ + $(SECRETS_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ $(DCUTIL_OBJ) $(LIBADS_OBJ) LIBNET_OBJ = libnet/libnet_conf.o libnet/libnet_join.o @@ -751,7 +750,7 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_domain.o utils/net_help.o \ utils/net_conf.o auth/token_util.o utils/net_dom.o nsswitch/wb_client.o NET_OBJ = $(NET_OBJ1) $(PARAM_WITHOUT_REG_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \ - $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ + $(RPC_PARSE_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \ $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(LIBADDNS_OBJ0) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \ $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) $(POPT_LIB_OBJ) \ @@ -799,7 +798,7 @@ NSSTEST_OBJ = torture/nsstest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) PDBTEST_OBJ = torture/pdbtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ - $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ + $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \ $(SMBLDAP_OBJ) $(POPT_LIB_OBJ) $(LDB_OBJ) @@ -814,7 +813,7 @@ LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \ SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \ - $(PASSDB_OBJ) $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \ + $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \ $(SECRETS_OBJ) \ $(POPT_LIB_OBJ) $(DCUTIL_OBJ) $(LIBADS_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ) @@ -822,7 +821,7 @@ SMBCQUOTAS_OBJ = utils/smbcquotas.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(PARAM_OBJ) \ $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) \ - $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) + $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) EVTLOGADM_OBJ0 = utils/eventlogadm.o @@ -879,7 +878,7 @@ WINBIND_WINS_NSS_OBJ = nsswitch/wins.o $(PARAM_OBJ) \ PAM_SMBPASS_OBJ_0 = pam_smbpass/pam_smb_auth.o pam_smbpass/pam_smb_passwd.o \ pam_smbpass/pam_smb_acct.o pam_smbpass/support.o -PAM_SMBPASS_OBJ = $(PAM_SMBPASS_OBJ_0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ +PAM_SMBPASS_OBJ = $(PAM_SMBPASS_OBJ_0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \ $(SECRETS_OBJ) $(SMBLDAP_OBJ) $(LIBSAMBA_OBJ) \ $(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(LDB_OBJ) $(ERRORMAP_OBJ) @@ -913,7 +912,7 @@ WINBINDD_OBJ1 = \ auth/token_util.o WINBINDD_OBJ = \ - $(WINBINDD_OBJ1) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ + $(WINBINDD_OBJ1) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \ $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \ $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \ $(PROFILE_OBJ) $(SLCACHE_OBJ) $(SMBLDAP_OBJ) \ @@ -924,7 +923,7 @@ WINBINDD_OBJ = \ WBINFO_OBJ = nsswitch/wbinfo.o $(LIBSAMBA_OBJ) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \ $(SECRETS_OBJ) $(POPT_LIB_OBJ) $(AFS_SETTOKEN_OBJ) $(RPC_PARSE_OBJ1) \ - $(DOSERR_OBJ) lib/winbind_util.o + $(DOSERR_OBJ) lib/winbind_util.o @LIBWBCLIENT_STATIC@ WINBIND_NSS_OBJ = $(WBCOMMON_OBJ) $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) @WINBIND_NSS_EXTRA_OBJS@ @@ -948,7 +947,7 @@ LDB_LDAP_OBJ=@LDBLDAP@ LDB_OBJ = ${LDB_COMMON_OBJ} ${LDB_TDB_OBJ} ${LDB_LDAP_OBJ} ${LDB_MODULES_OBJ} LDB_CMDLINE_OBJ = $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \ - $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ + $(RPC_PARSE_OBJ) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \ $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(LIBADDNS_OBJ0) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \ $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) $(POPT_LIB_OBJ) \ @@ -990,7 +989,7 @@ NTLM_AUTH_OBJ1 = utils/ntlm_auth.o utils/ntlm_auth_diagnostics.o NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \ libsmb/asn1.o libsmb/spnego.o libsmb/clikrb5.o libads/kerberos.o \ libads/kerberos_verify.o $(SECRETS_OBJ) $(SERVER_MUTEX_OBJ) \ - libads/authdata.o $(RPC_PARSE_OBJ1) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ + libads/authdata.o $(RPC_PARSE_OBJ1) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \ $(SMBLDAP_OBJ) $(DOSERR_OBJ) rpc_parse/parse_net.o $(LIBNMB_OBJ) \ $(LDB_OBJ) $(ERRORMAP_OBJ) @@ -999,7 +998,7 @@ VLP_OBJ1 = ../testsuite/printing/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RP VLP_OBJ = $(VLP_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \ $(READLINE_OBJ) $(POPT_LIB_OBJ) $(SECRETS_OBJ) \ - $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ + $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ $(DISPLAY_SEC_OBJ) ###################################################################### @@ -1394,9 +1393,9 @@ bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@ -bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) +bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) nsswitch/wb_common.o lib/talloc/talloc.o @echo Linking shared library $@ - @$(SHLD_DSO) $(LIBWBCLIENT_OBJ) \ + @$(SHLD_DSO) $(LIBWBCLIENT_OBJ) nsswitch/wb_common.o lib/talloc/talloc.o \ @SONAMEFLAG@`basename $@`.$(SONAME_VER) @ln -s -f `basename $@` $@.$(SONAME_VER) diff --git a/source3/configure.in b/source3/configure.in index d69928cf16..4222d93227 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -322,6 +322,7 @@ AC_SUBST(LIBADDNS) AC_SUBST(INSTALL_LIBWBCLIENT) AC_SUBST(UNINSTALL_LIBWBCLIENT) AC_SUBST(LIBWBCLIENT_SHARED) +AC_SUBST(LIBWBCLIENT_STATIC) AC_SUBST(LIBWBCLIENT) AC_SUBST(WINBIND_LIBS) @@ -6160,7 +6161,15 @@ if test x"$HAVE_WINBIND" = x"no"; then WINBIND_WINS_NSS="" fi -if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes"; then +BUILD_LIBWBCLIENT_SHARED=yes + +AC_ARG_ENABLE(libwbclient-shared, +[ --enable-libwbclient-shared Build libwbclient as shared object (default=yes, \"no\" only for --enable-developer)], + [if eval "test x$enable_developer = xyes -a x$enable_libwbclient_shared = xno" ; then + BUILD_LIBWBCLIENT_SHARED=no + fi]) + +if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes" -a x"$BUILD_LIBWBCLIENT_SHARED" = x"yes"; then NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}" ## Only worry about libwbclient if we have shared library support ## and winbindd @@ -6170,6 +6179,8 @@ if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes"; then UNINSTALL_LIBWBCLIENT=uninstalllibwbclient WINBIND_LIBS="-lwbclient" LDFLAGS="$LDFLAGS -L./bin" +else + LIBWBCLIENT_STATIC=bin/libwbclient.a fi if test x"$HAVE_WINBIND" = x"yes"; then -- cgit From e17642e849b28c323ba6bd7cc212455d727901db Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 10 Jan 2008 23:40:13 +0100 Subject: Fix the build of the cacheprime VFS module after API changes. Sorry, that had escaped my attention. Michael (This used to be commit 88102b5b7c4eaad5445e9cb96e547dd918abc0c2) --- source3/modules/vfs_cacheprime.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source3/modules/vfs_cacheprime.c b/source3/modules/vfs_cacheprime.c index 4ac78437c3..5675108f1e 100644 --- a/source3/modules/vfs_cacheprime.c +++ b/source3/modules/vfs_cacheprime.c @@ -142,16 +142,15 @@ static ssize_t cprime_sendfile( static ssize_t cprime_read( vfs_handle_struct * handle, files_struct * fsp, - int fd, void * data, size_t count) { SMB_OFF_T offset; - offset = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR); + offset = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); if (offset >= 0 && g_readbuf) { - prime_cache(handle, fsp, fd, offset, count); - SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET); + prime_cache(handle, fsp, fsp->fh->fd, offset, count); + SMB_VFS_LSEEK(fsp, offset, SEEK_SET); } return SMB_VFS_NEXT_READ(handle, fsp, data, count); -- cgit From 13785d5c62093540139094f6dfcf808100790939 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 10 Jan 2008 15:15:01 -0800 Subject: Don't print out debug messages at level 0 if we can't bind to a socket if we've already bound to one (this prevents : bind failed on port 445 socket_addr = 0.0.0.0. Error = Address already in use bind failed on port 139 socket_addr = 0.0.0.0. Error = Address already in use messages when trying to bind to an IPv4 address when we've already bound to the IPv6 equivalent. Jeremy. (This used to be commit 3936de735a7bb548df8ce7f06f2cc8f7ffdf56cd) --- source3/smbd/server.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 43a6d62a28..8371d17f10 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -390,8 +390,11 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ } s = fd_listenset[num_sockets] = - open_socket_in(SOCK_STREAM, port, 0, - ifss, True); + open_socket_in(SOCK_STREAM, + port, + num_sockets == 0 ? 0 : 2, + ifss, + true); if(s == -1) { continue; } @@ -467,8 +470,11 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ continue; } - s = open_socket_in(SOCK_STREAM, port, 0, - &ss, true); + s = open_socket_in(SOCK_STREAM, + port, + num_sockets == 0 ? 0 : 2, + &ss, + true); if (s == -1) { continue; } -- cgit From 4caab9ca25e1163378714de825d835e79e27dd4f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 00:51:19 +0100 Subject: Combine fsp and fromfd to fromfsp in SMB_VFS_SENDFILE(). Michael (This used to be commit a52cfb7d777157c93c9dc26c67f457be592dd537) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_cacheprime.c | 7 +++---- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_full_audit.c | 9 ++++----- source3/modules/vfs_readahead.c | 14 ++++++-------- source3/smbd/reply.c | 4 ++-- 9 files changed, 26 insertions(+), 29 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 6b1f29b12d..16578057d0 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -155,10 +155,10 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OF return vfswrap_lseek(NULL, fsp, offset, whence); } -static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr, +static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) { - return vfswrap_sendfile(NULL, tofd, fsp, fromfd, hdr, offset, n); + return vfswrap_sendfile(NULL, tofd, fromfsp, hdr, offset, n); } static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index c168b461ba..e69826a89d 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -149,9 +149,9 @@ static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OF return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence); } -static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) +static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) { - return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, hdr, offset, n); + return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n); } static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 8aa8057982..11f88c98f3 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -101,6 +101,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from aio_cancel. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from read. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from write. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox */ @@ -297,7 +298,7 @@ struct vfs_ops { ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n); ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset); SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence); - ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); + ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t count); int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname); int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 48f5fcf1f4..379d6307e9 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -53,7 +53,7 @@ #define SMB_VFS_WRITE(fsp, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (data), (n))) #define SMB_VFS_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (offset), (whence))) -#define SMB_VFS_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) +#define SMB_VFS_SENDFILE(tofd, fromfsp, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count))) #define SMB_VFS_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) #define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new))) #define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp))) @@ -172,7 +172,7 @@ #define SMB_VFS_OPAQUE_WRITE(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (data), (n))) #define SMB_VFS_OPAQUE_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_OPAQUE_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (offset), (whence))) -#define SMB_VFS_OPAQUE_SENDFILE(tofd, fsp, fromfd, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) +#define SMB_VFS_OPAQUE_SENDFILE(tofd, fromfsp, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count))) #define SMB_VFS_OPAQUE_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) #define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new))) #define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp))) @@ -292,7 +292,7 @@ #define SMB_VFS_NEXT_WRITE(handle, fsp, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (data), (n))) #define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (offset), (whence))) -#define SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fsp), (fromfd), (header), (offset), (count))) +#define SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count))) #define SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) #define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new))) #define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp))) diff --git a/source3/modules/vfs_cacheprime.c b/source3/modules/vfs_cacheprime.c index 5675108f1e..15c8167a07 100644 --- a/source3/modules/vfs_cacheprime.c +++ b/source3/modules/vfs_cacheprime.c @@ -125,17 +125,16 @@ static int cprime_connect( static ssize_t cprime_sendfile( struct vfs_handle_struct * handle, int tofd, - files_struct * fsp, - int fromfd, + files_struct * fromfsp, const DATA_BLOB * header, SMB_OFF_T offset, size_t count) { if (g_readbuf && offset == 0) { - prime_cache(handle, fsp, fromfd, offset, count); + prime_cache(handle, fromfsp, fromfsp->fh->fd, offset, count); } - return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, + return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, header, offset, count); } diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index e57d24cb1a..3a0ed0bebd 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -337,13 +337,13 @@ static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB return result; } -static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *hdr, +static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) { ssize_t result; START_PROFILE_BYTES(syscall_sendfile, n); - result = sys_sendfile(tofd, fromfd, hdr, offset, n); + result = sys_sendfile(tofd, fromfsp->fh->fd, hdr, offset, n); END_PROFILE(syscall_sendfile); return result; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 00512678b1..baa5d24a33 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -124,7 +124,7 @@ static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fs static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence); static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd, - files_struct *fsp, int fromfd, + files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n); static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd, @@ -1149,17 +1149,16 @@ static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *f } static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd, - files_struct *fsp, int fromfd, + files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) { ssize_t result; - result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, hdr, - offset, n); + result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n); do_log(SMB_VFS_OP_SENDFILE, (result >= 0), handle, - "%s", fsp->fsp_name); + "%s", fromfsp->fsp_name); return result; } diff --git a/source3/modules/vfs_readahead.c b/source3/modules/vfs_readahead.c index b3642d558f..df75814b72 100644 --- a/source3/modules/vfs_readahead.c +++ b/source3/modules/vfs_readahead.c @@ -35,8 +35,7 @@ struct readahead_data { static ssize_t readahead_sendfile(struct vfs_handle_struct *handle, int tofd, - files_struct *fsp, - int fromfd, + files_struct *fromfsp, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) @@ -45,16 +44,16 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle, if ( offset % rhd->off_bound == 0) { #if defined(HAVE_LINUX_READAHEAD) - int err = readahead(fromfd, offset, (size_t)rhd->len); + int err = readahead(fromfsp->fh->fd, offset, (size_t)rhd->len); DEBUG(10,("readahead_sendfile: readahead on fd %u, offset %llu, len %u returned %d\n", - (unsigned int)fromfd, + (unsigned int)fromfsp->fh->fd, (unsigned long long)offset, (unsigned int)rhd->len, err )); #elif defined(HAVE_POSIX_FADVISE) - int err = posix_fadvise(fromfd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED); + int err = posix_fadvise(fromfsp->fh->fd, offset, (off_t)rhd->len, POSIX_FADV_WILLNEED); DEBUG(10,("readahead_sendfile: posix_fadvise on fd %u, offset %llu, len %u returned %d\n", - (unsigned int)fromfd, + (unsigned int)fromfsp->fh->fd, (unsigned long long)offset, (unsigned int)rhd->len, err )); @@ -67,8 +66,7 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle, } return SMB_VFS_NEXT_SENDFILE(handle, tofd, - fsp, - fromfd, + fromfsp, header, offset, count); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 79c0176e64..8149f5aeb6 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2654,7 +2654,7 @@ void send_file_readbraw(connection_struct *conn, _smb_setlen(header,nread); header_blob = data_blob_const(header, 4); - if ( SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp->fh->fd, + if (SMB_VFS_SENDFILE(smbd_server_fd(), fsp, &header_blob, startpos, nread) == -1) { /* Returning ENOSYS means no data at all was sent. * Do this as a normal read. */ @@ -3137,7 +3137,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req, construct_reply_common((char *)req->inbuf, (char *)headerbuf); setup_readX_header((char *)headerbuf, smb_maxcnt); - if ((nread = SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp->fh->fd, &header, startpos, smb_maxcnt)) == -1) { + if ((nread = SMB_VFS_SENDFILE(smbd_server_fd(), fsp, &header, startpos, smb_maxcnt)) == -1) { /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */ if (errno == ENOSYS) { goto normal_read; -- cgit From 14d45bedfa844dfbf646e792d1cf84544997de25 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 00:56:06 +0100 Subject: Remove now redundant parameter fd from prime_cache(). Michael (This used to be commit 63acaf1b9755cd5be5342929e1210afa06e170f3) --- source3/modules/vfs_cacheprime.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source3/modules/vfs_cacheprime.c b/source3/modules/vfs_cacheprime.c index 15c8167a07..be934f6bd6 100644 --- a/source3/modules/vfs_cacheprime.c +++ b/source3/modules/vfs_cacheprime.c @@ -48,7 +48,6 @@ static void * g_readbuf = NULL; static bool prime_cache( struct vfs_handle_struct * handle, files_struct * fsp, - int fd, SMB_OFF_T offset, size_t count) { @@ -75,7 +74,7 @@ static bool prime_cache( MODULE, (long long)g_readsz, (long long)*last, fsp->fsp_name)); - nread = sys_pread(fd, g_readbuf, g_readsz, *last); + nread = sys_pread(fsp->fh->fd, g_readbuf, g_readsz, *last); if (nread < 0) { *last = -1; return False; @@ -131,7 +130,7 @@ static ssize_t cprime_sendfile( size_t count) { if (g_readbuf && offset == 0) { - prime_cache(handle, fromfsp, fromfsp->fh->fd, offset, count); + prime_cache(handle, fromfsp, offset, count); } return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, @@ -148,7 +147,7 @@ static ssize_t cprime_read( offset = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); if (offset >= 0 && g_readbuf) { - prime_cache(handle, fsp, fsp->fh->fd, offset, count); + prime_cache(handle, fsp, offset, count); SMB_VFS_LSEEK(fsp, offset, SEEK_SET); } @@ -163,7 +162,7 @@ static ssize_t cprime_pread( SMB_OFF_T offset) { if (g_readbuf) { - prime_cache(handle, fsp, fsp->fh->fd, offset, count); + prime_cache(handle, fsp, offset, count); } return SMB_VFS_NEXT_PREAD(handle, fsp, data, count, offset); -- cgit From fef9cf00e1e110ff5872f1c368d080fe4f7939d6 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 01:26:54 +0100 Subject: Combine fsp and tofd to tofsp in SMB_VFS_RECVFILE(). Michael (This used to be commit 3958abffaf2866c69ad9e13ec345364fde5c78bb) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 3 ++- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_default.c | 5 ++--- source3/modules/vfs_full_audit.c | 9 ++++----- source3/smbd/vfs.c | 2 -- 7 files changed, 15 insertions(+), 18 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 16578057d0..5b196af5eb 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -161,9 +161,9 @@ static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct * return vfswrap_sendfile(NULL, tofd, fromfsp, hdr, offset, n); } -static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) +static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n) { - return vfswrap_recvfile(NULL, fromfd, fsp, tofd, offset, n); + return vfswrap_recvfile(NULL, fromfd, tofsp, offset, n); } static int skel_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index e69826a89d..55407be10c 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -154,9 +154,9 @@ static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct * return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n); } -static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t n) +static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n) { - return SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, n); + return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n); } static int skel_rename(vfs_handle_struct *handle, const char *oldname, const char *newname) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 11f88c98f3..0be3886227 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -102,6 +102,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from read. - obnox */ /* Leave at 22 - not yet released. Remove parameter fd from write. - obnox */ /* Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox */ @@ -299,7 +300,7 @@ struct vfs_ops { ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset); SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence); ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); - ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t count); + ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t count); int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname); int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp); int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 379d6307e9..9232e94a42 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -54,7 +54,7 @@ #define SMB_VFS_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (offset), (whence))) #define SMB_VFS_SENDFILE(tofd, fromfsp, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count))) -#define SMB_VFS_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) +#define SMB_VFS_RECVFILE(fromfd, tofsp, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (tofsp), (offset), (count))) #define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new))) #define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp))) #define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf))) @@ -173,7 +173,7 @@ #define SMB_VFS_OPAQUE_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_OPAQUE_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (offset), (whence))) #define SMB_VFS_OPAQUE_SENDFILE(tofd, fromfsp, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count))) -#define SMB_VFS_OPAQUE_RECVFILE(fromfd, fsp, tofd, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) +#define SMB_VFS_OPAQUE_RECVFILE(fromfd, tofsp, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (tofsp), (offset), (count))) #define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new))) #define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp))) #define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf))) @@ -293,7 +293,7 @@ #define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (data), (n), (off))) #define SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (offset), (whence))) #define SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count))) -#define SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (fsp), (tofd), (offset), (count))) +#define SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (tofsp), (offset), (count))) #define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new))) #define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp))) #define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 3a0ed0bebd..e21136ccee 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -350,15 +350,14 @@ static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struc static ssize_t vfswrap_recvfile(vfs_handle_struct *handle, int fromfd, - files_struct *fsp, - int tofd, + files_struct *tofsp, SMB_OFF_T offset, size_t n) { ssize_t result; START_PROFILE_BYTES(syscall_recvfile, n); - result = sys_recvfile(fromfd, tofd, offset, n); + result = sys_recvfile(fromfd, tofsp->fh->fd, offset, n); END_PROFILE(syscall_recvfile); return result; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index baa5d24a33..5aa9bab5b5 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -128,7 +128,7 @@ static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n); static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd, - files_struct *fsp, int tofd, + files_struct *tofsp, SMB_OFF_T offset, size_t n); static int smb_full_audit_rename(vfs_handle_struct *handle, @@ -1164,17 +1164,16 @@ static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd, } static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd, - files_struct *fsp, int tofd, + files_struct *tofsp, SMB_OFF_T offset, size_t n) { ssize_t result; - result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd, - offset, n); + result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n); do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle, - "%s", fsp->fsp_name); + "%s", tofsp->fsp_name); return result; } diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 1e71da742c..33a3a43aa4 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -445,7 +445,6 @@ ssize_t vfs_write_data(struct smb_request *req, req->unread_bytes = 0; return SMB_VFS_RECVFILE(smbd_server_fd(), fsp, - fsp->fh->fd, (SMB_OFF_T)-1, N); } @@ -479,7 +478,6 @@ ssize_t vfs_pwrite_data(struct smb_request *req, req->unread_bytes = 0; return SMB_VFS_RECVFILE(smbd_server_fd(), fsp, - fsp->fh->fd, offset, N); } -- cgit From f33f4ef4a24fcbf09eeba0d51e7db74e9b13b432 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 10 Jan 2008 16:35:54 -0800 Subject: Don't switch user contexts unless you have to. Saves a bunch of syscalls on close. Noticed by Volker. Jeremy. (This used to be commit 3caeeaea162e2083a087c242b850c107a3be1bf9) --- source3/smbd/close.c | 39 +++++++++++++++++++++++++-------------- source3/smbd/sec_ctx.c | 17 +++++++++++++++++ 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index c74e13348e..f67a4ad668 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -163,7 +163,8 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, enum file_close_type close_type) { connection_struct *conn = fsp->conn; - bool delete_file = False; + bool delete_file = false; + bool changed_user = false; struct share_mode_lock *lck; SMB_STRUCT_STAT sbuf; NTSTATUS status = NT_STATUS_OK; @@ -246,18 +247,26 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, DEBUG(5,("close_remove_share_mode: file %s. Delete on close was set " "- deleting file.\n", fsp->fsp_name)); - /* Become the user who requested the delete. */ + if (!unix_token_equal(lck->delete_token, ¤t_user.ut)) { + /* Become the user who requested the delete. */ - if (!push_sec_ctx()) { - smb_panic("close_remove_share_mode: file %s. failed to push " - "sec_ctx.\n"); - } + DEBUG(5,("close_remove_share_mode: file %s. " + "Change user to uid %u\n", + (unsigned int)lck->delete_token->uid)); - set_sec_ctx(lck->delete_token->uid, - lck->delete_token->gid, - lck->delete_token->ngroups, - lck->delete_token->groups, - NULL); + if (!push_sec_ctx()) { + smb_panic("close_remove_share_mode: file %s. failed to push " + "sec_ctx.\n"); + } + + set_sec_ctx(lck->delete_token->uid, + lck->delete_token->gid, + lck->delete_token->ngroups, + lck->delete_token->groups, + NULL); + + changed_user = true; + } /* We can only delete the file if the name we have is still valid and hasn't been renamed. */ @@ -326,9 +335,11 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, done: - /* unbecome user. */ - pop_sec_ctx(); - + if (changed_user) { + /* unbecome user. */ + pop_sec_ctx(); + } + TALLOC_FREE(lck); return status; } diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c index 6edcc36764..0f307f6a64 100644 --- a/source3/smbd/sec_ctx.c +++ b/source3/smbd/sec_ctx.c @@ -32,6 +32,23 @@ struct sec_ctx { static struct sec_ctx sec_ctx_stack[MAX_SEC_CTX_DEPTH + 1]; static int sec_ctx_stack_ndx; +/**************************************************************************** + Are two UNIX tokens equal ? +****************************************************************************/ + +bool unix_token_equal(const UNIX_USER_TOKEN *t1, const UNIX_USER_TOKEN *t2) +{ + if (t1->uid != t2->uid || t1->gid != t2->gid || + t1->ngroups != t2->ngroups) { + return false; + } + if (memcmp(t1->groups, t2->groups, + t1->ngroups*sizeof(gid_t)) != 0) { + return false; + } + return true; +} + /**************************************************************************** Become the specified uid. ****************************************************************************/ -- cgit From 28b852a893a439482991d84373fb083fb81fd4ea Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 14:40:06 +0100 Subject: Add domain_is_ad bool to libnetjoin ctx. Guenther (This used to be commit 16ca8d2746a5c2fc7a583d1cf2ebb4d3aa003842) --- source3/libnet/libnet_join.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h index c6a0cd183c..95b965717e 100644 --- a/source3/libnet/libnet_join.h +++ b/source3/libnet/libnet_join.h @@ -47,6 +47,7 @@ struct libnet_JoinCtx { bool modified_config; WERROR result; char *error_string; + bool domain_is_ad; } out; }; -- cgit From 136b02de5e7ed05d144083ac1f0b9f7cbeee488c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 14:41:34 +0100 Subject: Use domain_is_ad bool. Guenther (This used to be commit 9707a5eb008788460937104575b7afd733a9f741) --- source3/libnet/libnet_join.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 8e6d91b38b..3bc1464f18 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -575,6 +575,10 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, NULL, &r->out.domain_sid); + if (NT_STATUS_IS_OK(status)) { + r->out.domain_is_ad = true; + } + if (!NT_STATUS_IS_OK(status)) { status = rpccli_lsa_query_info_policy(pipe_hnd, mem_ctx, &lsa_pol, 5, @@ -833,7 +837,6 @@ done: static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) { WERROR werr; - bool is_ad = false; if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) { @@ -845,10 +848,6 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) return werr; } - if (r->out.dns_domain_name) { - is_ad = true; - } - werr = libnet_conf_set_global_parameter("security", "domain"); W_ERROR_NOT_OK_RETURN(werr); @@ -856,7 +855,7 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) r->out.netbios_domain_name); W_ERROR_NOT_OK_RETURN(werr); - if (is_ad) { + if (r->out.domain_is_ad) { werr = libnet_conf_set_global_parameter("security", "ads"); W_ERROR_NOT_OK_RETURN(werr); -- cgit From 2c591e05c983bc30ebfb729226454c4c380eaf70 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 14:42:48 +0100 Subject: Remove some more references to global_myname() in libnet_join. Guenther (This used to be commit ed4960baccf687b77c2b0f4ee64cbce2005f3abb) --- source3/libnet/libnet_join.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 3bc1464f18..4fec5ac294 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -611,7 +611,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, goto done; } - acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname()); + acct_name = talloc_asprintf(mem_ctx, "%s$", r->in.machine_name); strlower_m(acct_name); const_acct_name = acct_name; @@ -773,7 +773,7 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx, goto done; } - acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname()); + acct_name = talloc_asprintf(mem_ctx, "%s$", r->in.machine_name); strlower_m(acct_name); const_acct_name = acct_name; -- cgit From 2bcba87572a290d8d0281604b80355af9abf66e8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 14:43:56 +0100 Subject: Ignore result of libnet_conf_delete_parameter here, as realm may be not there. Guenther (This used to be commit 2e2d058b7e90a158612af4b0a489578431f748e5) --- source3/libnet/libnet_join.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 4fec5ac294..2c60f99d79 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -880,7 +880,7 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) W_ERROR_NOT_OK_RETURN(werr); } - werr = libnet_conf_delete_parameter(GLOBAL_NAME, "realm"); + libnet_conf_delete_parameter(GLOBAL_NAME, "realm"); return werr; } -- cgit From 4eed7883bb0832157461cac1f0efcd6398746d7d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 14:47:23 +0100 Subject: Refactor libnetapi error string functions a bit. Guenther (This used to be commit 3b450a8bcc97b6d03c4b7b9373a3a382c0fcea30) --- source3/lib/netapi/netapi.c | 21 +++++++++++++++++---- source3/lib/netapi/netapi.h | 5 +++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index d4cb3a9fe2..ce00054e6e 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -192,8 +192,7 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, /**************************************************************** ****************************************************************/ -const char *libnetapi_errstr(struct libnetapi_ctx *ctx, - NET_API_STATUS status) +const char *libnetapi_errstr(NET_API_STATUS status) { if (status & 0xc0000000) { return get_friendly_nt_error_msg(NT_STATUS(status)); @@ -220,9 +219,23 @@ NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, /**************************************************************** ****************************************************************/ -const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx) +const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, + NET_API_STATUS status) { - return ctx->error_string; + struct libnetapi_ctx *tmp_ctx = ctx; + + if (!tmp_ctx) { + status = libnetapi_getctx(&tmp_ctx); + if (status != 0) { + return NULL; + } + } + + if (tmp_ctx->error_string) { + return tmp_ctx->error_string; + } + + return libnetapi_errstr(status); } /**************************************************************** diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 4a40b32fc9..61cece119f 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -46,9 +46,10 @@ NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debugl NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username); NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password); NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup); -const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status); +const char *libnetapi_errstr(NET_API_STATUS status); NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *error_string); -const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx); +const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, NET_API_STATUS status); + /**************************************************************** ****************************************************************/ -- cgit From 7a87256cd1ac7962da9a5e37945ee5dd26a18c98 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 14:47:52 +0100 Subject: Include some basic headers in netapi.h. Guenther (This used to be commit 23b92a6fa57858c8a23c737a9cd00c076ef5dadd) --- source3/lib/netapi/netapi.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 61cece119f..274a167d53 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -20,6 +20,16 @@ #ifndef __LIB_NETAPI_H__ #define __LIB_NETAPI_H__ +/**************************************************************** + include some basic headers +****************************************************************/ + +#include + +/**************************************************************** + NET_API_STATUS +****************************************************************/ + #define NET_API_STATUS uint32_t #define NET_API_STATUS_SUCCESS 0 -- cgit From 55b642c31213d0fb8a22d14759a948f2e2d8aa45 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 14:50:10 +0100 Subject: Set error string when ads_leave_realm() has failed in libnetjoin. Guenther (This used to be commit 01690f85bc7d052d4c57181d74aef27d1776169c) --- source3/libnet/libnet_join.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 2c60f99d79..46ebadbaee 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -202,7 +202,15 @@ static ADS_STATUS libnet_unjoin_remove_machine_acct(TALLOC_CTX *mem_ctx, } } - return ads_leave_realm(r->in.ads, r->in.machine_name); + status = ads_leave_realm(r->in.ads, r->in.machine_name); + if (!ADS_ERR_OK(status)) { + libnet_unjoin_set_error_string(mem_ctx, r, + "failed to leave realm: %s\n", + ads_errstr(status)); + return status; + } + + return ADS_SUCCESS; } /**************************************************************** -- cgit From 026b2a8d0a95112dc75e5b909b57580d7d032951 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 15:03:31 +0100 Subject: Remove '\n' from error strings in libnet_join context. Guenther (This used to be commit 9cc0d874f6c064e8752d36e72fcc85bf4c85e656) --- source3/libnet/libnet_join.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 46ebadbaee..1df85ebb61 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -120,7 +120,7 @@ static ADS_STATUS libnet_join_connect_ads(TALLOC_CTX *mem_ctx, &r->in.ads); if (!ADS_ERR_OK(status)) { libnet_join_set_error_string(mem_ctx, r, - "failed to connect to AD: %s\n", + "failed to connect to AD: %s", ads_errstr(status)); } @@ -147,7 +147,7 @@ static ADS_STATUS libnet_unjoin_connect_ads(TALLOC_CTX *mem_ctx, &r->in.ads); if (!ADS_ERR_OK(status)) { libnet_unjoin_set_error_string(mem_ctx, r, - "failed to connect to AD: %s\n", + "failed to connect to AD: %s", ads_errstr(status)); } @@ -205,7 +205,7 @@ static ADS_STATUS libnet_unjoin_remove_machine_acct(TALLOC_CTX *mem_ctx, status = ads_leave_realm(r->in.ads, r->in.machine_name); if (!ADS_ERR_OK(status)) { libnet_unjoin_set_error_string(mem_ctx, r, - "failed to leave realm: %s\n", + "failed to leave realm: %s", ads_errstr(status)); return status; } @@ -461,14 +461,14 @@ static bool libnet_join_derive_salting_principal(TALLOC_CTX *mem_ctx, status = ads_domain_func_level(r->in.ads, &domain_func); if (!ADS_ERR_OK(status)) { libnet_join_set_error_string(mem_ctx, r, - "Failed to determine domain functional level!\n"); + "Failed to determine domain functional level!"); return false; } std_salt = kerberos_standard_des_salt(); if (!std_salt) { libnet_join_set_error_string(mem_ctx, r, - "failed to obtain standard DES salt\n"); + "failed to obtain standard DES salt"); return false; } @@ -1033,7 +1033,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, ads_status = libnet_join_precreate_machine_acct(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { libnet_join_set_error_string(mem_ctx, r, - "failed to precreate account in ou %s: %s\n", + "failed to precreate account in ou %s: %s", r->in.account_ou, ads_errstr(ads_status)); return WERR_GENERAL_FAILURE; @@ -1058,7 +1058,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, ads_status = libnet_join_set_machine_spn(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { libnet_join_set_error_string(mem_ctx, r, - "failed to set machine spn: %s\n", + "failed to set machine spn: %s", ads_errstr(ads_status)); return WERR_GENERAL_FAILURE; } @@ -1066,7 +1066,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, ads_status = libnet_join_set_os_attributes(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { libnet_join_set_error_string(mem_ctx, r, - "failed to set machine os attributes: %s\n", + "failed to set machine os attributes: %s", ads_errstr(ads_status)); return WERR_GENERAL_FAILURE; } @@ -1074,7 +1074,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, ads_status = libnet_join_set_machine_upn(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { libnet_join_set_error_string(mem_ctx, r, - "failed to set machine upn: %s\n", + "failed to set machine upn: %s", ads_errstr(ads_status)); return WERR_GENERAL_FAILURE; } @@ -1088,7 +1088,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, #endif /* HAVE_LDAP */ if (!libnet_join_create_keytab(mem_ctx, r)) { libnet_join_set_error_string(mem_ctx, r, - "failed to create kerberos keytab\n"); + "failed to create kerberos keytab"); return WERR_GENERAL_FAILURE; } @@ -1141,7 +1141,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, status = libnet_join_unjoindomain_rpc(mem_ctx, r); if (!NT_STATUS_IS_OK(status)) { libnet_unjoin_set_error_string(mem_ctx, r, - "failed to unjoin domain: %s\n", + "failed to unjoin domain: %s", nt_errstr(status)); if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { return WERR_SETUP_NOT_JOINED; @@ -1156,7 +1156,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, ads_status = libnet_unjoin_remove_machine_acct(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { libnet_unjoin_set_error_string(mem_ctx, r, - "failed to remove machine account from AD: %s\n", + "failed to remove machine account from AD: %s", ads_errstr(ads_status)); } } -- cgit From efcf285e27e3f52cd6188f678d52977584c78972 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 15:28:24 +0100 Subject: Fix libnetapi error string callers. Guenther (This used to be commit 1ad7a0a361edfa5ac738f011db1d6a9db256ac2c) --- source3/lib/netapi/examples/getdc/getdc.c | 2 +- source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c | 8 ++++---- source3/lib/netapi/examples/netdomjoin/netdomjoin.c | 4 ++-- source3/utils/net_dom.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source3/lib/netapi/examples/getdc/getdc.c b/source3/lib/netapi/examples/getdc/getdc.c index 4f5c5332d5..cdd4d0b3b4 100644 --- a/source3/lib/netapi/examples/getdc/getdc.c +++ b/source3/lib/netapi/examples/getdc/getdc.c @@ -46,7 +46,7 @@ int main(int argc, char **argv) status = NetGetDCName(argv[1], argv[2], &buffer); if (status != 0) { - printf("GetDcName failed with: %s\n", libnetapi_errstr(ctx, status)); + printf("GetDcName failed with: %s\n", libnetapi_errstr(status)); } else { printf("%s\n", (char *)buffer); } diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index 4a3588e9ab..9dc2a18138 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -147,13 +147,13 @@ static void callback_apply_description_change(GtkWidget *widget, status = NetServerSetInfo(NULL, 1005, (uint8_t *)&info1005, &parm_err); if (status) { debug("NetServerSetInfo failed with: %s\n", - libnetapi_errstr(state->ctx, status)); + libnetapi_errstr(status)); dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_main), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Failed to change computer description: %s.", - libnetapi_errstr(state->ctx, status)); + libnetapi_errstr(status)); g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog); @@ -439,7 +439,7 @@ static void callback_do_join(GtkWidget *widget, state->password, unjoin_flags); if (status != 0) { - err_str = libnetapi_errstr(state->ctx, status); + err_str = libnetapi_errstr(status); g_print("callback_do_join: failed to unjoin (%s)\n", err_str); @@ -463,7 +463,7 @@ static void callback_do_join(GtkWidget *widget, state->password, join_flags); if (status != 0) { - err_str = libnetapi_errstr(state->ctx, status); + err_str = libnetapi_errstr(status); g_print("callback_do_join: failed to join (%s)\n", err_str); dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), diff --git a/source3/lib/netapi/examples/netdomjoin/netdomjoin.c b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c index a0ac0b1e56..29f66a17a2 100644 --- a/source3/lib/netapi/examples/netdomjoin/netdomjoin.c +++ b/source3/lib/netapi/examples/netdomjoin/netdomjoin.c @@ -105,9 +105,9 @@ int main(int argc, char **argv) join_flags); if (status != 0) { const char *errstr = NULL; - errstr = libnetapi_get_error_string(ctx); + errstr = libnetapi_get_error_string(ctx, status); if (!errstr) { - errstr = libnetapi_errstr(ctx, status); + errstr = libnetapi_errstr(status); } printf("Join failed with: %s\n", errstr); } else { diff --git a/source3/utils/net_dom.c b/source3/utils/net_dom.c index 3a8338ec70..30993ae2fa 100644 --- a/source3/utils/net_dom.c +++ b/source3/utils/net_dom.c @@ -101,7 +101,7 @@ static int net_dom_unjoin(int argc, const char **argv) status = NetUnjoinDomain(server_name, account, password, unjoin_flags); if (status != 0) { printf("Failed to unjoin domain: %s\n", - libnetapi_errstr(ctx, status)); + libnetapi_errstr(status)); goto done; } @@ -215,7 +215,7 @@ static int net_dom_join(int argc, const char **argv) Account, password, join_flags); if (status != 0) { printf("Failed to join domain: %s\n", - libnetapi_errstr(ctx, status)); + libnetapi_errstr(status)); goto done; } -- cgit From c79ce2ffa3f7d00ce6a2cd6008c203e3042b0b02 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 15:32:20 +0100 Subject: As long as DsGetDcName is not part of libnetapi, lowercase the fn name. Guenther (This used to be commit 19a980f52044a170618629e5b0484c1f6b586e5f) --- source3/lib/netapi/joindomain.c | 4 +- source3/libsmb/dsgetdcname.c | 76 ++++++++++++++++++------------------- source3/utils/net_lookup.c | 2 +- source3/winbindd/winbindd_locator.c | 6 +-- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index e4fb63eebb..b268e41a2a 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -49,7 +49,7 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED | DS_WRITABLE_REQUIRED | DS_RETURN_DNS_NAME; - status = DsGetDcName(mem_ctx, NULL, domain_name, + status = dsgetdcname(mem_ctx, NULL, domain_name, NULL, NULL, flags, &info); if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); @@ -244,7 +244,7 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, } else { domain = lp_workgroup(); } - status = DsGetDcName(mem_ctx, NULL, domain, + status = dsgetdcname(mem_ctx, NULL, domain, NULL, NULL, flags, &info); if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index fa6cbe146f..2a66d51400 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. - DsGetDcname + dsgetdcname Copyright (C) Gerald Carter 2006 Copyright (C) Guenther Deschner 2007-2008 @@ -259,7 +259,7 @@ static NTSTATUS unpack_dsdcinfo(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ -static char *DsGetDcName_cache_key(TALLOC_CTX *mem_ctx, const char *domain) +static char *dsgetdcname_cache_key(TALLOC_CTX *mem_ctx, const char *domain) { if (!mem_ctx || !domain) { return NULL; @@ -271,7 +271,7 @@ static char *DsGetDcName_cache_key(TALLOC_CTX *mem_ctx, const char *domain) /**************************************************************** ****************************************************************/ -static NTSTATUS DsGetDcName_cache_delete(TALLOC_CTX *mem_ctx, +static NTSTATUS dsgetdcname_cache_delete(TALLOC_CTX *mem_ctx, const char *domain_name) { char *key; @@ -280,7 +280,7 @@ static NTSTATUS DsGetDcName_cache_delete(TALLOC_CTX *mem_ctx, return NT_STATUS_INTERNAL_DB_ERROR; } - key = DsGetDcName_cache_key(mem_ctx, domain_name); + key = dsgetdcname_cache_key(mem_ctx, domain_name); if (!key) { return NT_STATUS_NO_MEMORY; } @@ -295,13 +295,13 @@ static NTSTATUS DsGetDcName_cache_delete(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ -static NTSTATUS DsGetDcName_cache_store(TALLOC_CTX *mem_ctx, +static NTSTATUS dsgetdcname_cache_store(TALLOC_CTX *mem_ctx, const char *domain_name, struct DS_DOMAIN_CONTROLLER_INFO *info) { time_t expire_time; char *key; - bool ret = False; + bool ret = false; DATA_BLOB blob; unsigned char *buf = NULL; int len = 0; @@ -310,7 +310,7 @@ static NTSTATUS DsGetDcName_cache_store(TALLOC_CTX *mem_ctx, return NT_STATUS_INTERNAL_DB_ERROR; } - key = DsGetDcName_cache_key(mem_ctx, domain_name); + key = dsgetdcname_cache_key(mem_ctx, domain_name); if (!key) { return NT_STATUS_NO_MEMORY; } @@ -341,7 +341,7 @@ static NTSTATUS DsGetDcName_cache_store(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ -static NTSTATUS DsGetDcName_cache_refresh(TALLOC_CTX *mem_ctx, +static NTSTATUS dsgetdcname_cache_refresh(TALLOC_CTX *mem_ctx, const char *domain_name, struct GUID *domain_guid, uint32_t flags, @@ -358,9 +358,9 @@ static NTSTATUS DsGetDcName_cache_refresh(TALLOC_CTX *mem_ctx, if (ads_cldap_netlogon(info->domain_controller_name, info->domain_name, &r)) { - DsGetDcName_cache_delete(mem_ctx, domain_name); + dsgetdcname_cache_delete(mem_ctx, domain_name); - return DsGetDcName_cache_store(mem_ctx, + return dsgetdcname_cache_store(mem_ctx, info->domain_name, info); } @@ -371,7 +371,7 @@ static NTSTATUS DsGetDcName_cache_refresh(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ -#define RETURN_ON_FALSE(x) if (!x) return False; +#define RETURN_ON_FALSE(x) if (!x) return false; static bool check_cldap_reply_required_flags(uint32_t ret_flags, uint32_t req_flags) @@ -398,13 +398,13 @@ static bool check_cldap_reply_required_flags(uint32_t ret_flags, if (req_flags & DS_WRITABLE_REQUIRED) RETURN_ON_FALSE(ret_flags & ADS_WRITABLE); - return True; + return true; } /**************************************************************** ****************************************************************/ -static NTSTATUS DsGetDcName_cache_fetch(TALLOC_CTX *mem_ctx, +static NTSTATUS dsgetdcname_cache_fetch(TALLOC_CTX *mem_ctx, const char *domain_name, struct GUID *domain_guid, uint32_t flags, @@ -420,7 +420,7 @@ static NTSTATUS DsGetDcName_cache_fetch(TALLOC_CTX *mem_ctx, return NT_STATUS_INTERNAL_DB_ERROR; } - key = DsGetDcName_cache_key(mem_ctx, domain_name); + key = dsgetdcname_cache_key(mem_ctx, domain_name); if (!key) { return NT_STATUS_NO_MEMORY; } @@ -454,7 +454,7 @@ static NTSTATUS DsGetDcName_cache_fetch(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ -static NTSTATUS DsGetDcName_cached(TALLOC_CTX *mem_ctx, +static NTSTATUS dsgetdcname_cached(TALLOC_CTX *mem_ctx, const char *domain_name, struct GUID *domain_guid, uint32_t flags, @@ -462,12 +462,12 @@ static NTSTATUS DsGetDcName_cached(TALLOC_CTX *mem_ctx, struct DS_DOMAIN_CONTROLLER_INFO **info) { NTSTATUS status; - bool expired = False; + bool expired = false; - status = DsGetDcName_cache_fetch(mem_ctx, domain_name, domain_guid, + status = dsgetdcname_cache_fetch(mem_ctx, domain_name, domain_guid, flags, site_name, info, &expired); if (!NT_STATUS_IS_OK(status)) { - DEBUG(10,("DsGetDcName_cached: cache fetch failed with: %s\n", + DEBUG(10,("dsgetdcname_cached: cache fetch failed with: %s\n", nt_errstr(status))); return NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; } @@ -477,7 +477,7 @@ static NTSTATUS DsGetDcName_cached(TALLOC_CTX *mem_ctx, } if (expired) { - status = DsGetDcName_cache_refresh(mem_ctx, domain_name, + status = dsgetdcname_cache_refresh(mem_ctx, domain_name, domain_guid, flags, site_name, *info); if (!NT_STATUS_IS_OK(status)) { @@ -503,24 +503,24 @@ static bool check_allowed_required_flags(uint32_t flags) debug_dsdcinfo_flags(10, flags); if (return_type == (DS_RETURN_FLAT_NAME|DS_RETURN_DNS_NAME)) { - return False; + return false; } if (offered_type == (DS_IS_DNS_NAME|DS_IS_FLAT_NAME)) { - return False; + return false; } if (query_type == (DS_BACKGROUND_ONLY|DS_FORCE_REDISCOVERY)) { - return False; + return false; } #if 0 if ((flags & DS_RETURN_DNS_NAME) && (!(flags & DS_IP_REQUIRED))) { printf("gd: here5 \n"); - return False; + return false; } #endif - return True; + return true; } /**************************************************************** @@ -739,7 +739,7 @@ static NTSTATUS process_dc_dns(TALLOC_CTX *mem_ctx, struct DS_DOMAIN_CONTROLLER_INFO **info) { int i = 0; - bool valid_dc = False; + bool valid_dc = false; struct cldap_netlogon_reply r; const char *dc_hostname, *dc_domain_name; const char *dc_address; @@ -754,7 +754,7 @@ static NTSTATUS process_dc_dns(TALLOC_CTX *mem_ctx, if ((ads_cldap_netlogon(dclist[i]->hostname, domain_name, &r)) && (check_cldap_reply_required_flags(r.flags, flags))) { - valid_dc = True; + valid_dc = true; break; } @@ -837,7 +837,7 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ -static NTSTATUS DsGetDcName_rediscover(TALLOC_CTX *mem_ctx, +static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx, const char *domain_name, struct GUID *domain_guid, uint32_t flags, @@ -848,7 +848,7 @@ static NTSTATUS DsGetDcName_rediscover(TALLOC_CTX *mem_ctx, struct ip_service_name *dclist; int num_dcs; - DEBUG(10,("DsGetDcName_rediscover\n")); + DEBUG(10,("dsgetdcname_rediscover\n")); if (flags & DS_IS_FLAT_NAME) { @@ -893,7 +893,7 @@ static NTSTATUS DsGetDcName_rediscover(TALLOC_CTX *mem_ctx, /******************************************************************** ********************************************************************/ -NTSTATUS DsGetDcName_remote(TALLOC_CTX *mem_ctx, +NTSTATUS dsgetdcname_remote(TALLOC_CTX *mem_ctx, const char *computer_name, const char *domain_name, struct GUID *domain_guid, @@ -946,7 +946,7 @@ NTSTATUS DsGetDcName_remote(TALLOC_CTX *mem_ctx, /******************************************************************** ********************************************************************/ -NTSTATUS DsGetDcName_local(TALLOC_CTX *mem_ctx, +NTSTATUS dsgetdcname_local(TALLOC_CTX *mem_ctx, const char *computer_name, const char *domain_name, struct GUID *domain_guid, @@ -968,7 +968,7 @@ NTSTATUS DsGetDcName_local(TALLOC_CTX *mem_ctx, goto rediscover; } - status = DsGetDcName_cached(mem_ctx, domain_name, domain_guid, + status = dsgetdcname_cached(mem_ctx, domain_name, domain_guid, flags, site_name, &myinfo); if (NT_STATUS_IS_OK(status)) { *info = myinfo; @@ -980,12 +980,12 @@ NTSTATUS DsGetDcName_local(TALLOC_CTX *mem_ctx, } rediscover: - status = DsGetDcName_rediscover(mem_ctx, domain_name, + status = dsgetdcname_rediscover(mem_ctx, domain_name, domain_guid, flags, site_name, &myinfo); if (NT_STATUS_IS_OK(status)) { - DsGetDcName_cache_store(mem_ctx, domain_name, myinfo); + dsgetdcname_cache_store(mem_ctx, domain_name, myinfo); *info = myinfo; } @@ -993,12 +993,12 @@ NTSTATUS DsGetDcName_local(TALLOC_CTX *mem_ctx, } /******************************************************************** - DsGetDcName. + dsgetdcname. This will be the only public function here. ********************************************************************/ -NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx, +NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, const char *computer_name, const char *domain_name, struct GUID *domain_guid, @@ -1006,7 +1006,7 @@ NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx, uint32_t flags, struct DS_DOMAIN_CONTROLLER_INFO **info) { - DEBUG(10,("DsGetDcName: computer_name: %s, domain_name: %s, " + DEBUG(10,("dsgetdcname: computer_name: %s, domain_name: %s, " "domain_guid: %s, site_name: %s, flags: 0x%08x\n", computer_name, domain_name, domain_guid ? GUID_string(mem_ctx, domain_guid) : "(null)", @@ -1015,7 +1015,7 @@ NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx, *info = NULL; if (computer_name) { - return DsGetDcName_remote(mem_ctx, + return dsgetdcname_remote(mem_ctx, computer_name, domain_name, domain_guid, @@ -1024,7 +1024,7 @@ NTSTATUS DsGetDcName(TALLOC_CTX *mem_ctx, info); } - return DsGetDcName_local(mem_ctx, + return dsgetdcname_local(mem_ctx, computer_name, domain_name, domain_guid, diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c index 20298faa29..765971fba3 100644 --- a/source3/utils/net_lookup.c +++ b/source3/utils/net_lookup.c @@ -401,7 +401,7 @@ static int net_lookup_dsgetdcname(int argc, const char **argv) site_name = sitename_fetch(domain_name); } - status = DsGetDcName(mem_ctx, NULL, domain_name, NULL, site_name, + status = dsgetdcname(mem_ctx, NULL, domain_name, NULL, site_name, flags, &info); if (!NT_STATUS_IS_OK(status)) { d_printf("failed with: %s\n", nt_errstr(status)); diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c index ee497ebf32..05bd74af25 100644 --- a/source3/winbindd/winbindd_locator.c +++ b/source3/winbindd/winbindd_locator.c @@ -48,7 +48,7 @@ void winbindd_dsgetdcname(struct winbindd_cli_state *state) state->request.domain_name [sizeof(state->request.domain_name)-1] = '\0'; - DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, + DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid, state->request.domain_name)); sendto_child(state, locator_child()); @@ -64,10 +64,10 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain, state->request.domain_name [sizeof(state->request.domain_name)-1] = '\0'; - DEBUG(3, ("[%5lu]: DsGetDcName for %s\n", (unsigned long)state->pid, + DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid, state->request.domain_name)); - result = DsGetDcName(state->mem_ctx, NULL, state->request.domain_name, + result = dsgetdcname(state->mem_ctx, NULL, state->request.domain_name, NULL, NULL, state->request.flags, &info); if (!NT_STATUS_IS_OK(result)) { -- cgit From 2539cf073915c481ae449e2eb11f501c29276688 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 18:46:41 +0100 Subject: Fix a build warning. Guenther (This used to be commit 88874a501d0c086f796e4838af8c9399d3cccc1f) --- source3/smbd/close.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index f67a4ad668..4c385d7611 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -252,6 +252,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, DEBUG(5,("close_remove_share_mode: file %s. " "Change user to uid %u\n", + fsp->fsp_name, (unsigned int)lck->delete_token->uid)); if (!push_sec_ctx()) { -- cgit From 618f9a60cc60bceb40eed31fbd845db18ccbaee4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 18:55:20 +0100 Subject: Fix panic in "net conf": Fix logic in error condition. Michael (This used to be commit 83aed537c16f632599484f60c5ccebc3ab713801) --- source3/libnet/libnet_conf.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index d0ef6eb0e6..dcb80d96ea 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -110,7 +110,7 @@ static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx, } werr = ntstatus_to_werror(registry_create_admin_token(tmp_ctx, &token)); - if (W_ERROR_IS_OK(werr)) { + if (!W_ERROR_IS_OK(werr)) { DEBUG(1, ("Error creating admin token\n")); goto done; } @@ -420,6 +420,48 @@ done: * **********************************************************************/ +/** + * Open the configuration. + * + * Upon success, this creates and returns the conf context + * that should be passed around in subsequent calls to the other + * libnet_conf functions. + */ +WERROR libnet_conf_open(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx **conf_ctx) +{ + WERROR werr = WERR_OK; + struct libnet_conf_ctx *ctx; + + if (conf_ctx == NULL) { + return WERR_INVALID_PARAM; + } + + ctx = talloc_zero(mem_ctx, struct libnet_conf_ctx); + if (ctx == NULL) { + return WERR_NOMEM; + } + + talloc_set_destructor(ctx, libnet_conf_destrox_ctx); + + ctx->token = registry_create_admin_token(tmp_ctx); + if (ctx->token == NULL) { + DEBUG(1, ("Error creating admin token\n")); + /* what is the appropriate error code here? */ + werr = WERR_CAN_NOT_COMPLETE; + goto done; + } + + +} + +/** + * Close the configuration. + */ +WERROR libnet_conf_close(struct libnet_conf_ctx *ctx) +{ + regdb_close(); +} + /** * Drop the whole configuration (restarting empty). */ -- cgit From 9cd74303478ac15b4357fb7f76d9576fe9a060a1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 19:02:26 +0100 Subject: Remove code accidentially submittet with last commit 83aed537c16f63. This is ist still in preparation and will follow soon. Soory! Michael (This used to be commit 75acdb54a454ffda9d422fcafb573c8f5581d2e8) --- source3/libnet/libnet_conf.c | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index dcb80d96ea..0bdf4805d7 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -420,48 +420,6 @@ done: * **********************************************************************/ -/** - * Open the configuration. - * - * Upon success, this creates and returns the conf context - * that should be passed around in subsequent calls to the other - * libnet_conf functions. - */ -WERROR libnet_conf_open(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx **conf_ctx) -{ - WERROR werr = WERR_OK; - struct libnet_conf_ctx *ctx; - - if (conf_ctx == NULL) { - return WERR_INVALID_PARAM; - } - - ctx = talloc_zero(mem_ctx, struct libnet_conf_ctx); - if (ctx == NULL) { - return WERR_NOMEM; - } - - talloc_set_destructor(ctx, libnet_conf_destrox_ctx); - - ctx->token = registry_create_admin_token(tmp_ctx); - if (ctx->token == NULL) { - DEBUG(1, ("Error creating admin token\n")); - /* what is the appropriate error code here? */ - werr = WERR_CAN_NOT_COMPLETE; - goto done; - } - - -} - -/** - * Close the configuration. - */ -WERROR libnet_conf_close(struct libnet_conf_ctx *ctx) -{ - regdb_close(); -} - /** * Drop the whole configuration (restarting empty). */ -- cgit From 2ec41571a3efbea254cc3e132280a194c86a2f89 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 15:08:37 -0800 Subject: Sync tdb with the tdb changes in ctdb. Spoke to tridge about this. Fixes insidious problem with order n^2 freelist merging. Jeremy. (This used to be commit c6609c042b128e7d63eb64cfdfb0f6b65cb59d76) --- source3/lib/tdb/common/freelist.c | 101 ++++++++--- source3/lib/tdb/common/io.c | 20 +- source3/lib/tdb/common/lock.c | 7 + source3/lib/tdb/common/open.c | 16 +- source3/lib/tdb/common/tdb.c | 72 +++++++- source3/lib/tdb/common/tdb_private.h | 8 +- source3/lib/tdb/common/transaction.c | 343 +++++++++++++++++------------------ source3/lib/tdb/common/traverse.c | 3 + source3/lib/tdb/configure.ac | 2 +- source3/lib/tdb/include/tdb.h | 4 + 10 files changed, 358 insertions(+), 218 deletions(-) diff --git a/source3/lib/tdb/common/freelist.c b/source3/lib/tdb/common/freelist.c index b109643f23..c086c151fa 100644 --- a/source3/lib/tdb/common/freelist.c +++ b/source3/lib/tdb/common/freelist.c @@ -27,6 +27,12 @@ #include "tdb_private.h" +/* 'right' merges can involve O(n^2) cost when combined with a + traverse, so they are disabled until we find a way to do them in + O(1) time +*/ +#define USE_RIGHT_MERGES 0 + /* read a freelist record and check for simple errors */ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct list_struct *rec) { @@ -56,7 +62,7 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct list_struct } - +#if USE_RIGHT_MERGES /* Remove an element from the freelist. Must have alloc lock. */ static int remove_from_freelist(struct tdb_context *tdb, tdb_off_t off, tdb_off_t next) { @@ -75,6 +81,7 @@ static int remove_from_freelist(struct tdb_context *tdb, tdb_off_t off, tdb_off_ TDB_LOG((tdb, TDB_DEBUG_FATAL,"remove_from_freelist: not on list at off=%d\n", off)); return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); } +#endif /* update a record tailer (must hold allocation lock) */ @@ -93,8 +100,6 @@ static int update_tailer(struct tdb_context *tdb, tdb_off_t offset, neccessary. */ int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec) { - tdb_off_t right, left; - /* Allocation and tailer lock */ if (tdb_lock(tdb, -1, F_WRLCK) != 0) return -1; @@ -105,9 +110,10 @@ int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec) goto fail; } +#if USE_RIGHT_MERGES /* Look right first (I'm an Australian, dammit) */ - right = offset + sizeof(*rec) + rec->rec_len; - if (right + sizeof(*rec) <= tdb->map_size) { + if (offset + sizeof(*rec) + rec->rec_len + sizeof(*rec) <= tdb->map_size) { + tdb_off_t right = offset + sizeof(*rec) + rec->rec_len; struct list_struct r; if (tdb->methods->tdb_read(tdb, right, &r, sizeof(r), DOCONV()) == -1) { @@ -122,13 +128,18 @@ int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec) goto left; } rec->rec_len += sizeof(r) + r.rec_len; + if (update_tailer(tdb, offset, rec) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed at %u\n", offset)); + goto fail; + } } } - left: +#endif + /* Look left */ - left = offset - sizeof(tdb_off_t); - if (left > TDB_DATA_START(tdb->header.hash_size)) { + if (offset - sizeof(tdb_off_t) > TDB_DATA_START(tdb->header.hash_size)) { + tdb_off_t left = offset - sizeof(tdb_off_t); struct list_struct l; tdb_off_t leftsize; @@ -145,7 +156,12 @@ left: left = offset - leftsize; - /* Now read in record */ + if (leftsize > offset || + left < TDB_DATA_START(tdb->header.hash_size)) { + goto update; + } + + /* Now read in the left record */ if (tdb->methods->tdb_read(tdb, left, &l, sizeof(l), DOCONV()) == -1) { TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: left read failed at %u (%u)\n", left, leftsize)); goto update; @@ -153,21 +169,24 @@ left: /* If it's free, expand to include it. */ if (l.magic == TDB_FREE_MAGIC) { - if (remove_from_freelist(tdb, left, l.next) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: left free failed at %u\n", left)); - goto update; - } else { - offset = left; - rec->rec_len += leftsize; + /* we now merge the new record into the left record, rather than the other + way around. This makes the operation O(1) instead of O(n). This change + prevents traverse from being O(n^2) after a lot of deletes */ + l.rec_len += sizeof(*rec) + rec->rec_len; + if (tdb_rec_write(tdb, left, &l) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_left failed at %u\n", left)); + goto fail; } + if (update_tailer(tdb, left, &l) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed at %u\n", offset)); + goto fail; + } + tdb_unlock(tdb, -1, F_WRLCK); + return 0; } } update: - if (update_tailer(tdb, offset, rec) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed at %u\n", offset)); - goto fail; - } /* Now, prepend to free list */ rec->magic = TDB_FREE_MAGIC; @@ -261,6 +280,7 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st tdb_off_t rec_ptr, last_ptr; tdb_len_t rec_len; } bestfit; + float multiplier = 1.0; if (tdb_lock(tdb, -1, F_WRLCK) == -1) return 0; @@ -295,18 +315,27 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st bestfit.rec_len = rec->rec_len; bestfit.rec_ptr = rec_ptr; bestfit.last_ptr = last_ptr; - /* consider a fit to be good enough if - we aren't wasting more than half - the space */ - if (bestfit.rec_len < 2*length) { - break; - } } } /* move to the next record */ last_ptr = rec_ptr; rec_ptr = rec->next; + + /* if we've found a record that is big enough, then + stop searching if its also not too big. The + definition of 'too big' changes as we scan + through */ + if (bestfit.rec_len > 0 && + bestfit.rec_len < length * multiplier) { + break; + } + + /* this multiplier means we only extremely rarely + search more than 50 or so records. At 50 records we + accept records up to 11 times larger than what we + want */ + multiplier *= 1.05; } if (bestfit.rec_ptr != 0) { @@ -328,3 +357,25 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st return 0; } + + +/* + return the size of the freelist - used to decide if we should repack +*/ +int tdb_freelist_size(struct tdb_context *tdb) +{ + tdb_off_t ptr; + int count=0; + + if (tdb_lock(tdb, -1, F_RDLCK) == -1) { + return -1; + } + + ptr = FREELIST_TOP; + while (tdb_ofs_read(tdb, ptr, &ptr) == 0 && ptr != 0) { + count++; + } + + tdb_unlock(tdb, -1, F_RDLCK); + return count; +} diff --git a/source3/lib/tdb/common/io.c b/source3/lib/tdb/common/io.c index 8ab0768883..172ab69d8c 100644 --- a/source3/lib/tdb/common/io.c +++ b/source3/lib/tdb/common/io.c @@ -101,8 +101,8 @@ static int tdb_write(struct tdb_context *tdb, tdb_off_t off, off+written); } if (written == -1) { - /* Ensure ecode is set for log fn. */ - tdb->ecode = TDB_ERR_IO; + /* Ensure ecode is set for log fn. */ + tdb->ecode = TDB_ERR_IO; TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_write failed at %d " "len=%d (%s)\n", off, len, strerror(errno))); return TDB_ERRCODE(TDB_ERR_IO, -1); @@ -111,8 +111,8 @@ static int tdb_write(struct tdb_context *tdb, tdb_off_t off, "write %d bytes at %d in two attempts\n", len, off)); errno = ENOSPC; - return TDB_ERRCODE(TDB_ERR_IO, -1); - } + return TDB_ERRCODE(TDB_ERR_IO, -1); + } } return 0; } @@ -230,7 +230,7 @@ void tdb_mmap(struct tdb_context *tdb) says to use for mmap expansion */ static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t addition) { - char buf[1024]; + char buf[8192]; if (tdb->read_only || tdb->traverse_read) { tdb->ecode = TDB_ERR_RDONLY; @@ -294,7 +294,7 @@ static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t ad int tdb_expand(struct tdb_context *tdb, tdb_off_t size) { struct list_struct rec; - tdb_off_t offset; + tdb_off_t offset, new_size; if (tdb_lock(tdb, -1, F_WRLCK) == -1) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "lock failed in tdb_expand\n")); @@ -304,9 +304,11 @@ int tdb_expand(struct tdb_context *tdb, tdb_off_t size) /* must know about any previous expansions by another process */ tdb->methods->tdb_oob(tdb, tdb->map_size + 1, 1); - /* always make room for at least 10 more records, and round - the database up to a multiple of the page size */ - size = TDB_ALIGN(tdb->map_size + size*10, tdb->page_size) - tdb->map_size; + /* always make room for at least 100 more records, and at + least 25% more space. Round the database up to a multiple + of the page size */ + new_size = MAX(tdb->map_size + size*100, tdb->map_size * 1.25); + size = TDB_ALIGN(new_size, tdb->page_size) - tdb->map_size; if (!(tdb->flags & TDB_INTERNAL)) tdb_munmap(tdb); diff --git a/source3/lib/tdb/common/lock.c b/source3/lib/tdb/common/lock.c index e3fe888c46..f156c0fa7b 100644 --- a/source3/lib/tdb/common/lock.c +++ b/source3/lib/tdb/common/lock.c @@ -505,6 +505,9 @@ int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key) /* record lock stops delete underneath */ int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off) { + if (tdb->global_lock.count) { + return 0; + } return off ? tdb->methods->tdb_brlock(tdb, off, F_RDLCK, F_SETLKW, 0, 1) : 0; } @@ -537,6 +540,10 @@ int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off) struct tdb_traverse_lock *i; uint32_t count = 0; + if (tdb->global_lock.count) { + return 0; + } + if (off == 0) return 0; for (i = &tdb->travlocks; i; i = i->next) diff --git a/source3/lib/tdb/common/open.c b/source3/lib/tdb/common/open.c index 6efa482ac2..6bd8fda2bf 100644 --- a/source3/lib/tdb/common/open.c +++ b/source3/lib/tdb/common/open.c @@ -35,7 +35,7 @@ static struct tdb_context *tdbs = NULL; static unsigned int default_tdb_hash(TDB_DATA *key) { uint32_t value; /* Used to compute the hash value. */ - uint32_t i; /* Used to cycle through random values. */ + uint32_t i; /* Used to cycle through random values. */ /* Set the initial value from the key size. */ for (value = 0x238F13AF * key->dsize, i=0; i < key->dsize; i++) @@ -90,7 +90,7 @@ static int tdb_new_database(struct tdb_context *tdb, int hash_size) size -= written; written = write(tdb->fd, newdb+written, size); if (written == size) { - ret = 0; + ret = 0; } else if (written >= 0) { /* a second incomplete write - we give up. * guessing the errno... */ @@ -152,6 +152,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, int rev = 0, locked = 0; unsigned char *vp; uint32_t vertest; + unsigned v; if (!(tdb = (struct tdb_context *)calloc(1, sizeof *tdb))) { /* Can't log this */ @@ -178,7 +179,9 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->page_size = 0x2000; } - tdb->max_dead_records = (open_flags & TDB_VOLATILE) ? 5 : 0; + if (open_flags & TDB_VOLATILE) { + tdb->max_dead_records = 5; + } if ((open_flags & O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n", @@ -213,6 +216,10 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, goto fail; /* errno set by open(2) */ } + /* on exec, don't inherit the fd */ + v = fcntl(tdb->fd, F_GETFD, 0); + fcntl(tdb->fd, F_SETFD, v | FD_CLOEXEC); + /* ensure there is only one process initialising at once */ if (tdb->methods->tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0, 1) == -1) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to get global lock on %s: %s\n", @@ -240,7 +247,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, /* its not a valid database - possibly initialise it */ if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) { if (errno == 0) { - errno = EIO; /* ie bad format or something */ + errno = EIO; /* ie bad format or something */ } goto fail; } @@ -281,6 +288,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; + tdb->max_dead_records = 0; tdb_mmap(tdb); if (locked) { if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) { diff --git a/source3/lib/tdb/common/tdb.c b/source3/lib/tdb/common/tdb.c index 0e9d1dbd74..bf3abb71ac 100644 --- a/source3/lib/tdb/common/tdb.c +++ b/source3/lib/tdb/common/tdb.c @@ -102,8 +102,7 @@ static tdb_off_t tdb_find(struct tdb_context *tdb, TDB_DATA key, uint32_t hash, } /* As tdb_find, but if you succeed, keep the lock */ -tdb_off_t tdb_find_lock_hash(struct tdb_context *tdb, TDB_DATA key, - uint32_t hash, int locktype, +tdb_off_t tdb_find_lock_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash, int locktype, struct list_struct *rec) { uint32_t rec_ptr; @@ -237,14 +236,15 @@ int tdb_exists(struct tdb_context *tdb, TDB_DATA key) } /* actually delete an entry in the database given the offset */ -int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct*rec) +int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct *rec) { tdb_off_t last_ptr, i; struct list_struct lastrec; if (tdb->read_only || tdb->traverse_read) return -1; - if (tdb_write_lock_record(tdb, rec_ptr) == -1) { + if (tdb->traverse_write != 0 || + tdb_write_lock_record(tdb, rec_ptr) == -1) { /* Someone traversing here: mark it as dead */ rec->magic = TDB_DEAD_MAGIC; return tdb_rec_write(tdb, rec_ptr, rec); @@ -666,6 +666,16 @@ int tdb_get_flags(struct tdb_context *tdb) return tdb->flags; } +void tdb_add_flags(struct tdb_context *tdb, unsigned flags) +{ + tdb->flags |= flags; +} + +void tdb_remove_flags(struct tdb_context *tdb, unsigned flags) +{ + tdb->flags &= ~flags; +} + /* enable sequence number handling on an open tdb @@ -674,3 +684,57 @@ void tdb_enable_seqnum(struct tdb_context *tdb) { tdb->flags |= TDB_SEQNUM; } + + +/* + wipe the entire database, deleting all records. This can be done + very fast by using a global lock. The entire data portion of the + file becomes a single entry in the freelist. + */ +int tdb_wipe_all(struct tdb_context *tdb) +{ + int i; + tdb_off_t offset = 0; + ssize_t data_len; + + if (tdb_lockall(tdb) != 0) { + return -1; + } + + /* wipe the hashes */ + for (i=0;iheader.hash_size;i++) { + if (tdb_ofs_write(tdb, TDB_HASH_TOP(i), &offset) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write hash %d\n", i)); + goto failed; + } + } + + /* wipe the freelist */ + if (tdb_ofs_write(tdb, FREELIST_TOP, &offset) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write freelist\n")); + goto failed; + } + + /* add all the rest of the file to the freelist */ + data_len = (tdb->map_size - TDB_DATA_START(tdb->header.hash_size)) - sizeof(struct list_struct); + if (data_len > 0) { + struct list_struct rec; + memset(&rec,'\0',sizeof(rec)); + rec.rec_len = data_len; + if (tdb_free(tdb, TDB_DATA_START(tdb->header.hash_size), &rec) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to add free record\n")); + goto failed; + } + } + + if (tdb_unlockall(tdb) != 0) { + TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to unlock\n")); + goto failed; + } + + return 0; + +failed: + tdb_unlockall(tdb); + return -1; +} diff --git a/source3/lib/tdb/common/tdb_private.h b/source3/lib/tdb/common/tdb_private.h index 58c30c1706..63a6d04e72 100644 --- a/source3/lib/tdb/common/tdb_private.h +++ b/source3/lib/tdb/common/tdb_private.h @@ -38,6 +38,10 @@ typedef uint32_t tdb_len_t; typedef uint32_t tdb_off_t; +#ifndef offsetof +#define offsetof(t,f) ((unsigned int)&((t *)0)->f) +#endif + #define TDB_MAGIC_FOOD "TDB file\n" #define TDB_VERSION (0x26011967 + 6) #define TDB_MAGIC (0x26011999U) @@ -54,7 +58,7 @@ typedef uint32_t tdb_off_t; #define TDB_BAD_MAGIC(r) ((r)->magic != TDB_MAGIC && !TDB_DEAD(r)) #define TDB_HASH_TOP(hash) (FREELIST_TOP + (BUCKET(hash)+1)*sizeof(tdb_off_t)) #define TDB_HASHTABLE_SIZE(tdb) ((tdb->header.hash_size+1)*sizeof(tdb_off_t)) -#define TDB_DATA_START(hash_size) TDB_HASH_TOP(hash_size-1) +#define TDB_DATA_START(hash_size) (TDB_HASH_TOP(hash_size-1) + sizeof(tdb_off_t)) #define TDB_RECOVERY_HEAD offsetof(struct tdb_header, recovery_start) #define TDB_SEQNUM_OFS offsetof(struct tdb_header, sequence_number) #define TDB_PAD_BYTE 0x42 @@ -144,6 +148,7 @@ struct tdb_context { tdb_len_t map_size; /* how much space has been mapped */ int read_only; /* opened read-only */ int traverse_read; /* read-only traversal */ + int traverse_write; /* read-write traversal */ struct tdb_lock_type global_lock; int num_lockrecs; struct tdb_lock_type *lockrecs; /* only real locks, all with count>0 */ @@ -173,7 +178,6 @@ struct tdb_context { int tdb_munmap(struct tdb_context *tdb); void tdb_mmap(struct tdb_context *tdb); int tdb_lock(struct tdb_context *tdb, int list, int ltype); -int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype); int tdb_unlock(struct tdb_context *tdb, int list, int ltype); int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset, int rw_type, int lck_type, int probe, size_t len); int tdb_transaction_lock(struct tdb_context *tdb, int ltype); diff --git a/source3/lib/tdb/common/transaction.c b/source3/lib/tdb/common/transaction.c index 7eaacf7a16..2da09face0 100644 --- a/source3/lib/tdb/common/transaction.c +++ b/source3/lib/tdb/common/transaction.c @@ -87,13 +87,6 @@ */ -struct tdb_transaction_el { - struct tdb_transaction_el *next, *prev; - tdb_off_t offset; - tdb_len_t length; - unsigned char *data; -}; - /* hold the context of any current transaction */ @@ -105,12 +98,12 @@ struct tdb_transaction { /* the original io methods - used to do IOs to the real db */ const struct tdb_methods *io_methods; - /* the list of transaction elements. We use a doubly linked - list with a last pointer to allow us to keep the list - ordered, with first element at the front of the list. It - needs to be doubly linked as the read/write traversals need - to be backwards, while the commit needs to be forwards */ - struct tdb_transaction_el *elements, *elements_last; + /* the list of transaction blocks. When a block is first + written to, it gets created in this list */ + uint8_t **blocks; + uint32_t num_blocks; + uint32_t block_size; /* bytes in each block */ + uint32_t last_block_size; /* number of valid bytes in the last block */ /* non-zero when an internal transaction error has occurred. All write operations will then fail until the @@ -134,52 +127,48 @@ struct tdb_transaction { static int transaction_read(struct tdb_context *tdb, tdb_off_t off, void *buf, tdb_len_t len, int cv) { - struct tdb_transaction_el *el; - - /* we need to walk the list backwards to get the most recent data */ - for (el=tdb->transaction->elements_last;el;el=el->prev) { - tdb_len_t partial; + uint32_t blk; - if (off+len <= el->offset) { - continue; - } - if (off >= el->offset + el->length) { - continue; + /* break it down into block sized ops */ + while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) { + tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size); + if (transaction_read(tdb, off, buf, len2, cv) != 0) { + return -1; } + len -= len2; + off += len2; + buf = (void *)(len2 + (char *)buf); + } - /* an overlapping read - needs to be split into up to - 2 reads and a memcpy */ - if (off < el->offset) { - partial = el->offset - off; - if (transaction_read(tdb, off, buf, partial, cv) != 0) { - goto fail; - } - len -= partial; - off += partial; - buf = (void *)(partial + (char *)buf); - } - if (off + len <= el->offset + el->length) { - partial = len; - } else { - partial = el->offset + el->length - off; - } - memcpy(buf, el->data + (off - el->offset), partial); - if (cv) { - tdb_convert(buf, len); - } - len -= partial; - off += partial; - buf = (void *)(partial + (char *)buf); - - if (len != 0 && transaction_read(tdb, off, buf, len, cv) != 0) { + if (len == 0) { + return 0; + } + + blk = off / tdb->transaction->block_size; + + /* see if we have it in the block list */ + if (tdb->transaction->num_blocks <= blk || + tdb->transaction->blocks[blk] == NULL) { + /* nope, do a real read */ + if (tdb->transaction->io_methods->tdb_read(tdb, off, buf, len, cv) != 0) { goto fail; } - return 0; } - /* its not in the transaction elements - do a real read */ - return tdb->transaction->io_methods->tdb_read(tdb, off, buf, len, cv); + /* it is in the block list. Now check for the last block */ + if (blk == tdb->transaction->num_blocks-1) { + if (len > tdb->transaction->last_block_size) { + goto fail; + } + } + + /* now copy it out of this block */ + memcpy(buf, tdb->transaction->blocks[blk] + (off % tdb->transaction->block_size), len); + if (cv) { + tdb_convert(buf, len); + } + return 0; fail: TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_read: failed at off=%d len=%d\n", off, len)); @@ -195,12 +184,8 @@ fail: static int transaction_write(struct tdb_context *tdb, tdb_off_t off, const void *buf, tdb_len_t len) { - struct tdb_transaction_el *el, *best_el=NULL; + uint32_t blk; - if (len == 0) { - return 0; - } - /* if the write is to a hash head, then update the transaction hash heads */ if (len == sizeof(tdb_off_t) && off >= FREELIST_TOP && @@ -209,106 +194,88 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off, memcpy(&tdb->transaction->hash_heads[chain], buf, len); } - /* first see if we can replace an existing entry */ - for (el=tdb->transaction->elements_last;el;el=el->prev) { - tdb_len_t partial; - - if (best_el == NULL && off == el->offset+el->length) { - best_el = el; + /* break it up into block sized chunks */ + while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) { + tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size); + if (transaction_write(tdb, off, buf, len2) != 0) { + return -1; } - - if (off+len <= el->offset) { - continue; - } - if (off >= el->offset + el->length) { - continue; + len -= len2; + off += len2; + if (buf != NULL) { + buf = (const void *)(len2 + (const char *)buf); } + } - /* an overlapping write - needs to be split into up to - 2 writes and a memcpy */ - if (off < el->offset) { - partial = el->offset - off; - if (transaction_write(tdb, off, buf, partial) != 0) { - goto fail; - } - len -= partial; - off += partial; - buf = (const void *)(partial + (const char *)buf); - } - if (off + len <= el->offset + el->length) { - partial = len; + if (len == 0) { + return 0; + } + + blk = off / tdb->transaction->block_size; + off = off % tdb->transaction->block_size; + + if (tdb->transaction->num_blocks <= blk) { + uint8_t **new_blocks; + /* expand the blocks array */ + if (tdb->transaction->blocks == NULL) { + new_blocks = malloc((blk+1)*sizeof(uint8_t *)); } else { - partial = el->offset + el->length - off; + new_blocks = realloc(tdb->transaction->blocks, (blk+1)*sizeof(uint8_t *)); } - memcpy(el->data + (off - el->offset), buf, partial); - len -= partial; - off += partial; - buf = (const void *)(partial + (const char *)buf); - - if (len != 0 && transaction_write(tdb, off, buf, len) != 0) { + if (new_blocks == NULL) { + tdb->ecode = TDB_ERR_OOM; goto fail; } - - return 0; + memset(&new_blocks[tdb->transaction->num_blocks], 0, + (1+(blk - tdb->transaction->num_blocks))*sizeof(uint8_t *)); + tdb->transaction->blocks = new_blocks; + tdb->transaction->num_blocks = blk+1; + tdb->transaction->last_block_size = 0; } - /* see if we can append the new entry to an existing entry */ - if (best_el && best_el->offset + best_el->length == off && - (off+len < tdb->transaction->old_map_size || - off > tdb->transaction->old_map_size)) { - unsigned char *data = best_el->data; - el = best_el; - el->data = (unsigned char *)realloc(el->data, - el->length + len); - if (el->data == NULL) { + /* allocate and fill a block? */ + if (tdb->transaction->blocks[blk] == NULL) { + tdb->transaction->blocks[blk] = (uint8_t *)calloc(tdb->transaction->block_size, 1); + if (tdb->transaction->blocks[blk] == NULL) { tdb->ecode = TDB_ERR_OOM; tdb->transaction->transaction_error = 1; - el->data = data; - return -1; + return -1; } - if (buf) { - memcpy(el->data + el->length, buf, len); - } else { - memset(el->data + el->length, TDB_PAD_BYTE, len); + if (tdb->transaction->old_map_size > blk * tdb->transaction->block_size) { + tdb_len_t len2 = tdb->transaction->block_size; + if (len2 + (blk * tdb->transaction->block_size) > tdb->transaction->old_map_size) { + len2 = tdb->transaction->old_map_size - (blk * tdb->transaction->block_size); + } + if (tdb->transaction->io_methods->tdb_read(tdb, blk * tdb->transaction->block_size, + tdb->transaction->blocks[blk], + len2, 0) != 0) { + SAFE_FREE(tdb->transaction->blocks[blk]); + tdb->ecode = TDB_ERR_IO; + goto fail; + } + if (blk == tdb->transaction->num_blocks-1) { + tdb->transaction->last_block_size = len2; + } } - el->length += len; - return 0; } - - /* add a new entry at the end of the list */ - el = (struct tdb_transaction_el *)malloc(sizeof(*el)); - if (el == NULL) { - tdb->ecode = TDB_ERR_OOM; - tdb->transaction->transaction_error = 1; - return -1; - } - el->next = NULL; - el->prev = tdb->transaction->elements_last; - el->offset = off; - el->length = len; - el->data = (unsigned char *)malloc(len); - if (el->data == NULL) { - free(el); - tdb->ecode = TDB_ERR_OOM; - tdb->transaction->transaction_error = 1; - return -1; - } - if (buf) { - memcpy(el->data, buf, len); + + /* overwrite part of an existing block */ + if (buf == NULL) { + memset(tdb->transaction->blocks[blk] + off, 0, len); } else { - memset(el->data, TDB_PAD_BYTE, len); + memcpy(tdb->transaction->blocks[blk] + off, buf, len); } - if (el->prev) { - el->prev->next = el; - } else { - tdb->transaction->elements = el; + if (blk == tdb->transaction->num_blocks-1) { + if (len + off > tdb->transaction->last_block_size) { + tdb->transaction->last_block_size = len + off; + } } - tdb->transaction->elements_last = el; + return 0; fail: - TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", off, len)); - tdb->ecode = TDB_ERR_IO; + TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", + (blk*tdb->transaction->block_size) + off, len)); tdb->transaction->transaction_error = 1; return -1; } @@ -419,10 +386,14 @@ int tdb_transaction_start(struct tdb_context *tdb) return -1; } + /* a page at a time seems like a reasonable compromise between compactness and efficiency */ + tdb->transaction->block_size = tdb->page_size; + /* get the transaction write lock. This is a blocking lock. As discussed with Volker, there are a number of ways we could make this async, which we will probably do in the future */ if (tdb_transaction_lock(tdb, F_WRLCK) == -1) { + SAFE_FREE(tdb->transaction->blocks); SAFE_FREE(tdb->transaction); return -1; } @@ -460,21 +431,12 @@ int tdb_transaction_start(struct tdb_context *tdb) tdb->transaction->io_methods = tdb->methods; tdb->methods = &transaction_methods; - /* by calling this transaction write here, we ensure that we don't grow the - transaction linked list due to hash table updates */ - if (transaction_write(tdb, FREELIST_TOP, tdb->transaction->hash_heads, - TDB_HASHTABLE_SIZE(tdb)) != 0) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_start: failed to prime hash table\n")); - tdb->ecode = TDB_ERR_IO; - tdb->methods = tdb->transaction->io_methods; - goto fail; - } - return 0; fail: tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0); tdb_transaction_unlock(tdb); + SAFE_FREE(tdb->transaction->blocks); SAFE_FREE(tdb->transaction->hash_heads); SAFE_FREE(tdb->transaction); return -1; @@ -486,6 +448,8 @@ fail: */ int tdb_transaction_cancel(struct tdb_context *tdb) { + int i; + if (tdb->transaction == NULL) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_cancel: no transaction\n")); return -1; @@ -499,13 +463,13 @@ int tdb_transaction_cancel(struct tdb_context *tdb) tdb->map_size = tdb->transaction->old_map_size; - /* free all the transaction elements */ - while (tdb->transaction->elements) { - struct tdb_transaction_el *el = tdb->transaction->elements; - tdb->transaction->elements = el->next; - free(el->data); - free(el); + /* free all the transaction blocks */ + for (i=0;itransaction->num_blocks;i++) { + if (tdb->transaction->blocks[i] != NULL) { + free(tdb->transaction->blocks[i]); + } } + SAFE_FREE(tdb->transaction->blocks); /* remove any global lock created during the transaction */ if (tdb->global_lock.count != 0) { @@ -515,7 +479,6 @@ int tdb_transaction_cancel(struct tdb_context *tdb) /* remove any locks created during the transaction */ if (tdb->num_locks != 0) { - int i; for (i=0;inum_lockrecs;i++) { tdb_brlock(tdb,FREELIST_TOP+4*tdb->lockrecs[i].list, F_UNLCK,F_SETLKW, 0, 1); @@ -567,16 +530,24 @@ static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t */ static tdb_len_t tdb_recovery_size(struct tdb_context *tdb) { - struct tdb_transaction_el *el; tdb_len_t recovery_size = 0; + int i; recovery_size = sizeof(uint32_t); - for (el=tdb->transaction->elements;el;el=el->next) { - if (el->offset >= tdb->transaction->old_map_size) { + for (i=0;itransaction->num_blocks;i++) { + if (i * tdb->transaction->block_size >= tdb->transaction->old_map_size) { + break; + } + if (tdb->transaction->blocks[i] == NULL) { continue; } - recovery_size += 2*sizeof(tdb_off_t) + el->length; - } + recovery_size += 2*sizeof(tdb_off_t); + if (i == tdb->transaction->num_blocks-1) { + recovery_size += tdb->transaction->last_block_size; + } else { + recovery_size += tdb->transaction->block_size; + } + } return recovery_size; } @@ -669,7 +640,6 @@ static int tdb_recovery_allocate(struct tdb_context *tdb, static int transaction_setup_recovery(struct tdb_context *tdb, tdb_off_t *magic_offset) { - struct tdb_transaction_el *el; tdb_len_t recovery_size; unsigned char *data, *p; const struct tdb_methods *methods = tdb->transaction->io_methods; @@ -677,6 +647,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb, tdb_off_t recovery_offset, recovery_max_size; tdb_off_t old_map_size = tdb->transaction->old_map_size; uint32_t magic, tailer; + int i; /* check that the recovery area has enough space @@ -704,30 +675,43 @@ static int transaction_setup_recovery(struct tdb_context *tdb, /* build the recovery data into a single blob to allow us to do a single large write, which should be more efficient */ p = data + sizeof(*rec); - for (el=tdb->transaction->elements;el;el=el->next) { - if (el->offset >= old_map_size) { + for (i=0;itransaction->num_blocks;i++) { + tdb_off_t offset; + tdb_len_t length; + + if (tdb->transaction->blocks[i] == NULL) { continue; } - if (el->offset + el->length > tdb->transaction->old_map_size) { + + offset = i * tdb->transaction->block_size; + length = tdb->transaction->block_size; + if (i == tdb->transaction->num_blocks-1) { + length = tdb->transaction->last_block_size; + } + + if (offset >= old_map_size) { + continue; + } + if (offset + length > tdb->transaction->old_map_size) { TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: transaction data over new region boundary\n")); free(data); tdb->ecode = TDB_ERR_CORRUPT; return -1; } - memcpy(p, &el->offset, 4); - memcpy(p+4, &el->length, 4); + memcpy(p, &offset, 4); + memcpy(p+4, &length, 4); if (DOCONV()) { tdb_convert(p, 8); } /* the recovery area contains the old data, not the new data, so we have to call the original tdb_read method to get it */ - if (methods->tdb_read(tdb, el->offset, p + 8, el->length, 0) != 0) { + if (methods->tdb_read(tdb, offset, p + 8, length, 0) != 0) { free(data); tdb->ecode = TDB_ERR_IO; return -1; } - p += 8 + el->length; + p += 8 + length; } /* and the tailer */ @@ -780,6 +764,7 @@ int tdb_transaction_commit(struct tdb_context *tdb) const struct tdb_methods *methods; tdb_off_t magic_offset = 0; uint32_t zero = 0; + int i; if (tdb->transaction == NULL) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_commit: no transaction\n")); @@ -799,7 +784,7 @@ int tdb_transaction_commit(struct tdb_context *tdb) } /* check for a null transaction */ - if (tdb->transaction->elements == NULL) { + if (tdb->transaction->blocks == NULL) { tdb_transaction_cancel(tdb); return 0; } @@ -858,10 +843,21 @@ int tdb_transaction_commit(struct tdb_context *tdb) } /* perform all the writes */ - while (tdb->transaction->elements) { - struct tdb_transaction_el *el = tdb->transaction->elements; + for (i=0;itransaction->num_blocks;i++) { + tdb_off_t offset; + tdb_len_t length; - if (methods->tdb_write(tdb, el->offset, el->data, el->length) == -1) { + if (tdb->transaction->blocks[i] == NULL) { + continue; + } + + offset = i * tdb->transaction->block_size; + length = tdb->transaction->block_size; + if (i == tdb->transaction->num_blocks-1) { + length = tdb->transaction->last_block_size; + } + + if (methods->tdb_write(tdb, offset, tdb->transaction->blocks[i], length) == -1) { TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: write failed during commit\n")); /* we've overwritten part of the data and @@ -876,11 +872,12 @@ int tdb_transaction_commit(struct tdb_context *tdb) TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: write failed\n")); return -1; } - tdb->transaction->elements = el->next; - free(el->data); - free(el); + SAFE_FREE(tdb->transaction->blocks[i]); } + SAFE_FREE(tdb->transaction->blocks); + tdb->transaction->num_blocks = 0; + if (!(tdb->flags & TDB_NOSYNC)) { /* ensure the new data is on disk */ if (transaction_sync(tdb, 0, tdb->map_size) == -1) { diff --git a/source3/lib/tdb/common/traverse.c b/source3/lib/tdb/common/traverse.c index 27b2cfc54a..07b0c23858 100644 --- a/source3/lib/tdb/common/traverse.c +++ b/source3/lib/tdb/common/traverse.c @@ -241,7 +241,9 @@ int tdb_traverse(struct tdb_context *tdb, return -1; } + tdb->traverse_write++; ret = tdb_traverse_internal(tdb, fn, private_data, &tl); + tdb->traverse_write--; tdb_transaction_unlock(tdb); @@ -333,3 +335,4 @@ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey) TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: WARNING tdb_unlock failed!\n")); return key; } + diff --git a/source3/lib/tdb/configure.ac b/source3/lib/tdb/configure.ac index de8fc9c2b5..1085055bc9 100644 --- a/source3/lib/tdb/configure.ac +++ b/source3/lib/tdb/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.50) AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""]) AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""]) AC_DEFUN([SMB_ENABLE], [echo -n ""]) -AC_INIT(tdb, 1.1.0) +AC_INIT(tdb, 1.1.1) AC_CONFIG_SRCDIR([common/tdb.c]) AC_CONFIG_HEADER(include/config.h) AC_LIBREPLACE_ALL_CHECKS diff --git a/source3/lib/tdb/include/tdb.h b/source3/lib/tdb/include/tdb.h index fce6628b84..0008085de5 100644 --- a/source3/lib/tdb/include/tdb.h +++ b/source3/lib/tdb/include/tdb.h @@ -135,6 +135,8 @@ int tdb_get_seqnum(struct tdb_context *tdb); int tdb_hash_size(struct tdb_context *tdb); size_t tdb_map_size(struct tdb_context *tdb); int tdb_get_flags(struct tdb_context *tdb); +void tdb_add_flags(struct tdb_context *tdb, unsigned flag); +void tdb_remove_flags(struct tdb_context *tdb, unsigned flag); void tdb_enable_seqnum(struct tdb_context *tdb); void tdb_increment_seqnum_nonblock(struct tdb_context *tdb); @@ -153,6 +155,8 @@ void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr) void tdb_dump_all(struct tdb_context *tdb); int tdb_printfreelist(struct tdb_context *tdb); int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); +int tdb_wipe_all(struct tdb_context *tdb); +int tdb_freelist_size(struct tdb_context *tdb); extern TDB_DATA tdb_null; -- cgit From fbd6d14fc8b0e459d9f105989c449ef9f3f98c79 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 18:49:20 +0100 Subject: Use domain_is_ad one more time in libnetjoin. Guenther (This used to be commit 82bd6322b691506ddea2b274973e614fa8c6ee5e) --- source3/libnet/libnet_join.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 1df85ebb61..ea92059fb4 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -678,14 +678,13 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, memcpy(&pwbuf[516], md5buffer, sizeof(md5buffer)); acb_info |= ACB_PWNOEXP; -#if 0 - if ( dom_type == ND_TYPE_AD ) { + if (r->out.domain_is_ad) { #if !defined(ENCTYPE_ARCFOUR_HMAC) acb_info |= ACB_USE_DES_KEY_ONLY; #endif ;; } -#endif + ZERO_STRUCT(ctr); ZERO_STRUCT(p25); -- cgit From 9d164c409442c54a17791865b77f6b5b3d136d80 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 11 Jan 2008 18:51:15 +0100 Subject: Add debug bool flag for libnetjoin ctx. Guenther (This used to be commit 93084487952f4ef23209401d689b3be3af6c9e6e) --- source3/libnet/libnet_join.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h index 95b965717e..c47e8d934c 100644 --- a/source3/libnet/libnet_join.h +++ b/source3/libnet/libnet_join.h @@ -36,6 +36,7 @@ struct libnet_JoinCtx { const char *upn; bool modify_config; struct ads_struct *ads; + bool debug; } in; struct { -- cgit From 8921b2222a9e2db9e185486b247fb5fca448971d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 12 Jan 2008 01:28:20 +0100 Subject: Auto-add missing shares in libnet_conf_set_parameter(). Michael, please have a look. Guenther (This used to be commit 9f4506e5e2828e0f23bc37586770995c3424b208) --- source3/libnet/libnet_conf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 0bdf4805d7..47b4800d80 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -719,8 +719,10 @@ WERROR libnet_conf_set_parameter(const char *service, TALLOC_CTX *mem_ctx = talloc_stackframe(); if (!libnet_conf_share_exists(service)) { - werr = WERR_NO_SUCH_SERVICE; - goto done; + werr = libnet_conf_create_share(service); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } } werr = libnet_conf_reg_open_service_key(mem_ctx, service, REG_KEY_WRITE, -- cgit From a05edb57e753c567c6310d435439c29658cdd089 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 12 Jan 2008 02:10:17 +0100 Subject: Use WITH_ADS define in libnet_join, hopefully not breaking the build. Guenther (This used to be commit 48f638a45525c01db9855e3ef809f08ce65da8d8) --- source3/libnet/libnet_join.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index ea92059fb4..689d8def35 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -58,7 +58,7 @@ static void libnet_unjoin_set_error_string(TALLOC_CTX *mem_ctx, r->out.error_string = tmp; } -#ifdef HAVE_LDAP +#ifdef WITH_ADS /**************************************************************** ****************************************************************/ @@ -426,8 +426,6 @@ static ADS_STATUS libnet_join_set_os_attributes(TALLOC_CTX *mem_ctx, return ads_gen_mod(r->in.ads, r->out.dn, mods); } -#endif /* HAVE_LDAP */ - /**************************************************************** ****************************************************************/ @@ -437,16 +435,14 @@ static bool libnet_join_create_keytab(TALLOC_CTX *mem_ctx, if (!lp_use_kerberos_keytab()) { return true; } -#ifdef HAVE_KRB5 + if (!ads_keytab_create_default(r->in.ads)) { return false; } -#endif /* HAVE_KRB5 */ + return true; } -#ifdef HAVE_KRB5 - /**************************************************************** ****************************************************************/ @@ -495,7 +491,7 @@ static bool libnet_join_derive_salting_principal(TALLOC_CTX *mem_ctx, return kerberos_secrets_store_des_salt(salt); } -#endif /* HAVE_KRB5 */ +#endif /* WITH_ADS */ /**************************************************************** ****************************************************************/ @@ -1021,7 +1017,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r) { NTSTATUS status; -#ifdef HAVE_LDAP +#ifdef WITH_ADS ADS_STATUS ads_status; if (r->in.account_ou) { @@ -1040,7 +1036,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE; } -#endif /* HAVE_LDAP */ +#endif /* WITH_ADS */ status = libnet_join_joindomain_rpc(mem_ctx, r); if (!NT_STATUS_IS_OK(status)) { if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { @@ -1053,7 +1049,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, return WERR_SETUP_NOT_JOINED; } -#ifdef HAVE_LDAP +#ifdef WITH_ADS ads_status = libnet_join_set_machine_spn(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { libnet_join_set_error_string(mem_ctx, r, @@ -1078,13 +1074,11 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, return WERR_GENERAL_FAILURE; } -#ifdef HAVE_KRB5 if (!libnet_join_derive_salting_principal(mem_ctx, r)) { return WERR_GENERAL_FAILURE; } -#endif /* HAVE_KRB5 */ +#endif /* WITH_ADS */ -#endif /* HAVE_LDAP */ if (!libnet_join_create_keytab(mem_ctx, r)) { libnet_join_set_error_string(mem_ctx, r, "failed to create kerberos keytab"); @@ -1148,7 +1142,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, return ntstatus_to_werror(status); } -#ifdef HAVE_LDAP +#ifdef WITH_ADS if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) { ADS_STATUS ads_status; libnet_unjoin_connect_ads(mem_ctx, r); @@ -1159,7 +1153,8 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, ads_errstr(ads_status)); } } -#endif /* HAVE_LDAP */ +#endif /* WITH_ADS */ + libnet_join_unjoindomain_remove_secrets(mem_ctx, r); return WERR_OK; -- cgit From e69c82eb44bce37e882677b47bdb092b99670bd6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 12 Jan 2008 02:15:42 +0100 Subject: Merge all ads related calls in libnet_join_post_processing_ads(). Guenther (This used to be commit b76250f1cf7238613658901b961d68a0da592712) --- source3/libnet/libnet_join.c | 81 +++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 32 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 689d8def35..b2522e9b58 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -491,6 +491,50 @@ static bool libnet_join_derive_salting_principal(TALLOC_CTX *mem_ctx, return kerberos_secrets_store_des_salt(salt); } +/**************************************************************** +****************************************************************/ + +static ADS_STATUS libnet_join_post_processing_ads(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + ADS_STATUS status; + + status = libnet_join_set_machine_spn(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to set machine spn: %s", + ads_errstr(status)); + return status; + } + + status = libnet_join_set_os_attributes(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to set machine os attributes: %s", + ads_errstr(status)); + return status; + } + + status = libnet_join_set_machine_upn(mem_ctx, r); + if (!ADS_ERR_OK(status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to set machine upn: %s", + ads_errstr(status)); + return status; + } + + if (!libnet_join_derive_salting_principal(mem_ctx, r)) { + return ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL); + } + + if (!libnet_join_create_keytab(mem_ctx, r)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to create kerberos keytab"); + return ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL); + } + + return ADS_SUCCESS; +} #endif /* WITH_ADS */ /**************************************************************** @@ -1050,41 +1094,14 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, } #ifdef WITH_ADS - ads_status = libnet_join_set_machine_spn(mem_ctx, r); - if (!ADS_ERR_OK(ads_status)) { - libnet_join_set_error_string(mem_ctx, r, - "failed to set machine spn: %s", - ads_errstr(ads_status)); - return WERR_GENERAL_FAILURE; - } - - ads_status = libnet_join_set_os_attributes(mem_ctx, r); - if (!ADS_ERR_OK(ads_status)) { - libnet_join_set_error_string(mem_ctx, r, - "failed to set machine os attributes: %s", - ads_errstr(ads_status)); - return WERR_GENERAL_FAILURE; - } - - ads_status = libnet_join_set_machine_upn(mem_ctx, r); - if (!ADS_ERR_OK(ads_status)) { - libnet_join_set_error_string(mem_ctx, r, - "failed to set machine upn: %s", - ads_errstr(ads_status)); - return WERR_GENERAL_FAILURE; - } - - if (!libnet_join_derive_salting_principal(mem_ctx, r)) { - return WERR_GENERAL_FAILURE; + if (r->out.domain_is_ad) { + ads_status = libnet_join_post_processing_ads(mem_ctx, r); + if (!ADS_ERR_OK(ads_status)) { + return WERR_GENERAL_FAILURE; + } } #endif /* WITH_ADS */ - if (!libnet_join_create_keytab(mem_ctx, r)) { - libnet_join_set_error_string(mem_ctx, r, - "failed to create kerberos keytab"); - return WERR_GENERAL_FAILURE; - } - return WERR_OK; } -- cgit From bc629c6faf5a575a39a31ffe6ced13165563ca29 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 12 Jan 2008 02:17:10 +0100 Subject: For libnet_join error string functions, make sure not to overwrite last status string. Guenther (This used to be commit a9b76c9e2d93c8aa482dbee54f29d7e1503abe4f) --- source3/libnet/libnet_join.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index b2522e9b58..fbbbb51bbc 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -30,14 +30,14 @@ static void libnet_join_set_error_string(TALLOC_CTX *mem_ctx, const char *format, ...) { va_list args; - char *tmp = NULL; + + if (r->out.error_string) { + return; + } va_start(args, format); - tmp = talloc_vasprintf(mem_ctx, format, args); + r->out.error_string = talloc_vasprintf(mem_ctx, format, args); va_end(args); - - TALLOC_FREE(r->out.error_string); - r->out.error_string = tmp; } /**************************************************************** @@ -48,14 +48,14 @@ static void libnet_unjoin_set_error_string(TALLOC_CTX *mem_ctx, const char *format, ...) { va_list args; - char *tmp = NULL; + + if (r->out.error_string) { + return; + } va_start(args, format); - tmp = talloc_vasprintf(mem_ctx, format, args); + r->out.error_string = talloc_vasprintf(mem_ctx, format, args); va_end(args); - - TALLOC_FREE(r->out.error_string); - r->out.error_string = tmp; } #ifdef WITH_ADS -- cgit From 21ccb47044175128557766f36154e5eecd805318 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 12 Jan 2008 02:19:21 +0100 Subject: Add appropriate error code when pre-creating accounts in ous isnt supported by DC. Guenther (This used to be commit 4a7acf4a2374138b20a5cdebdcc721668bbd865b) --- source3/libnet/libnet_join.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index fbbbb51bbc..4c2e1301ab 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1067,7 +1067,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, if (r->in.account_ou) { ads_status = libnet_join_connect_ads(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { - return WERR_GENERAL_FAILURE; + return WERR_DEFAULT_JOIN_REQUIRED; } ads_status = libnet_join_precreate_machine_acct(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { @@ -1075,7 +1075,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, "failed to precreate account in ou %s: %s", r->in.account_ou, ads_errstr(ads_status)); - return WERR_GENERAL_FAILURE; + return WERR_DEFAULT_JOIN_REQUIRED; } r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE; -- cgit From d4e5cadc1a9917190819bdebd0c14e8f3767503c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 12 Jan 2008 02:20:33 +0100 Subject: Fix some error strings in libnet_join. Guenther (This used to be commit 8af80976a3a8dd9d02a6763e48b2c1d8003ae4dd) --- source3/libnet/libnet_join.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 4c2e1301ab..a46b827257 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -457,7 +457,8 @@ static bool libnet_join_derive_salting_principal(TALLOC_CTX *mem_ctx, status = ads_domain_func_level(r->in.ads, &domain_func); if (!ADS_ERR_OK(status)) { libnet_join_set_error_string(mem_ctx, r, - "Failed to determine domain functional level!"); + "failed to determine domain functional level: %s", + ads_errstr(status)); return false; } @@ -1081,8 +1082,12 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE; } #endif /* WITH_ADS */ + status = libnet_join_joindomain_rpc(mem_ctx, r); if (!NT_STATUS_IS_OK(status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to join domain over rpc: %s", + nt_errstr(status)); if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { return WERR_SETUP_ALREADY_JOINED; } -- cgit From afb163efb76da39aa24f2c71be44ac50419dd27d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 12 Jan 2008 02:22:44 +0100 Subject: Call dsgetdcname when we have no specific dc defined for joining. Guenther (This used to be commit 40e8caa2d81168be3e48ececf5746d8f659a96d6) --- source3/libnet/libnet_join.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index a46b827257..6ec89de15c 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1064,12 +1064,39 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, NTSTATUS status; #ifdef WITH_ADS ADS_STATUS ads_status; +#endif /* WITH_ADS */ + if (!r->in.dc_name) { + struct DS_DOMAIN_CONTROLLER_INFO *info; + status = dsgetdcname(mem_ctx, + NULL, + r->in.domain_name, + NULL, + NULL, + DS_DIRECTORY_SERVICE_REQUIRED | + DS_WRITABLE_REQUIRED | + DS_RETURN_DNS_NAME, + &info); + if (!NT_STATUS_IS_OK(status)) { + libnet_join_set_error_string(mem_ctx, r, + "failed to find DC: %s", + nt_errstr(status)); + return WERR_DOMAIN_CONTROLLER_NOT_FOUND; + } + + r->in.dc_name = talloc_strdup(mem_ctx, + info->domain_controller_name); + W_ERROR_HAVE_NO_MEMORY(r->in.dc_name); + } + +#ifdef WITH_ADS if (r->in.account_ou) { + ads_status = libnet_join_connect_ads(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { return WERR_DEFAULT_JOIN_REQUIRED; } + ads_status = libnet_join_precreate_machine_acct(mem_ctx, r); if (!ADS_ERR_OK(ads_status)) { libnet_join_set_error_string(mem_ctx, r, -- cgit From 45db92cc72eb2472425c17e72ff9254d35d8047c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 12 Jan 2008 02:24:55 +0100 Subject: Fix some indents. Guenther (This used to be commit 57368f883fb217b4196858bb2255c0eea59a8917) --- source3/libnet/libnet_join.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 6ec89de15c..9b62286ecb 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -671,7 +671,8 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, 0xe005000b, &user_pol, &user_rid); if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { - if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) { + if (!(r->in.join_flags & + WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED)) { goto done; } } @@ -908,7 +909,7 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) W_ERROR_NOT_OK_RETURN(werr); werr = libnet_conf_set_global_parameter("realm", - r->out.dns_domain_name); + r->out.dns_domain_name); W_ERROR_NOT_OK_RETURN(werr); } -- cgit From 6fa81523f86c5e136bf3ab2c5b0c9032570d3b96 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 22:44:33 -0800 Subject: Ensure we don't access an uninitialized variable (CID 535 - actually false but easy to shut up :-). Jeremy. (This used to be commit 4038bb3a9485943db58d9fe30947e11522ce283d) --- source3/winbindd/winbindd_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c index f5e1226447..34ba0498e0 100644 --- a/source3/winbindd/winbindd_rpc.c +++ b/source3/winbindd/winbindd_rpc.c @@ -308,7 +308,7 @@ NTSTATUS msrpc_sid_to_name(struct winbindd_domain *domain, { char **domains; char **names; - enum lsa_SidType *types; + enum lsa_SidType *types = NULL; NTSTATUS result; struct rpc_pipe_client *cli; POLICY_HND lsa_policy; -- cgit From d9ee831d0ee7a950a7c8095182f1174026a56ad9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 22:47:25 -0800 Subject: Fix CID 524 - reference before allocation fail null check. Jeremy. (This used to be commit a5cd3c9b65538588a6c982c6d20022e7476cf3de) --- source3/rpc_server/srv_dfs_nt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/rpc_server/srv_dfs_nt.c b/source3/rpc_server/srv_dfs_nt.c index 690ddd60d6..29538a304f 100644 --- a/source3/rpc_server/srv_dfs_nt.c +++ b/source3/rpc_server/srv_dfs_nt.c @@ -133,10 +133,10 @@ WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r) altpath = talloc_asprintf(ctx, "%s\\%s", r->in.servername, r->in.sharename); - strlower_m(altpath); if (!altpath) { return WERR_NOMEM; } + strlower_m(altpath); DEBUG(5,("init_reply_dfs_remove: Request to remove %s -> %s\\%s.\n", r->in.dfs_entry_path, r->in.servername, r->in.sharename)); } -- cgit From 915647da9cb1227378f53a5a386df69e9348754b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 22:50:13 -0800 Subject: Fix CID 523 - wrong null deref check. Jeremy. (This used to be commit 05cadffeab38ca9df7ffd46785b536266c4438c4) --- source3/smbd/mangle_hash2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c index 9643506aea..a9b94aabc3 100644 --- a/source3/smbd/mangle_hash2.c +++ b/source3/smbd/mangle_hash2.c @@ -396,7 +396,7 @@ static bool lookup_name_from_8_3(TALLOC_CTX *ctx, TALLOC_FREE(prefix); - if (!pp_out) { + if (!*pp_out) { M_DEBUG(0,("talloc_fail")); return False; } -- cgit From 9f750996571c75b0be53fdf13705b95bf6126102 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 23:17:23 -0800 Subject: Fix CID 505 - don't copy uninitialized memory. Jeremy. (This used to be commit 0d2c77e8d3a83f2c5e78fa076f22919ef9d124b9) --- source3/smbd/notify.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 5c26cac219..55009ce0b1 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -235,6 +235,7 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter, return NT_STATUS_NO_MEMORY; } + ZERO_STRUCT(e); e.path = fullpath; e.filter = filter; e.subdir_filter = 0; -- cgit From 23aab9dab781a160ababd475e8333c04570fd08d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 23:24:13 -0800 Subject: Fix CID 498. Ensure we don't prs_mem_free an uninitialized prs_struct. Jeremy. (This used to be commit 7b9d9fba230b9e61079869a6a2751cda37fb8a9e) --- source3/printing/nt_printing.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 1a4a26ee6f..bba55c0e4a 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -5326,6 +5326,7 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) SEC_DESC_BUF *new_secdesc_ctr = NULL; SEC_DESC_BUF *old_secdesc_ctr = NULL; prs_struct ps; + bool prs_init_done = false; TALLOC_CTX *mem_ctx = NULL; TDB_DATA kbuf; WERROR status; @@ -5394,6 +5395,8 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) (uint32)ndr_size_security_descriptor(new_secdesc_ctr->sd, 0) + sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL); + prs_init_done = true; + if (!sec_io_desc_buf("nt_printing_setsec", &new_secdesc_ctr, &ps, 1)) { status = WERR_BADFUNC; @@ -5413,7 +5416,9 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) out: - prs_mem_free(&ps); + if (prs_init_done) { + prs_mem_free(&ps); + } if (mem_ctx) talloc_destroy(mem_ctx); return status; -- cgit From bd317be33b7b2acb74a14b18c67581f3d1d5e8f0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 23:41:17 -0800 Subject: Stop Coverity complaining about uninitialized variables. Jeremy. (This used to be commit 041f1d298c1e72adb263b32f454cdf3603e45416) --- source3/utils/net_rpc_rights.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/utils/net_rpc_rights.c b/source3/utils/net_rpc_rights.c index 23be8859e0..5f222b8c7e 100644 --- a/source3/utils/net_rpc_rights.c +++ b/source3/utils/net_rpc_rights.c @@ -28,9 +28,9 @@ static NTSTATUS sid_to_name(struct rpc_pipe_client *pipe_hnd, fstring name) { POLICY_HND pol; - enum lsa_SidType *sid_types; + enum lsa_SidType *sid_types = NULL; NTSTATUS result; - char **domains, **names; + char **domains = NULL, **names = NULL; result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, SEC_RIGHTS_MAXIMUM_ALLOWED, &pol); @@ -202,7 +202,7 @@ static NTSTATUS enum_accounts_for_privilege(struct rpc_pipe_client *pipe_hnd, NTSTATUS result; uint32 enum_context=0; uint32 pref_max_length=0x1000; - DOM_SID *sids; + DOM_SID *sids = NULL; uint32 count=0; int i; fstring name; -- cgit From 866af9a800cbfc022ce6144ee706c0826eb6c39b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 23:43:33 -0800 Subject: Coverity 512, uninitialized var. Jeremy. (This used to be commit 1b7cc80c61ccbf766801080f5a3f0260f40ccc17) --- source3/libads/authdata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c index 500f2d455e..9a6f1061df 100644 --- a/source3/libads/authdata.c +++ b/source3/libads/authdata.c @@ -214,7 +214,7 @@ static bool pac_io_group_membership_array(const char *desc, static bool pac_io_pac_logon_info(const char *desc, PAC_LOGON_INFO *info, prs_struct *ps, int depth) { - uint32 garbage, i; + uint32 garbage = 0, i; if (NULL == info) return False; @@ -398,7 +398,7 @@ static bool pac_io_pac_logon_info(const char *desc, PAC_LOGON_INFO *info, static bool pac_io_pac_logon_info(const char *desc, PAC_LOGON_INFO *info, prs_struct *ps, int depth) { - uint32 garbage; + uint32 garbage = 0; bool kerb_validation_info = True; if (NULL == info) -- cgit From 43717a16e2fca8b196d4a89e33b05fefc0cb02d2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 23:53:27 -0800 Subject: Fix CID 476. Ensure a valid pac_data pointer is always passed to ads_verify_ticket as it's always derefed. Jeremy. (This used to be commit 0599d57efff0f417f75510e8b08c3cb7b4bcfcd8) --- source3/libads/kerberos_verify.c | 3 +-- source3/smbd/sesssetup.c | 3 +-- source3/utils/ntlm_auth.c | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source3/libads/kerberos_verify.c b/source3/libads/kerberos_verify.c index 7040093e90..5ce7aa6b45 100644 --- a/source3/libads/kerberos_verify.c +++ b/source3/libads/kerberos_verify.c @@ -501,8 +501,7 @@ NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx, DEBUG(3,("ads_verify_ticket: did not retrieve auth data. continuing without PAC\n")); } - if (got_auth_data && pac_data != NULL) { - + if (got_auth_data) { pac_ret = decode_pac_data(mem_ctx, &auth_data, context, keyblock, client_principal, authtime, pac_data); if (!NT_STATUS_IS_OK(pac_ret)) { DEBUG(3,("ads_verify_ticket: failed to decode PAC_DATA: %s\n", nt_errstr(pac_ret))); diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index bc1d26faca..aee8e498e9 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -259,7 +259,7 @@ static void reply_spnego_kerberos(struct smb_request *req, fstring user; int sess_vuid = req->vuid; NTSTATUS ret = NT_STATUS_OK; - PAC_DATA *pac_data; + PAC_DATA *pac_data = NULL; DATA_BLOB ap_rep, ap_rep_wrapped, response; auth_serversupplied_info *server_info = NULL; DATA_BLOB session_key = data_blob_null; @@ -271,7 +271,6 @@ static void reply_spnego_kerberos(struct smb_request *req, PAC_LOGON_INFO *logon_info = NULL; ZERO_STRUCT(ticket); - ZERO_STRUCT(pac_data); ZERO_STRUCT(ap_rep); ZERO_STRUCT(ap_rep_wrapped); ZERO_STRUCT(response); diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 7e2771c900..6a702fc0cf 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -1163,6 +1163,7 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode, char *principal; DATA_BLOB ap_rep; DATA_BLOB session_key; + PAC_DATA *pac_data = NULL; if ( request.negTokenInit.mechToken.data == NULL ) { DEBUG(1, ("Client did not provide Kerberos data\n")); @@ -1177,7 +1178,7 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode, status = ads_verify_ticket(mem_ctx, lp_realm(), 0, &request.negTokenInit.mechToken, - &principal, NULL, &ap_rep, + &principal, &pac_data, &ap_rep, &session_key, True); talloc_destroy(mem_ctx); -- cgit From ff98a654d613daad484023250c6619ce09917f6e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Jan 2008 23:56:48 -0800 Subject: Fix CID 475. work should not be checked against NULL here as it can never be null. Jeremy. (This used to be commit ecb52f50fe3ec8beda48b6c88e9a3ae5a6a98d52) --- source3/nmbd/nmbd_incomingdgrams.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c index c0aa385ff6..75ab9419c2 100644 --- a/source3/nmbd/nmbd_incomingdgrams.c +++ b/source3/nmbd/nmbd_incomingdgrams.c @@ -257,7 +257,7 @@ void process_local_master_announce(struct subnet_record *subrec, struct packet_s uint32 servertype = IVAL(buf,23); fstring comment; unstring work_name; - struct work_record *work; + struct work_record *work = NULL; struct server_record *servrec; unstring source_name; @@ -344,7 +344,7 @@ a local master browser for workgroup %s and we think we are master. Forcing elec * This server is announcing it is going down. Remove it from the * workgroup. */ - if(!is_myname(server_name) && (work != NULL) && + if(!is_myname(server_name) && ((servrec = find_server_in_workgroup( work, server_name))!=NULL)) { remove_server_from_workgroup( work, servrec); } -- cgit From 76d904e6d84ea41d824f2ecb4682d84718ff1bdd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 12 Jan 2008 00:05:07 -0800 Subject: Fix CID 470. resolve_order can't be NULL here so simplify code. Jeremy. (This used to be commit 2e75f3ecdf9890b9d7d4bd03f3fa15ef74816d5d) --- source3/libsmb/namequery.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 853fe979b7..ad999b34b4 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1422,14 +1422,13 @@ NTSTATUS resolve_ads(const char *name, resolve_hosts() when looking up DC's via SRV RR entries in DNS **********************************************************************/ -NTSTATUS internal_resolve_name(const char *name, +static NTSTATUS internal_resolve_name(const char *name, int name_type, const char *sitename, struct ip_service **return_iplist, int *return_count, const char *resolve_order) { - const char *name_resolve_list; char *tok; const char *ptr; NTSTATUS status = NT_STATUS_UNSUCCESSFUL; @@ -1483,16 +1482,10 @@ NTSTATUS internal_resolve_name(const char *name, return NT_STATUS_INVALID_PARAMETER; } - if (!resolve_order) { - name_resolve_list = lp_name_resolve_order(); - } else { - name_resolve_list = resolve_order; - } - - if (!name_resolve_list[0]) { + if (!resolve_order[0]) { ptr = "host"; } else { - ptr = name_resolve_list; + ptr = resolve_order; } /* iterate through the name resolution backends */ -- cgit From aa8818bcc38dc3993bc41776ba29adb906c3dd66 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 12 Jan 2008 00:09:35 -0800 Subject: Fix CID 469. new_acct can't be NULL here. Jeremy. (This used to be commit c79e9414c4baed6e61fc6a3f766395b873bcc4ea) --- source3/passdb/pdb_tdb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 5ee1cdc0c0..b05a42b32c 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -1352,8 +1352,7 @@ done: tdbsam_close(); - if (new_acct) - TALLOC_FREE(new_acct); + TALLOC_FREE(new_acct); return NT_STATUS_ACCESS_DENIED; } -- cgit From 360673e80e8d46167afb6c393773895b369ff290 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 12 Jan 2008 00:15:46 -0800 Subject: CID 458. Don't leak dlopen handles on failing to load module. Jeremy. (This used to be commit 8809eaeb154ea12543455f589e31172dc905d83a) --- source3/lib/module.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/lib/module.c b/source3/lib/module.c index fa06d14b49..285bd9c4c0 100644 --- a/source3/lib/module.c +++ b/source3/lib/module.c @@ -57,6 +57,7 @@ static NTSTATUS do_smb_load_module(const char *module_name, bool is_probe) if (error) { DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", module_name, error)); + sys_dlclose(handle); return NT_STATUS_UNSUCCESSFUL; } @@ -66,6 +67,7 @@ static NTSTATUS do_smb_load_module(const char *module_name, bool is_probe) if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Module '%s' initialization failed: %s\n", module_name, get_friendly_nt_error_msg(status))); + sys_dlclose(handle); } return status; -- cgit From 4c0ca860515a799ddcda3804fe4c2080d1df9b80 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 11 Jan 2008 21:53:29 +0100 Subject: There's no point in calling FLOCK on a non-existing fd (This used to be commit 9ff79f231f1206631662b5c521ecddf5df9141c0) --- source3/smbd/open.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 59699dfbd0..d1679209bb 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1761,14 +1761,16 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, the kernel refuses the operations then the kernel is wrong. note that GPFS supports it as well - jmcd */ - ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access); - if(ret_flock == -1 ){ + if (fsp->fh->fd != -1) { + ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, share_access); + if(ret_flock == -1 ){ - TALLOC_FREE(lck); - fd_close(fsp); - file_free(fsp); - - return NT_STATUS_SHARING_VIOLATION; + TALLOC_FREE(lck); + fd_close(fsp); + file_free(fsp); + + return NT_STATUS_SHARING_VIOLATION; + } } /* -- cgit From b36a78837f2bb16725c39e42296015c61f1c5910 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 11 Jan 2008 12:35:04 +0100 Subject: delete on close even prevents stat opens (This used to be commit 85fe7f3f6ed4aae76e5cf31ab689b2dfacfd74de) --- source3/smbd/open.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index d1679209bb..9d48bcc98b 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -598,12 +598,6 @@ static NTSTATUS open_mode_check(connection_struct *conn, } *file_existed = True; - - if (is_stat_open(access_mask)) { - /* Stat open that doesn't trigger oplock breaks or share mode - * checks... ! JRA. */ - return NT_STATUS_OK; - } /* A delete on close prohibits everything */ @@ -611,6 +605,12 @@ static NTSTATUS open_mode_check(connection_struct *conn, return NT_STATUS_DELETE_PENDING; } + if (is_stat_open(access_mask)) { + /* Stat open that doesn't trigger oplock breaks or share mode + * checks... ! JRA. */ + return NT_STATUS_OK; + } + /* * Check if the share modes will give us access. */ -- cgit From 2aa12fff43691ee768468d58c7df51594c73ed53 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 11 Jan 2008 12:02:56 +0100 Subject: One more empty line (This used to be commit 10b6f52910b4d29da4ea74740a174654dd1d8e8e) --- source3/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 5257b6fcac..f03bd1959e 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1529,8 +1529,8 @@ bin/librpc_echo.@SHLIBEXT@: $(BINARY_PREREQS) $(RPC_ECHO_OBJ) bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @echo "Linking $@" @$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \ - @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ - @WINBIND_LIBS@ + @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) \ + $(PASSDB_LIBS) @WINBIND_LIBS@ bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @LIBWBCLIENT_SHARED@ @echo "Linking $@" -- cgit From 4af27ec877d67afc719bccd350dae33ef8dd62b5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 12 Jan 2008 10:38:17 +0100 Subject: Restructure dbwrap_rbt In this low-level code, play tricks to reduce the number of allocations to the possible minimum. I would not recommend this for higher-level code, but here it pays off. (This used to be commit 71b1e6ff1595fbaa8dd49b996c45541531c7e98c) --- source3/lib/dbwrap_rbt.c | 186 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 127 insertions(+), 59 deletions(-) diff --git a/source3/lib/dbwrap_rbt.c b/source3/lib/dbwrap_rbt.c index 93d73f29d1..633b695b52 100644 --- a/source3/lib/dbwrap_rbt.c +++ b/source3/lib/dbwrap_rbt.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. Database interface wrapper around red-black trees - Copyright (C) Volker Lendecke 2007 + Copyright (C) Volker Lendecke 2007, 2008 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,8 @@ #include "includes.h" #include "rbtree.h" +#define ALIGN(_size_) (((_size_)+15)&~15) + struct db_rbt_ctx { struct rb_root tree; }; @@ -43,6 +45,35 @@ struct db_rbt_node { char data[]; }; +/* + * Hide the ugly pointer calculations in a function + */ + +static struct db_rbt_node *db_rbt2node(struct rb_node *node) +{ + return (struct db_rbt_node *) + ((char *)node - offsetof(struct db_rbt_node, rb_node)); +} + +/* + * Compare two keys + */ + +static int db_rbt_compare(TDB_DATA a, TDB_DATA b) +{ + int res; + + res = memcmp(a.dptr, b.dptr, MIN(a.dsize, b.dsize)); + + if ((res < 0) || ((res == 0) && (a.dsize < b.dsize))) { + return -1; + } + if ((res > 0) || ((res == 0) && (a.dsize > b.dsize))) { + return 1; + } + return 0; +} + /* * dissect a db_rbt_node into its implicit key and value parts */ @@ -58,9 +89,7 @@ static void db_rbt_parse_node(struct db_rbt_node *node, static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) { - struct db_rbt_rec *rec_priv = talloc_get_type_abort( - rec->private_data, struct db_rbt_rec); - + struct db_rbt_rec *rec_priv = (struct db_rbt_rec *)rec->private_data; struct db_rbt_node *node; struct rb_node ** p; @@ -133,22 +162,16 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) parent = (*p); - r = (struct db_rbt_node *) - ((char *)(*p) - offsetof(struct db_rbt_node, rb_node)); + r = db_rbt2node(*p); db_rbt_parse_node(r, &search_key, &search_val); - res = memcmp(this_key.dptr, search_key.dptr, - MIN(this_key.dsize, search_key.dsize)); + res = db_rbt_compare(this_key, search_key); - if ((res < 0) - || ((res == 0) - && (this_key.dsize < search_key.dsize))) { + if (res == -1) { p = &(*p)->rb_left; } - else if ((res > 0) - || ((res == 0) - && (this_key.dsize > search_key.dsize))) { + else if (res == 1) { p = &(*p)->rb_right; } else { @@ -164,8 +187,7 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag) static NTSTATUS db_rbt_delete(struct db_record *rec) { - struct db_rbt_rec *rec_priv = talloc_get_type_abort( - rec->private_data, struct db_rbt_rec); + struct db_rbt_rec *rec_priv = (struct db_rbt_rec *)rec->private_data; if (rec_priv->node == NULL) { return NT_STATUS_OK; @@ -187,85 +209,128 @@ static struct db_record *db_rbt_fetch_locked(struct db_context *db_ctx, struct db_rbt_rec *rec_priv; struct db_record *result; struct rb_node *n; + size_t size; + bool found = false; + struct db_rbt_node *r = NULL; + TDB_DATA search_key = tdb_null, search_val = tdb_null; - result = talloc(mem_ctx, struct db_record); + n = ctx->tree.rb_node; - if (result == NULL) { - return NULL; + while (n != NULL) { + int res; + + r = db_rbt2node(n); + + db_rbt_parse_node(r, &search_key, &search_val); + + res = db_rbt_compare(key, search_key); + + if (res == -1) { + n = n->rb_left; + } + else if (res == 1) { + n = n->rb_right; + } + else { + found = true; + break; + } } - rec_priv = talloc(result, struct db_rbt_rec); + /* + * In this low-level routine, play tricks to reduce the number of + * tallocs to one. Not recommened for general use, but here it pays + * off. + */ - if (rec_priv == NULL) { - TALLOC_FREE(result); + size = ALIGN(sizeof(struct db_record)) + sizeof(struct db_rbt_rec); + + if (!found) { + /* + * We need to keep the key around for later store + */ + size += key.dsize; + } + + result = (struct db_record *)talloc_size(mem_ctx, size); + if (result == NULL) { return NULL; } + rec_priv = (struct db_rbt_rec *) + ((char *)result + ALIGN(sizeof(struct db_record))); rec_priv->db_ctx = ctx; result->store = db_rbt_store; result->delete_rec = db_rbt_delete; result->private_data = rec_priv; + if (found) { + rec_priv->node = r; + result->key = search_key; + result->value = search_val; + } + else { + rec_priv->node = NULL; + result->key.dptr = (uint8 *) + ((char *)rec_priv + sizeof(*rec_priv)); + result->key.dsize = key.dsize; + memcpy(result->key.dptr, key.dptr, key.dsize); + + result->value = tdb_null; + } + + return result; +} + +static int db_rbt_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, + TDB_DATA key, TDB_DATA *data) +{ + struct db_rbt_ctx *ctx = talloc_get_type_abort( + db->private_data, struct db_rbt_ctx); + + struct rb_node *n; + bool found = false; + struct db_rbt_node *r = NULL; + TDB_DATA search_key, search_val; + uint8_t *result; + n = ctx->tree.rb_node; while (n != NULL) { - struct db_rbt_node *r; - TDB_DATA search_key, search_val; int res; - r = (struct db_rbt_node *) - ((char *)n - offsetof(struct db_rbt_node, rb_node)); + r = db_rbt2node(n); db_rbt_parse_node(r, &search_key, &search_val); - res = memcmp(key.dptr, search_key.dptr, - MIN(key.dsize, search_key.dsize)); + res = db_rbt_compare(key, search_key); - if ((res < 0) - || ((res == 0) && (key.dsize < search_key.dsize))) { + if (res == -1) { n = n->rb_left; } - else if ((res > 0) - || ((res == 0) && (key.dsize > search_key.dsize))) { + else if (res == 1) { n = n->rb_right; } else { - rec_priv->node = r; - result->key = search_key; - result->value = search_val; - return result; + found = true; + break; } } - result->key.dsize = key.dsize; - result->key.dptr = (uint8_t *)talloc_memdup( - result, key.dptr, key.dsize); - - if (result->key.dptr == NULL) { - TALLOC_FREE(result); - return NULL; + if (!found) { + *data = tdb_null; + return 0; } - rec_priv->node = NULL; - result->value.dsize = 0; - result->value.dptr = NULL; - return result; -} - -static int db_rbt_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, - TDB_DATA key, TDB_DATA *data) -{ - struct db_record *rec; - - if (!(rec = db->fetch_locked(db, mem_ctx, key))) { + result = (uint8 *)talloc_memdup(mem_ctx, search_val.dptr, + search_val.dsize); + if (result == NULL) { return -1; } - data->dsize = rec->value.dsize; - data->dptr = (uint8 *)talloc_memdup(mem_ctx, rec->value.dptr, - rec->value.dsize); - TALLOC_FREE(rec); + data->dptr = result; + data->dsize = search_val.dsize; return 0; } @@ -275,6 +340,9 @@ static int db_rbt_traverse(struct db_context *db, void *private_data), void *private_data) { + /* + * Nobody uses this so far, and unused code is broken code :-) + */ return -1; } -- cgit From ec412b60ea6d6a4e0fd2e03ca9299b4264483c0c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 12 Jan 2008 17:08:04 +0100 Subject: Convert OpenDir to talloc, use talloc_tos() This cuts some mallocs on NtCreate&X (This used to be commit 8e64107b7846d8f9cce71aabc95b28b7488d01ce) --- source3/smbd/dir.c | 96 ++++++++++++++++++++----------------------------- source3/smbd/filename.c | 6 ++-- source3/smbd/reply.c | 35 +++++++++--------- 3 files changed, 61 insertions(+), 76 deletions(-) diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 04e3167e77..ca6f8bfd8d 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -142,8 +142,7 @@ static void dptr_idle(struct dptr_struct *dptr) { if (dptr->dir_hnd) { DEBUG(4,("Idling dptr dnum %d\n",dptr->dnum)); - CloseDir(dptr->dir_hnd); - dptr->dir_hnd = NULL; + TALLOC_FREE(dptr->dir_hnd); } } @@ -192,7 +191,9 @@ static struct dptr_struct *dptr_get(int key, bool forclose) if (dirhandles_open >= MAX_OPEN_DIRECTORIES) dptr_idleoldest(); DEBUG(4,("dptr_get: Reopening dptr key %d\n",key)); - if (!(dptr->dir_hnd = OpenDir(dptr->conn, dptr->path, dptr->wcard, dptr->attr))) { + if (!(dptr->dir_hnd = OpenDir( + NULL, dptr->conn, dptr->path, + dptr->wcard, dptr->attr))) { DEBUG(4,("dptr_get: Failed to open %s (%s)\n",dptr->path, strerror(errno))); return False; @@ -263,9 +264,7 @@ static void dptr_close_internal(struct dptr_struct *dptr) bitmap_clear(dptr_bmap, dptr->dnum - 1); - if (dptr->dir_hnd) { - CloseDir(dptr->dir_hnd); - } + TALLOC_FREE(dptr->dir_hnd); /* Lanman 2 specific code */ SAFE_FREE(dptr->wcard); @@ -411,7 +410,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, return status; } - dir_hnd = OpenDir(conn, path, wcard, attr); + dir_hnd = OpenDir(NULL, conn, path, wcard, attr); if (!dir_hnd) { return map_nt_error_from_unix(errno); } @@ -425,7 +424,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, dptr = SMB_MALLOC_P(struct dptr_struct); if(!dptr) { DEBUG(0,("malloc fail in dptr_create.\n")); - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); return NT_STATUS_NO_MEMORY; } @@ -455,7 +454,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, if(dptr->dnum == -1 || dptr->dnum > 254) { DEBUG(0,("dptr_create: returned %d: Error - all old dirptrs in use ?\n", dptr->dnum)); SAFE_FREE(dptr); - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); return NT_STATUS_TOO_MANY_OPENED_FILES; } } @@ -485,7 +484,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, if(dptr->dnum == -1 || dptr->dnum < 255) { DEBUG(0,("dptr_create: returned %d: Error - all new dirptrs in use ?\n", dptr->dnum)); SAFE_FREE(dptr); - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); return NT_STATUS_TOO_MANY_OPENED_FILES; } } @@ -504,7 +503,7 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, if (!dptr->wcard) { bitmap_clear(dptr_bmap, dptr->dnum - 1); SAFE_FREE(dptr); - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); return NT_STATUS_NO_MEMORY; } if (lp_posix_pathnames() || (wcard[0] == '.' && wcard[1] == 0)) { @@ -533,7 +532,8 @@ NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, int dptr_CloseDir(struct dptr_struct *dptr) { DLIST_REMOVE(dirptrs, dptr); - return CloseDir(dptr->dir_hnd); + TALLOC_FREE(dptr->dir_hnd); + return 0; } void dptr_SeekDir(struct dptr_struct *dptr, long offset) @@ -1113,72 +1113,53 @@ bool is_visible_file(connection_struct *conn, const char *dir_path, const char * return True; } +static int smb_Dir_destructor(struct smb_Dir *dirp) +{ + if (dirp->dir) { + SMB_VFS_CLOSEDIR(dirp->conn,dirp->dir); + } + dirhandles_open--; + return 0; +} + /******************************************************************* Open a directory. ********************************************************************/ -struct smb_Dir *OpenDir(connection_struct *conn, const char *name, const char *mask, uint32 attr) +struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn, + const char *name, const char *mask, uint32 attr) { - struct smb_Dir *dirp = SMB_MALLOC_P(struct smb_Dir); + struct smb_Dir *dirp = TALLOC_ZERO_P(mem_ctx, struct smb_Dir); if (!dirp) { return NULL; } - ZERO_STRUCTP(dirp); dirp->conn = conn; dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn)); - dirp->dir_path = SMB_STRDUP(name); + dirp->dir_path = talloc_strdup(dirp, name); if (!dirp->dir_path) { goto fail; } + + dirhandles_open++; + talloc_set_destructor(dirp, smb_Dir_destructor); + dirp->dir = SMB_VFS_OPENDIR(conn, dirp->dir_path, mask, attr); if (!dirp->dir) { - DEBUG(5,("OpenDir: Can't open %s. %s\n", dirp->dir_path, strerror(errno) )); + DEBUG(5,("OpenDir: Can't open %s. %s\n", dirp->dir_path, + strerror(errno) )); goto fail; } - dirhandles_open++; return dirp; fail: - - if (dirp) { - if (dirp->dir) { - SMB_VFS_CLOSEDIR(conn,dirp->dir); - } - SAFE_FREE(dirp->dir_path); - SAFE_FREE(dirp->name_cache); - SAFE_FREE(dirp); - } + TALLOC_FREE(dirp); return NULL; } - -/******************************************************************* - Close a directory. -********************************************************************/ - -int CloseDir(struct smb_Dir *dirp) -{ - int i, ret = 0; - - if (dirp->dir) { - ret = SMB_VFS_CLOSEDIR(dirp->conn,dirp->dir); - } - SAFE_FREE(dirp->dir_path); - if (dirp->name_cache) { - for (i = 0; i < dirp->name_cache_size; i++) { - SAFE_FREE(dirp->name_cache[i].name); - } - } - SAFE_FREE(dirp->name_cache); - SAFE_FREE(dirp); - dirhandles_open--; - return ret; -} - /******************************************************************* Read from a directory. Also return current offset. Don't check for veto or invisible files. @@ -1290,8 +1271,8 @@ void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset) } if (dirp->name_cache == NULL) { - dirp->name_cache = SMB_CALLOC_ARRAY(struct name_cache_entry, - dirp->name_cache_size); + dirp->name_cache = TALLOC_ZERO_ARRAY( + dirp, struct name_cache_entry, dirp->name_cache_size); if (dirp->name_cache == NULL) { return; @@ -1301,8 +1282,8 @@ void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset) dirp->name_cache_index = (dirp->name_cache_index+1) % dirp->name_cache_size; e = &dirp->name_cache[dirp->name_cache_index]; - SAFE_FREE(e->name); - e->name = SMB_STRDUP(name); + TALLOC_FREE(e->name); + e->name = talloc_strdup(dirp, name); e->offset = offset; } @@ -1359,7 +1340,8 @@ NTSTATUS can_delete_directory(struct connection_struct *conn, NTSTATUS status = NT_STATUS_OK; long dirpos = 0; const char *dname; - struct smb_Dir *dir_hnd = OpenDir(conn, dirname, NULL, 0); + struct smb_Dir *dir_hnd = OpenDir(talloc_tos(), conn, dirname, + NULL, 0); if (!dir_hnd) { return map_nt_error_from_unix(errno); @@ -1383,7 +1365,7 @@ NTSTATUS can_delete_directory(struct connection_struct *conn, status = NT_STATUS_DIRECTORY_NOT_EMPTY; break; } - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); return status; } diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 5ae193fb46..be4960cab8 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -778,7 +778,7 @@ static bool scan_directory(connection_struct *conn, const char *path, } /* open the directory */ - if (!(cur_dir = OpenDir(conn, path, NULL, 0))) { + if (!(cur_dir = OpenDir(talloc_tos(), conn, path, NULL, 0))) { DEBUG(3,("scan dir didn't open dir [%s]\n",path)); TALLOC_FREE(unmangled_name); return(False); @@ -809,7 +809,7 @@ static bool scan_directory(connection_struct *conn, const char *path, /* we've found the file, change it's name and return */ *found_name = talloc_strdup(ctx,dname); TALLOC_FREE(unmangled_name); - CloseDir(cur_dir); + TALLOC_FREE(cur_dir); if (!*found_name) { errno = ENOMEM; return False; @@ -819,7 +819,7 @@ static bool scan_directory(connection_struct *conn, const char *path, } TALLOC_FREE(unmangled_name); - CloseDir(cur_dir); + TALLOC_FREE(cur_dir); errno = ENOENT; return False; } diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 8149f5aeb6..e2316ef120 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2410,7 +2410,8 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, return status; } - dir_hnd = OpenDir(conn, directory, mask, dirtype); + dir_hnd = OpenDir(talloc_tos(), conn, directory, mask, + dirtype); if (dir_hnd == NULL) { return map_nt_error_from_unix(errno); } @@ -2448,7 +2449,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, status = check_name(conn, fname); if (!NT_STATUS_IS_OK(status)) { - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); return status; } @@ -2464,7 +2465,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, TALLOC_FREE(fname); } - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); } if (count == 0 && NT_STATUS_IS_OK(status)) { @@ -4901,7 +4902,8 @@ static bool recursive_rmdir(TALLOC_CTX *ctx, const char *dname = NULL; bool ret = True; long offset = 0; - struct smb_Dir *dir_hnd = OpenDir(conn, directory, NULL, 0); + struct smb_Dir *dir_hnd = OpenDir(talloc_tos(), conn, directory, + NULL, 0); if(dir_hnd == NULL) return False; @@ -4949,7 +4951,7 @@ static bool recursive_rmdir(TALLOC_CTX *ctx, } TALLOC_FREE(fullname); } - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); return ret; } @@ -4997,7 +4999,8 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx, */ const char *dname; long dirpos = 0; - struct smb_Dir *dir_hnd = OpenDir(conn, directory, NULL, 0); + struct smb_Dir *dir_hnd = OpenDir(talloc_tos(), conn, + directory, NULL, 0); if(dir_hnd == NULL) { errno = ENOTEMPTY; @@ -5010,7 +5013,7 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx, if (!is_visible_file(conn, directory, dname, &st, False)) continue; if(!IS_VETO_PATH(conn, dname)) { - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); errno = ENOTEMPTY; goto err; } @@ -5055,7 +5058,7 @@ NTSTATUS rmdir_internals(TALLOC_CTX *ctx, } TALLOC_FREE(fullname); } - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); /* Retry the rmdir */ ret = SMB_VFS_RMDIR(conn,directory); } @@ -5751,7 +5754,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, return status; } - dir_hnd = OpenDir(conn, directory, mask, attrs); + dir_hnd = OpenDir(talloc_tos(), conn, directory, mask, attrs); if (dir_hnd == NULL) { return map_nt_error_from_unix(errno); } @@ -5851,7 +5854,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, TALLOC_FREE(fname); TALLOC_FREE(destname); } - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); if (count == 0 && NT_STATUS_IS_OK(status)) { status = map_nt_error_from_unix(errno); @@ -6325,7 +6328,7 @@ void reply_copy(struct smb_request *req) return; } - dir_hnd = OpenDir(conn, directory, mask, 0); + dir_hnd = OpenDir(talloc_tos(), conn, directory, mask, 0); if (dir_hnd == NULL) { status = map_nt_error_from_unix(errno); reply_nterror(req, status); @@ -6357,7 +6360,7 @@ void reply_copy(struct smb_request *req) directory, dname); if (!fname) { - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); reply_nterror(req, NT_STATUS_NO_MEMORY); END_PROFILE(SMBcopy); return; @@ -6368,7 +6371,7 @@ void reply_copy(struct smb_request *req) continue; } if (!destname) { - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); reply_nterror(req, NT_STATUS_NO_MEMORY); END_PROFILE(SMBcopy); return; @@ -6376,7 +6379,7 @@ void reply_copy(struct smb_request *req) status = check_name(conn, fname); if (!NT_STATUS_IS_OK(status)) { - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); reply_nterror(req, status); END_PROFILE(SMBcopy); return; @@ -6384,7 +6387,7 @@ void reply_copy(struct smb_request *req) status = check_name(conn, destname); if (!NT_STATUS_IS_OK(status)) { - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); reply_nterror(req, status); END_PROFILE(SMBcopy); return; @@ -6400,7 +6403,7 @@ void reply_copy(struct smb_request *req) TALLOC_FREE(fname); TALLOC_FREE(destname); } - CloseDir(dir_hnd); + TALLOC_FREE(dir_hnd); } if (count == 0) { -- cgit From 18083f1d88f3cfade68587f9289fa709c229e1d0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 12 Jan 2008 21:09:43 +0100 Subject: Get the inbuf on talloc_tos() (This used to be commit 883f7415769ad1e714f636e9d6fbd1f075e69d1e) --- source3/smbd/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 2d3cf7fbd8..a5bdb96650 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2085,7 +2085,7 @@ void smbd_process(void) run_events(smbd_event_context(), 0, NULL, NULL); - while (!receive_message_or_smb(NULL, &inbuf, &inbuf_len, + while (!receive_message_or_smb(talloc_tos(), &inbuf, &inbuf_len, select_timeout, &unread_bytes, &encrypted)) { -- cgit From bb2c52ad43b12c30315189ebbd722ae3125e457b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 12 Jan 2008 19:12:30 +0100 Subject: Remove an unused variable (This used to be commit 24e719a1d432d5de022ab903457df0dd67c24b85) --- source3/smbd/aio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index c8175f77ac..9c25f69c97 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -451,7 +451,6 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex) int ret = 0; files_struct *fsp = aio_ex->fsp; char *outbuf = aio_ex->outbuf; - const char *inbuf = aio_ex->inbuf; ssize_t numtowrite = aio_ex->acb.aio_nbytes; ssize_t nwritten = SMB_VFS_AIO_RETURN(fsp,&aio_ex->acb); -- cgit From 5a8bbc64cc7327facb2a3d136b9c9a3e15a1903a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 12 Jan 2008 23:05:23 +0100 Subject: Trivial simplification (This used to be commit 616bc34744487450edd47e212a29c0f57eabb722) --- source3/locking/locking.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 113b994bc7..bae4518575 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -1281,11 +1281,7 @@ static UNIX_USER_TOKEN *copy_unix_token(TALLOC_CTX *ctx, UNIX_USER_TOKEN *tok) void set_delete_on_close_token(struct share_mode_lock *lck, UNIX_USER_TOKEN *tok) { - /* Ensure there's no token. */ - if (lck->delete_token) { - TALLOC_FREE(lck->delete_token); /* Also deletes groups... */ - lck->delete_token = NULL; - } + TALLOC_FREE(lck->delete_token); /* Also deletes groups... */ /* Copy the new token (can be NULL). */ lck->delete_token = copy_unix_token(lck, tok); -- cgit From 8d464d470a534d2914eca7287aedaa4205478ca3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 12 Jan 2008 23:06:33 +0100 Subject: Don't early delete the share mode tdb data We now refer directly to the file name in the tdb data, so don't delete it. (This used to be commit 71de4946cf00cf8b7bb2f2d92832166bee12e84a) --- source3/locking/locking.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index bae4518575..513bb31d9d 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -836,8 +836,6 @@ struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx, return NULL; } - TALLOC_FREE(data.dptr); - return lck; } -- cgit From 4add2fe36e0eb84a4e49f8e38c2a14023581eeca Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 13 Jan 2008 01:22:23 +0100 Subject: idl: Replace non-standard "declare" keyword with typedef and regenerate. (This used to be commit 7e75acfdd1910b3b5908c02d5f343f014eb77841) --- source3/librpc/gen_ndr/dfs.h | 15 +++++++++------ source3/librpc/gen_ndr/echo.h | 10 ++++++---- source3/librpc/gen_ndr/epmapper.h | 5 +++-- source3/librpc/gen_ndr/lsa.h | 22 ++++++++++++++-------- source3/librpc/gen_ndr/ndr_svcctl.c | 12 ++++++------ source3/librpc/gen_ndr/ndr_wkssvc.c | 2 ++ source3/librpc/gen_ndr/netlogon.h | 21 +++++++++++++++------ source3/librpc/gen_ndr/srvsvc.h | 14 ++++++++++---- source3/librpc/gen_ndr/svcctl.h | 5 +++-- source3/librpc/gen_ndr/winreg.h | 12 ++++++++---- source3/librpc/gen_ndr/wkssvc.h | 17 +++++++++++------ source3/librpc/idl/lsa.idl | 2 +- source3/librpc/idl/netlogon.idl | 6 +++--- source3/librpc/idl/samr.idl | 4 ++-- source3/librpc/idl/srvsvc.idl | 4 ++-- source3/librpc/idl/winreg.idl | 2 +- source3/librpc/idl/wkssvc.idl | 2 +- 17 files changed, 97 insertions(+), 58 deletions(-) diff --git a/source3/librpc/gen_ndr/dfs.h b/source3/librpc/gen_ndr/dfs.h index 58eb34f0de..89f243b7dd 100644 --- a/source3/librpc/gen_ndr/dfs.h +++ b/source3/librpc/gen_ndr/dfs.h @@ -6,14 +6,15 @@ #define _HEADER_netdfs #define DFS_STORAGE_STATES ( 0xf ) +enum dfs_ManagerVersion #ifndef USE_UINT_ENUMS -enum dfs_ManagerVersion { + { DFS_MANAGER_VERSION_NT4=1, DFS_MANAGER_VERSION_W2K=2, DFS_MANAGER_VERSION_W2K3=4 } #else -enum dfs_ManagerVersion { __donnot_use_enum_dfs_ManagerVersion=0x7FFFFFFF} + { __donnot_use_enum_dfs_ManagerVersion=0x7FFFFFFF} #define DFS_MANAGER_VERSION_NT4 ( 1 ) #define DFS_MANAGER_VERSION_W2K ( 2 ) #define DFS_MANAGER_VERSION_W2K3 ( 4 ) @@ -96,8 +97,9 @@ struct dfs_Info5 { uint32_t num_stores; }; +enum dfs_Target_PriorityClass #ifndef USE_UINT_ENUMS -enum dfs_Target_PriorityClass { + { DFS_INVALID_PRIORITY_CLASS=-1, DFS_SITE_COST_NORMAL_PRIORITY_CLASS=0, DFS_GLOBAL_HIGH_PRIORITY_CLASS=1, @@ -106,7 +108,7 @@ enum dfs_Target_PriorityClass { DFS_GLOBAL_LOW_PRIORITY_CLASS=4 } #else -enum dfs_Target_PriorityClass { __donnot_use_enum_dfs_Target_PriorityClass=0x7FFFFFFF} + { __donnot_use_enum_dfs_Target_PriorityClass=0x7FFFFFFF} #define DFS_INVALID_PRIORITY_CLASS ( -1 ) #define DFS_SITE_COST_NORMAL_PRIORITY_CLASS ( 0 ) #define DFS_GLOBAL_HIGH_PRIORITY_CLASS ( 1 ) @@ -180,13 +182,14 @@ struct dfs_Info200 { const char *dom_root;/* [unique,charset(UTF16)] */ }; +enum dfs_VolumeFlavor #ifndef USE_UINT_ENUMS -enum dfs_VolumeFlavor { + { DFS_VOLUME_FLAVOR_STANDALONE=0x100, DFS_VOLUME_FLAVOR_AD_BLOB=0x200 } #else -enum dfs_VolumeFlavor { __donnot_use_enum_dfs_VolumeFlavor=0x7FFFFFFF} + { __donnot_use_enum_dfs_VolumeFlavor=0x7FFFFFFF} #define DFS_VOLUME_FLAVOR_STANDALONE ( 0x100 ) #define DFS_VOLUME_FLAVOR_AD_BLOB ( 0x200 ) #endif diff --git a/source3/librpc/gen_ndr/echo.h b/source3/librpc/gen_ndr/echo.h index 4b03578cdc..c8b5b86422 100644 --- a/source3/librpc/gen_ndr/echo.h +++ b/source3/librpc/gen_ndr/echo.h @@ -46,25 +46,27 @@ union echo_Info { struct echo_info7 info7;/* [case(7)] */ }/* [switch_type(uint16)] */; +enum echo_Enum1 #ifndef USE_UINT_ENUMS -enum echo_Enum1 { + { ECHO_ENUM1=1, ECHO_ENUM2=2 } #else -enum echo_Enum1 { __donnot_use_enum_echo_Enum1=0x7FFFFFFF} + { __donnot_use_enum_echo_Enum1=0x7FFFFFFF} #define ECHO_ENUM1 ( 1 ) #define ECHO_ENUM2 ( 2 ) #endif ; +enum echo_Enum1_32 #ifndef USE_UINT_ENUMS -enum echo_Enum1_32 { + { ECHO_ENUM1_32=1, ECHO_ENUM2_32=2 } #else -enum echo_Enum1_32 { __donnot_use_enum_echo_Enum1_32=0x7FFFFFFF} + { __donnot_use_enum_echo_Enum1_32=0x7FFFFFFF} #define ECHO_ENUM1_32 ( 1 ) #define ECHO_ENUM2_32 ( 2 ) #endif diff --git a/source3/librpc/gen_ndr/epmapper.h b/source3/librpc/gen_ndr/epmapper.h index 0fb5ed048e..d39269b32b 100644 --- a/source3/librpc/gen_ndr/epmapper.h +++ b/source3/librpc/gen_ndr/epmapper.h @@ -8,8 +8,9 @@ #define EPMAPPER_STATUS_NO_MORE_ENTRIES ( 0x16c9a0d6 ) #define EPMAPPER_STATUS_NO_MEMORY ( 0x16C9A012 ) #define EPMAPPER_STATUS_OK ( 0 ) +enum epm_protocol #ifndef USE_UINT_ENUMS -enum epm_protocol { + { EPM_PROTOCOL_DNET_NSP=0x04, EPM_PROTOCOL_OSI_TP4=0x05, EPM_PROTOCOL_OSI_CLNS=0x06, @@ -38,7 +39,7 @@ enum epm_protocol { EPM_PROTOCOL_NULL=0x21 } #else -enum epm_protocol { __donnot_use_enum_epm_protocol=0x7FFFFFFF} + { __donnot_use_enum_epm_protocol=0x7FFFFFFF} #define EPM_PROTOCOL_DNET_NSP ( 0x04 ) #define EPM_PROTOCOL_OSI_TP4 ( 0x05 ) #define EPM_PROTOCOL_OSI_CLNS ( 0x06 ) diff --git a/source3/librpc/gen_ndr/lsa.h b/source3/librpc/gen_ndr/lsa.h index e356b9fc78..6c081562da 100644 --- a/source3/librpc/gen_ndr/lsa.h +++ b/source3/librpc/gen_ndr/lsa.h @@ -9,6 +9,8 @@ #define LSA_ENUM_TRUST_DOMAIN_MULTIPLIER ( 60 ) #define LSA_REF_DOMAIN_LIST_MULTIPLIER ( 32 ) #define LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER ( 82 ) +; + struct lsa_String { uint16_t length;/* [value(2*strlen_m(string))] */ uint16_t size;/* [value(2*strlen_m(string))] */ @@ -130,8 +132,9 @@ struct lsa_DnsDomainInfo { struct dom_sid2 *sid;/* [unique] */ }; +enum lsaPolicyInfo #ifndef USE_UINT_ENUMS -enum lsaPolicyInfo { + { LSA_POLICY_INFO_AUDIT_LOG=1, LSA_POLICY_INFO_AUDIT_EVENTS=2, LSA_POLICY_INFO_DOMAIN=3, @@ -146,7 +149,7 @@ enum lsaPolicyInfo { LSA_POLICY_INFO_DNS=12 } #else -enum lsaPolicyInfo { __donnot_use_enum_lsaPolicyInfo=0x7FFFFFFF} + { __donnot_use_enum_lsaPolicyInfo=0x7FFFFFFF} #define LSA_POLICY_INFO_AUDIT_LOG ( 1 ) #define LSA_POLICY_INFO_AUDIT_EVENTS ( 2 ) #define LSA_POLICY_INFO_DOMAIN ( 3 ) @@ -191,8 +194,9 @@ struct lsa_DomainList { struct lsa_DomainInfo *domains;/* [unique,size_is(count)] */ }; +enum lsa_SidType #ifndef USE_UINT_ENUMS -enum lsa_SidType { + { SID_NAME_USE_NONE=0, SID_NAME_USER=1, SID_NAME_DOM_GRP=2, @@ -205,7 +209,7 @@ enum lsa_SidType { SID_NAME_COMPUTER=9 } #else -enum lsa_SidType { __donnot_use_enum_lsa_SidType=0x7FFFFFFF} + { __donnot_use_enum_lsa_SidType=0x7FFFFFFF} #define SID_NAME_USE_NONE ( 0 ) #define SID_NAME_USER ( 1 ) #define SID_NAME_DOM_GRP ( 2 ) @@ -269,8 +273,9 @@ struct lsa_DATA_BUF2 { uint8_t *data;/* [unique,size_is(size)] */ }/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */; +enum lsa_TrustDomInfoEnum #ifndef USE_UINT_ENUMS -enum lsa_TrustDomInfoEnum { + { LSA_TRUSTED_DOMAIN_INFO_NAME=1, LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO=2, LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET=3, @@ -283,7 +288,7 @@ enum lsa_TrustDomInfoEnum { LSA_TRUSTED_DOMAIN_INFO_INFO_ALL=12 } #else -enum lsa_TrustDomInfoEnum { __donnot_use_enum_lsa_TrustDomInfoEnum=0x7FFFFFFF} + { __donnot_use_enum_lsa_TrustDomInfoEnum=0x7FFFFFFF} #define LSA_TRUSTED_DOMAIN_INFO_NAME ( 1 ) #define LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO ( 2 ) #define LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET ( 3 ) @@ -405,13 +410,14 @@ struct lsa_DomainInfoEfs { uint8_t *efs_blob;/* [unique,size_is(blob_size)] */ }; +enum lsa_DomainInfoEnum #ifndef USE_UINT_ENUMS -enum lsa_DomainInfoEnum { + { LSA_DOMAIN_INFO_POLICY_EFS=2, LSA_DOMAIN_INFO_POLICY_KERBEROS=3 } #else -enum lsa_DomainInfoEnum { __donnot_use_enum_lsa_DomainInfoEnum=0x7FFFFFFF} + { __donnot_use_enum_lsa_DomainInfoEnum=0x7FFFFFFF} #define LSA_DOMAIN_INFO_POLICY_EFS ( 2 ) #define LSA_DOMAIN_INFO_POLICY_KERBEROS ( 3 ) #endif diff --git a/source3/librpc/gen_ndr/ndr_svcctl.c b/source3/librpc/gen_ndr/ndr_svcctl.c index 7da684db87..b8d5dc186d 100644 --- a/source3/librpc/gen_ndr/ndr_svcctl.c +++ b/source3/librpc/gen_ndr/ndr_svcctl.c @@ -197,14 +197,14 @@ static enum ndr_err_code ndr_pull_ENUM_SERVICE_STATUS(struct ndr_pull *ndr, int uint32_t _flags_save_string = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); if (r->service_name) { - struct ndr_pull_save _relative_save; - ndr_pull_save(ndr, &_relative_save); + uint32_t _relative_save_offset; + _relative_save_offset = ndr->offset; NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->service_name)); _mem_save_service_name_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->service_name, 0); NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->service_name)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_name_0, 0); - ndr_pull_restore(ndr, &_relative_save); + ndr->offset = _relative_save_offset; } ndr->flags = _flags_save_string; } @@ -212,14 +212,14 @@ static enum ndr_err_code ndr_pull_ENUM_SERVICE_STATUS(struct ndr_pull *ndr, int uint32_t _flags_save_string = ndr->flags; ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM); if (r->display_name) { - struct ndr_pull_save _relative_save; - ndr_pull_save(ndr, &_relative_save); + uint32_t _relative_save_offset; + _relative_save_offset = ndr->offset; NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->display_name)); _mem_save_display_name_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->display_name, 0); NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->display_name)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_display_name_0, 0); - ndr_pull_restore(ndr, &_relative_save); + ndr->offset = _relative_save_offset; } ndr->flags = _flags_save_string; } diff --git a/source3/librpc/gen_ndr/ndr_wkssvc.c b/source3/librpc/gen_ndr/ndr_wkssvc.c index 3599fef352..c3a1f706cd 100644 --- a/source3/librpc/gen_ndr/ndr_wkssvc.c +++ b/source3/librpc/gen_ndr/ndr_wkssvc.c @@ -8606,6 +8606,7 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus(struct ndr_pull *ndr TALLOC_CTX *_mem_save_unknown_0; TALLOC_CTX *_mem_save_num_ous_0; TALLOC_CTX *_mem_save_ous_1; + TALLOC_CTX *_mem_save_ous_2; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -9487,6 +9488,7 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus2(struct ndr_pull *nd TALLOC_CTX *_mem_save_EncryptedPassword_0; TALLOC_CTX *_mem_save_num_ous_0; TALLOC_CTX *_mem_save_ous_1; + TALLOC_CTX *_mem_save_ous_2; if (flags & NDR_IN) { ZERO_STRUCT(r->out); diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h index 246748e89a..e33818257d 100644 --- a/source3/librpc/gen_ndr/netlogon.h +++ b/source3/librpc/gen_ndr/netlogon.h @@ -14,6 +14,8 @@ #define NETLOGON_NEG_ARCFOUR ( 0x00000004 ) #define NETLOGON_NEG_128BIT ( 0x00004000 ) #define NETLOGON_NEG_SCHANNEL ( 0x40000000 ) +; + struct netr_UasInfo { const char *account_name;/* [unique,charset(UTF16)] */ uint32_t priv; @@ -188,6 +190,10 @@ struct netr_Authenticator { time_t timestamp; }/* [public] */; +enum netr_SchannelType; + +enum netr_SamDatabaseID; + struct netr_DELTA_DELETE_USER { const char *account_name;/* [unique,charset(UTF16)] */ struct lsa_String unknown1; @@ -466,8 +472,9 @@ struct netr_DELTA_SECRET { uint32_t unknown8; }; +enum netr_DeltaEnum #ifndef USE_UINT_ENUMS -enum netr_DeltaEnum { + { NETR_DELTA_DOMAIN=1, NETR_DELTA_GROUP=2, NETR_DELTA_DELETE_GROUP=3, @@ -492,7 +499,7 @@ enum netr_DeltaEnum { NETR_DELTA_MODIFY_COUNT=22 } #else -enum netr_DeltaEnum { __donnot_use_enum_netr_DeltaEnum=0x7FFFFFFF} + { __donnot_use_enum_netr_DeltaEnum=0x7FFFFFFF} #define NETR_DELTA_DOMAIN ( 1 ) #define NETR_DELTA_GROUP ( 2 ) #define NETR_DELTA_DELETE_GROUP ( 3 ) @@ -595,15 +602,16 @@ union netr_CONTROL_QUERY_INFORMATION { struct netr_NETLOGON_INFO_3 *info3;/* [unique,case(3)] */ }; +enum netr_LogonControlCode #ifndef USE_UINT_ENUMS -enum netr_LogonControlCode { + { NETLOGON_CONTROL_REDISCOVER=5, NETLOGON_CONTROL_TC_QUERY=6, NETLOGON_CONTROL_TRANSPORT_NOTIFY=7, NETLOGON_CONTROL_SET_DBFLAG=65534 } #else -enum netr_LogonControlCode { __donnot_use_enum_netr_LogonControlCode=0x7FFFFFFF} + { __donnot_use_enum_netr_LogonControlCode=0x7FFFFFFF} #define NETLOGON_CONTROL_REDISCOVER ( 5 ) #define NETLOGON_CONTROL_TC_QUERY ( 6 ) #define NETLOGON_CONTROL_TRANSPORT_NOTIFY ( 7 ) @@ -694,15 +702,16 @@ struct netr_CryptPassword { ; +enum netr_TrustType #ifndef USE_UINT_ENUMS -enum netr_TrustType { + { NETR_TRUST_TYPE_DOWNLEVEL=1, NETR_TRUST_TYPE_UPLEVEL=2, NETR_TRUST_TYPE_MIT=3, NETR_TRUST_TYPE_DCE=4 } #else -enum netr_TrustType { __donnot_use_enum_netr_TrustType=0x7FFFFFFF} + { __donnot_use_enum_netr_TrustType=0x7FFFFFFF} #define NETR_TRUST_TYPE_DOWNLEVEL ( 1 ) #define NETR_TRUST_TYPE_UPLEVEL ( 2 ) #define NETR_TRUST_TYPE_MIT ( 3 ) diff --git a/source3/librpc/gen_ndr/srvsvc.h b/source3/librpc/gen_ndr/srvsvc.h index da9715072d..bc167bb31c 100644 --- a/source3/librpc/gen_ndr/srvsvc.h +++ b/source3/librpc/gen_ndr/srvsvc.h @@ -11,6 +11,10 @@ #define STYPE_HIDDEN ( 0x80000000 ) #define SHARE_1005_CSC_POLICY_MASK ( 0x00000030 ) #define SHARE_1005_CSC_POLICY_SHIFT ( 4 ) +; + +; + struct srvsvc_NetCharDevInfo0 { const char *device;/* [unique,charset(UTF16)] */ }; @@ -209,8 +213,9 @@ union srvsvc_NetSessCtr { struct srvsvc_NetSessCtr502 *ctr502;/* [unique,case(502)] */ }; +enum srvsvc_ShareType #ifndef USE_UINT_ENUMS -enum srvsvc_ShareType { + { STYPE_DISKTREE=0, STYPE_DISKTREE_TEMPORARY=STYPE_DISKTREE|STYPE_TEMPORARY, STYPE_DISKTREE_HIDDEN=STYPE_DISKTREE|STYPE_HIDDEN, @@ -225,7 +230,7 @@ enum srvsvc_ShareType { STYPE_IPC_HIDDEN=STYPE_IPC|STYPE_HIDDEN } #else -enum srvsvc_ShareType { __donnot_use_enum_srvsvc_ShareType=0x7FFFFFFF} + { __donnot_use_enum_srvsvc_ShareType=0x7FFFFFFF} #define STYPE_DISKTREE ( 0 ) #define STYPE_DISKTREE_TEMPORARY ( STYPE_DISKTREE|STYPE_TEMPORARY ) #define STYPE_DISKTREE_HIDDEN ( STYPE_DISKTREE|STYPE_HIDDEN ) @@ -381,8 +386,9 @@ union srvsvc_NetShareCtr { struct srvsvc_NetShareCtr1501 *ctr1501;/* [unique,case(1501)] */ }; +enum srvsvc_PlatformId #ifndef USE_UINT_ENUMS -enum srvsvc_PlatformId { + { PLATFORM_ID_DOS=300, PLATFORM_ID_OS2=400, PLATFORM_ID_NT=500, @@ -390,7 +396,7 @@ enum srvsvc_PlatformId { PLATFORM_ID_VMS=700 } #else -enum srvsvc_PlatformId { __donnot_use_enum_srvsvc_PlatformId=0x7FFFFFFF} + { __donnot_use_enum_srvsvc_PlatformId=0x7FFFFFFF} #define PLATFORM_ID_DOS ( 300 ) #define PLATFORM_ID_OS2 ( 400 ) #define PLATFORM_ID_NT ( 500 ) diff --git a/source3/librpc/gen_ndr/svcctl.h b/source3/librpc/gen_ndr/svcctl.h index e728d51f23..f0e476c105 100644 --- a/source3/librpc/gen_ndr/svcctl.h +++ b/source3/librpc/gen_ndr/svcctl.h @@ -70,12 +70,13 @@ struct ENUM_SERVICE_STATUS { ; +enum SERVICE_CONTROL #ifndef USE_UINT_ENUMS -enum SERVICE_CONTROL { + { FIXME=1 } #else -enum SERVICE_CONTROL { __donnot_use_enum_SERVICE_CONTROL=0x7FFFFFFF} + { __donnot_use_enum_SERVICE_CONTROL=0x7FFFFFFF} #define FIXME ( 1 ) #endif ; diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h index 37a472814a..8c498963b6 100644 --- a/source3/librpc/gen_ndr/winreg.h +++ b/source3/librpc/gen_ndr/winreg.h @@ -8,6 +8,8 @@ #ifndef _HEADER_winreg #define _HEADER_winreg +; + /* bitmap winreg_AccessMask */ #define KEY_QUERY_VALUE ( 0x00001 ) #define KEY_SET_VALUE ( 0x00002 ) @@ -20,8 +22,9 @@ ; +enum winreg_Type #ifndef USE_UINT_ENUMS -enum winreg_Type { + { REG_NONE=0, REG_SZ=1, REG_EXPAND_SZ=2, @@ -36,7 +39,7 @@ enum winreg_Type { REG_QWORD=11 } #else -enum winreg_Type { __donnot_use_enum_winreg_Type=0x7FFFFFFF} + { __donnot_use_enum_winreg_Type=0x7FFFFFFF} #define REG_NONE ( 0 ) #define REG_SZ ( 1 ) #define REG_EXPAND_SZ ( 2 ) @@ -70,14 +73,15 @@ struct winreg_SecBuf { uint8_t inherit; }; +enum winreg_CreateAction #ifndef USE_UINT_ENUMS -enum winreg_CreateAction { + { REG_ACTION_NONE=0, REG_CREATED_NEW_KEY=1, REG_OPENED_EXISTING_KEY=2 } #else -enum winreg_CreateAction { __donnot_use_enum_winreg_CreateAction=0x7FFFFFFF} + { __donnot_use_enum_winreg_CreateAction=0x7FFFFFFF} #define REG_ACTION_NONE ( 0 ) #define REG_CREATED_NEW_KEY ( 1 ) #define REG_OPENED_EXISTING_KEY ( 2 ) diff --git a/source3/librpc/gen_ndr/wkssvc.h b/source3/librpc/gen_ndr/wkssvc.h index 43f9ae6d63..b4df7c2d8f 100644 --- a/source3/librpc/gen_ndr/wkssvc.h +++ b/source3/librpc/gen_ndr/wkssvc.h @@ -7,6 +7,8 @@ #ifndef _HEADER_wkssvc #define _HEADER_wkssvc +enum srvsvc_PlatformId; + struct wkssvc_NetWkstaInfo100 { enum srvsvc_PlatformId platform_id; const char *server_name;/* [unique,charset(UTF16)] */ @@ -415,8 +417,9 @@ struct wkssvc_NetrWorkstationStatistics { ; +enum wkssvc_NetValidateNameType #ifndef USE_UINT_ENUMS -enum wkssvc_NetValidateNameType { + { NetSetupUnknown=0, NetSetupMachine=1, NetSetupWorkgroup=2, @@ -425,7 +428,7 @@ enum wkssvc_NetValidateNameType { NetSetupDnsMachine=5 } #else -enum wkssvc_NetValidateNameType { __donnot_use_enum_wkssvc_NetValidateNameType=0x7FFFFFFF} + { __donnot_use_enum_wkssvc_NetValidateNameType=0x7FFFFFFF} #define NetSetupUnknown ( 0 ) #define NetSetupMachine ( 1 ) #define NetSetupWorkgroup ( 2 ) @@ -435,15 +438,16 @@ enum wkssvc_NetValidateNameType { __donnot_use_enum_wkssvc_NetValidateNameType=0 #endif ; +enum wkssvc_NetJoinStatus #ifndef USE_UINT_ENUMS -enum wkssvc_NetJoinStatus { + { NetSetupUnknownStatus=0, NetSetupUnjoined=1, NetSetupWorkgroupName=2, NetSetupDomainName=3 } #else -enum wkssvc_NetJoinStatus { __donnot_use_enum_wkssvc_NetJoinStatus=0x7FFFFFFF} + { __donnot_use_enum_wkssvc_NetJoinStatus=0x7FFFFFFF} #define NetSetupUnknownStatus ( 0 ) #define NetSetupUnjoined ( 1 ) #define NetSetupWorkgroupName ( 2 ) @@ -469,15 +473,16 @@ struct wkssvc_PasswordBuffer { ; +enum wkssvc_ComputerNameType #ifndef USE_UINT_ENUMS -enum wkssvc_ComputerNameType { + { NetPrimaryComputerName=0, NetAlternateComputerNames=1, NetAllComputerNames=2, NetComputerNameTypeMax=3 } #else -enum wkssvc_ComputerNameType { __donnot_use_enum_wkssvc_ComputerNameType=0x7FFFFFFF} + { __donnot_use_enum_wkssvc_ComputerNameType=0x7FFFFFFF} #define NetPrimaryComputerName ( 0 ) #define NetAlternateComputerNames ( 1 ) #define NetAllComputerNames ( 2 ) diff --git a/source3/librpc/idl/lsa.idl b/source3/librpc/idl/lsa.idl index 556ab21af4..6cf57b88d4 100644 --- a/source3/librpc/idl/lsa.idl +++ b/source3/librpc/idl/lsa.idl @@ -13,7 +13,7 @@ import "security.idl"; helpstring("Local Security Authority") ] interface lsarpc { - declare bitmap security_secinfo; + typedef bitmap security_secinfo security_secinfo; typedef [public,noejs] struct { [value(2*strlen_m(string))] uint16 length; diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl index 139975fe12..72feb2f9ed 100644 --- a/source3/librpc/idl/netlogon.idl +++ b/source3/librpc/idl/netlogon.idl @@ -19,7 +19,7 @@ import "lsa.idl", "samr.idl", "security.idl"; interface netlogon { - declare bitmap samr_AcctFlags; + typedef bitmap samr_AcctFlags samr_AcctFlags; /*****************/ /* Function 0x00 */ @@ -279,7 +279,7 @@ interface netlogon /*****************/ /* Function 0x05 */ - declare enum netr_SchannelType; + typedef enum netr_SchannelType netr_SchannelType; NTSTATUS netr_ServerAuthenticate( [in,string,charset(UTF16)] uint16 *server_name, @@ -307,7 +307,7 @@ interface netlogon /*****************/ /* Function 0x07 */ - declare enum netr_SamDatabaseID; + typedef enum netr_SamDatabaseID netr_SamDatabaseID; typedef struct { [string,charset(UTF16)] uint16 *account_name; diff --git a/source3/librpc/idl/samr.idl b/source3/librpc/idl/samr.idl index 74081a7bf3..afeca3edd6 100644 --- a/source3/librpc/idl/samr.idl +++ b/source3/librpc/idl/samr.idl @@ -16,7 +16,7 @@ depends(misc,lsa,security) ] interface samr { - declare bitmap security_secinfo; + typedef bitmap security_secinfo security_secinfo; /* account control (acct_flags) bits */ typedef [public,bitmap32bit] bitmap { @@ -1158,7 +1158,7 @@ /************************/ /* Function 0x3f */ - declare enum samr_RejectReason; + typedef enum samr_RejectReason samr_RejectReason; typedef struct { samr_RejectReason reason; diff --git a/source3/librpc/idl/srvsvc.idl b/source3/librpc/idl/srvsvc.idl index c054dfdb45..c66486b29c 100644 --- a/source3/librpc/idl/srvsvc.idl +++ b/source3/librpc/idl/srvsvc.idl @@ -14,8 +14,8 @@ import "security.idl", "svcctl.idl"; helpstring("Server Service") ] interface srvsvc { - declare bitmap svcctl_ServerType; - declare bitmap security_secinfo; + typedef bitmap svcctl_ServerType svcctl_ServerType; + typedef bitmap security_secinfo security_secinfo; /**************************/ /* srvsvc_NetCharDev */ diff --git a/source3/librpc/idl/winreg.idl b/source3/librpc/idl/winreg.idl index a0d4323268..9f316ab39b 100644 --- a/source3/librpc/idl/winreg.idl +++ b/source3/librpc/idl/winreg.idl @@ -13,7 +13,7 @@ import "lsa.idl", "initshutdown.idl", "security.idl"; helpstring("Remote Registry Service") ] interface winreg { - declare bitmap security_secinfo; + typedef bitmap security_secinfo security_secinfo; typedef [bitmap32bit] bitmap { KEY_QUERY_VALUE = 0x00001, diff --git a/source3/librpc/idl/wkssvc.idl b/source3/librpc/idl/wkssvc.idl index dfb18e7ea8..9829379eef 100644 --- a/source3/librpc/idl/wkssvc.idl +++ b/source3/librpc/idl/wkssvc.idl @@ -14,7 +14,7 @@ import "srvsvc.idl", "lsa.idl"; endpoint("ncacn_np:[\\pipe\\wkssvc]","ncacn_ip_tcp:","ncalrpc:") ] interface wkssvc { - declare [v1_enum] enum srvsvc_PlatformId; + typedef [v1_enum] enum srvsvc_PlatformId srvsvc_PlatformId; #define BOOL uint32 -- cgit From 1ee6d3e1ee56554d83437a8c79cb169a26732154 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 01:40:05 +0100 Subject: Introduce a libnet_conf context created by libnet_conf_open(). The libnet_conf_ctx stores the information necessary to interoperate with the configuration. It is created by calling libnet_conf_open() and destroyed by calling libnet_conf_close(). The context is passed to all the libnet_conf functions. It currently stores the token to access the registry. Later, it could store more data, e.g. the server to connect to, credentials, and so on. For support of other backends than registry or support of remote configuration, only the open function will have to be changed. In net_conf, the calls to the actual net_conf functions is wrapped into a function that calls libnet_conf_open()/_close(). Thus an individual variant of net_conf_runfunction2() and functable2 is used to cope with functions being called by the wrapper with the additional libnet_conf_ctx argument. Michael (This used to be commit c2a9346faa26e79af5948197a1b322e545f0ed09) --- source3/lib/netapi/serverinfo.c | 18 +++- source3/libnet/libnet.h | 1 + source3/libnet/libnet_conf.c | 211 ++++++++++++++++++++++++++-------------- source3/libnet/libnet_conf.h | 27 +++++ source3/libnet/libnet_join.c | 58 +++++++---- source3/utils/net_conf.c | 141 ++++++++++++++++++++------- 6 files changed, 328 insertions(+), 128 deletions(-) create mode 100644 source3/libnet/libnet_conf.h diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 0e356e0ee7..67680ba55a 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -149,6 +149,10 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, uint8_t *buffer, uint32_t *parm_error) { + WERROR werr; + struct libnet_conf_ctx *conf_ctx; + TALLOC_CTX *mem_ctx; + struct srvsvc_NetSrvInfo1005 *info1005; if (!buffer) { @@ -167,8 +171,20 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, return WERR_NOT_SUPPORTED; } - return libnet_conf_set_global_parameter("server string", + mem_ctx = talloc_stackframe(); + werr = libnet_conf_open(mem_ctx, &conf_ctx); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + + werr = libnet_conf_set_global_parameter(conf_ctx, + "server string", info1005->comment); + +done: + libnet_conf_close(conf_ctx); + TALLOC_FREE(mem_ctx); + return werr; } static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx, diff --git a/source3/libnet/libnet.h b/source3/libnet/libnet.h index fa24c3b40a..d6238ca982 100644 --- a/source3/libnet/libnet.h +++ b/source3/libnet/libnet.h @@ -21,6 +21,7 @@ #define __LIBNET_H__ #include "libnet/libnet_join.h" +#include "libnet/libnet_conf.h" #include "libnet/libnet_proto.h" #endif diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 47b4800d80..8e44e4f525 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -21,11 +21,6 @@ #include "includes.h" #include "libnet/libnet.h" -/* - * yuck - static variable to keep track of the registry initialization. - */ -static bool registry_initialized = false; - /********************************************************************** * * Helper functions (mostly registry related) @@ -59,20 +54,21 @@ static WERROR libnet_conf_add_string_to_array(TALLOC_CTX *mem_ctx, return WERR_OK; } -static WERROR libnet_conf_reg_initialize(void) +static WERROR libnet_conf_reg_initialize(struct libnet_conf_ctx *ctx) { WERROR werr = WERR_OK; - if (registry_initialized) { - goto done; - } - if (!registry_init_regdb()) { werr = WERR_REG_IO_FAILURE; goto done; } - registry_initialized = true; + werr = ntstatus_to_werror(registry_create_admin_token(ctx, + &(ctx->token))); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, ("Error creating admin token\n")); + goto done; + } done: return werr; @@ -82,40 +78,33 @@ done: * Open a registry key specified by "path" */ static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, const char *path, uint32 desired_access, struct registry_key **key) { WERROR werr = WERR_OK; - NT_USER_TOKEN *token = NULL; - TALLOC_CTX *tmp_ctx = NULL; - if (path == NULL) { - DEBUG(1, ("Error: NULL path string given\n")); + if (ctx == NULL) { + DEBUG(1, ("Error: configuration is not open!\n")); werr = WERR_INVALID_PARAM; goto done; } - tmp_ctx = talloc_new(mem_ctx); - if (tmp_ctx == NULL) { - werr = WERR_NOMEM; - goto done; - } - - werr = libnet_conf_reg_initialize(); - if (!W_ERROR_IS_OK(werr)) { - DEBUG(1, ("Error initializing registry: %s\n", - dos_errstr(werr))); + if (ctx->token == NULL) { + DEBUG(1, ("Error: token missing from libnet_conf_ctx. " + "was libnet_conf_open() called?\n")); + werr = WERR_INVALID_PARAM; goto done; } - werr = ntstatus_to_werror(registry_create_admin_token(tmp_ctx, &token)); - if (!W_ERROR_IS_OK(werr)) { - DEBUG(1, ("Error creating admin token\n")); + if (path == NULL) { + DEBUG(1, ("Error: NULL path string given\n")); + werr = WERR_INVALID_PARAM; goto done; } - werr = reg_open_path(mem_ctx, path, desired_access, token, key); + werr = reg_open_path(mem_ctx, path, desired_access, ctx->token, key); if (!W_ERROR_IS_OK(werr)) { DEBUG(1, ("Error opening registry path '%s': %s\n", @@ -123,14 +112,14 @@ static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx, } done: - TALLOC_FREE(tmp_ctx); return werr; } /** * Open a subkey of KEY_SMBCONF (i.e a service) */ -static WERROR libnet_conf_reg_open_service_key(TALLOC_CTX *ctx, +static WERROR libnet_conf_reg_open_service_key(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, const char *servicename, uint32 desired_access, struct registry_key **key) @@ -144,9 +133,10 @@ static WERROR libnet_conf_reg_open_service_key(TALLOC_CTX *ctx, goto done; } - path = talloc_asprintf(ctx, "%s\\%s", KEY_SMBCONF, servicename); + path = talloc_asprintf(mem_ctx, "%s\\%s", KEY_SMBCONF, servicename); - werr = libnet_conf_reg_open_path(ctx, path, desired_access, key); + werr = libnet_conf_reg_open_path(mem_ctx, ctx, path, desired_access, + key); done: TALLOC_FREE(path); @@ -156,11 +146,13 @@ done: /** * open the base key KEY_SMBCONF */ -static WERROR libnet_conf_reg_open_base_key(TALLOC_CTX *ctx, +static WERROR libnet_conf_reg_open_base_key(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, uint32 desired_access, struct registry_key **key) { - return libnet_conf_reg_open_path(ctx, KEY_SMBCONF, desired_access, key); + return libnet_conf_reg_open_path(mem_ctx, ctx, KEY_SMBCONF, + desired_access, key); } /** @@ -186,7 +178,8 @@ static bool libnet_conf_value_exists(struct registry_key *key, /** * create a subkey of KEY_SMBCONF */ -static WERROR libnet_conf_reg_create_service_key(TALLOC_CTX *ctx, +static WERROR libnet_conf_reg_create_service_key(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, const char * subkeyname, struct registry_key **newkey) { @@ -198,18 +191,18 @@ static WERROR libnet_conf_reg_create_service_key(TALLOC_CTX *ctx, /* create a new talloc ctx for creation. it will hold * the intermediate parent key (SMBCONF) for creation * and will be destroyed when leaving this function... */ - if (!(create_ctx = talloc_new(ctx))) { + if (!(create_ctx = talloc_new(mem_ctx))) { werr = WERR_NOMEM; goto done; } - werr = libnet_conf_reg_open_base_key(create_ctx, REG_KEY_WRITE, + werr = libnet_conf_reg_open_base_key(create_ctx, ctx, REG_KEY_WRITE, &create_parent); if (!W_ERROR_IS_OK(werr)) { goto done; } - werr = reg_createkey(ctx, create_parent, subkeyname, + werr = reg_createkey(mem_ctx, create_parent, subkeyname, REG_KEY_WRITE, newkey, &action); if (W_ERROR_IS_OK(werr) && (action != REG_CREATED_NEW_KEY)) { DEBUG(10, ("Key '%s' already exists.\n", subkeyname)); @@ -414,16 +407,72 @@ done: return werr; } +static int libnet_conf_destroy_ctx(struct libnet_conf_ctx *ctx) +{ + return regdb_close(); +} + /********************************************************************** * * The actual net conf api functions, that are exported. * **********************************************************************/ +/** + * Open the configuration. + * + * This should be the first function in a sequence of calls to libnet_conf + * functions: + * + * Upon success, this creates and returns the conf context + * that should be passed around in subsequent calls to the other + * libnet_conf functions. + * + * After the work with the configuration is completed, libnet_conf_close() + * should be called. + */ +WERROR libnet_conf_open(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx **conf_ctx) +{ + WERROR werr = WERR_OK; + struct libnet_conf_ctx *ctx; + + if (conf_ctx == NULL) { + return WERR_INVALID_PARAM; + } + + ctx = TALLOC_ZERO_P(mem_ctx, struct libnet_conf_ctx); + if (ctx == NULL) { + return WERR_NOMEM; + } + + werr = libnet_conf_reg_initialize(ctx); + if (!W_ERROR_IS_OK(werr)) { + goto fail; + } + + talloc_set_destructor(ctx, libnet_conf_destroy_ctx); + + *conf_ctx = ctx; + return werr; + +fail: + TALLOC_FREE(ctx); + return werr; +} + +/** + * Close the configuration. + */ +void libnet_conf_close(struct libnet_conf_ctx *ctx) +{ + /* this also closes the registry (by destructor): */ + TALLOC_FREE(ctx); +} + /** * Drop the whole configuration (restarting empty). */ -WERROR libnet_conf_drop(void) +WERROR libnet_conf_drop(struct libnet_conf_ctx *ctx) { char *path, *p; WERROR werr = WERR_OK; @@ -439,7 +488,7 @@ WERROR libnet_conf_drop(void) } p = strrchr(path, '\\'); *p = '\0'; - werr = libnet_conf_reg_open_path(mem_ctx, path, REG_KEY_WRITE, + werr = libnet_conf_reg_open_path(mem_ctx, ctx, path, REG_KEY_WRITE, &parent_key); if (!W_ERROR_IS_OK(werr)) { @@ -469,7 +518,8 @@ done: * param_names : list of lists of parameter names for each share * param_values : list of lists of parameter values for each share */ -WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx, uint32_t *num_shares, +WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, uint32_t *num_shares, char ***share_names, uint32_t **num_params, char ****param_names, char ****param_values) { @@ -496,7 +546,7 @@ WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx, uint32_t *num_shares, goto done; } - werr = libnet_conf_get_share_names(tmp_ctx, &tmp_num_shares, + werr = libnet_conf_get_share_names(tmp_ctx, ctx, &tmp_num_shares, &tmp_share_names); if (!W_ERROR_IS_OK(werr)) { goto done; @@ -514,7 +564,8 @@ WERROR libnet_conf_get_config(TALLOC_CTX *mem_ctx, uint32_t *num_shares, } for (count = 0; count < tmp_num_shares; count++) { - werr = libnet_conf_get_share(mem_ctx, tmp_share_names[count], + werr = libnet_conf_get_share(mem_ctx, ctx, + tmp_share_names[count], &tmp_num_params[count], &tmp_param_names[count], &tmp_param_values[count]); @@ -543,11 +594,12 @@ done: return werr; } - /** * get the list of share names defined in the configuration. */ -WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, +WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, + uint32_t *num_shares, char ***share_names) { uint32_t count; @@ -570,7 +622,7 @@ WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, } /* make sure "global" is always listed first */ - if (libnet_conf_share_exists(GLOBAL_NAME)) { + if (libnet_conf_share_exists(ctx, GLOBAL_NAME)) { werr = libnet_conf_add_string_to_array(tmp_ctx, &tmp_share_names, 0, GLOBAL_NAME); @@ -580,8 +632,8 @@ WERROR libnet_conf_get_share_names(TALLOC_CTX *mem_ctx, uint32_t *num_shares, added_count++; } - werr = libnet_conf_reg_open_base_key(tmp_ctx, SEC_RIGHTS_ENUM_SUBKEYS, - &key); + werr = libnet_conf_reg_open_base_key(tmp_ctx, ctx, + SEC_RIGHTS_ENUM_SUBKEYS, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -624,14 +676,15 @@ done: /** * check if a share/service of a given name exists */ -bool libnet_conf_share_exists(const char *servicename) +bool libnet_conf_share_exists(struct libnet_conf_ctx *ctx, + const char *servicename) { bool ret = false; WERROR werr = WERR_OK; TALLOC_CTX *mem_ctx = talloc_stackframe(); struct registry_key *key = NULL; - werr = libnet_conf_reg_open_service_key(mem_ctx, servicename, + werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, servicename, REG_KEY_READ, &key); if (W_ERROR_IS_OK(werr)) { ret = true; @@ -644,18 +697,20 @@ bool libnet_conf_share_exists(const char *servicename) /** * Add a service if it does not already exist. */ -WERROR libnet_conf_create_share(const char *servicename) +WERROR libnet_conf_create_share(struct libnet_conf_ctx *ctx, + const char *servicename) { WERROR werr; TALLOC_CTX *mem_ctx = talloc_stackframe(); struct registry_key *key = NULL; - if (libnet_conf_share_exists(servicename)) { + if (libnet_conf_share_exists(ctx, servicename)) { werr = WERR_ALREADY_EXISTS; goto done; } - werr = libnet_conf_reg_create_service_key(mem_ctx, servicename, &key); + werr = libnet_conf_reg_create_service_key(mem_ctx, ctx, servicename, + &key); done: TALLOC_FREE(mem_ctx); @@ -665,14 +720,14 @@ done: /** * get a definition of a share (service) from configuration. */ -WERROR libnet_conf_get_share(TALLOC_CTX *mem_ctx, const char *servicename, - uint32_t *num_params, char ***param_names, - char ***param_values) +WERROR libnet_conf_get_share(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx *ctx, + const char *servicename, uint32_t *num_params, + char ***param_names, char ***param_values) { WERROR werr = WERR_OK; struct registry_key *key = NULL; - werr = libnet_conf_reg_open_service_key(mem_ctx, servicename, + werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, servicename, REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { goto done; @@ -689,13 +744,14 @@ done: /** * delete a service from configuration */ -WERROR libnet_conf_delete_share(const char *servicename) +WERROR libnet_conf_delete_share(struct libnet_conf_ctx *ctx, + const char *servicename) { WERROR werr = WERR_OK; struct registry_key *key = NULL; - TALLOC_CTX *ctx = talloc_stackframe(); + TALLOC_CTX *mem_ctx = talloc_stackframe(); - werr = libnet_conf_reg_open_base_key(ctx, REG_KEY_WRITE, &key); + werr = libnet_conf_reg_open_base_key(mem_ctx, ctx, REG_KEY_WRITE, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -703,14 +759,15 @@ WERROR libnet_conf_delete_share(const char *servicename) werr = reg_deletekey_recursive(key, key, servicename); done: - TALLOC_FREE(ctx); + TALLOC_FREE(mem_ctx); return werr; } /** * set a configuration parameter to the value provided. */ -WERROR libnet_conf_set_parameter(const char *service, +WERROR libnet_conf_set_parameter(struct libnet_conf_ctx *ctx, + const char *service, const char *param, const char *valstr) { @@ -718,15 +775,15 @@ WERROR libnet_conf_set_parameter(const char *service, struct registry_key *key = NULL; TALLOC_CTX *mem_ctx = talloc_stackframe(); - if (!libnet_conf_share_exists(service)) { - werr = libnet_conf_create_share(service); + if (!libnet_conf_share_exists(ctx, service)) { + werr = libnet_conf_create_share(ctx, service); if (!W_ERROR_IS_OK(werr)) { goto done; } } - werr = libnet_conf_reg_open_service_key(mem_ctx, service, REG_KEY_WRITE, - &key); + werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, service, + REG_KEY_WRITE, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -742,6 +799,7 @@ done: * get the value of a configuration parameter as a string */ WERROR libnet_conf_get_parameter(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, const char *service, const char *param, char **valstr) @@ -755,13 +813,13 @@ WERROR libnet_conf_get_parameter(TALLOC_CTX *mem_ctx, goto done; } - if (!libnet_conf_share_exists(service)) { + if (!libnet_conf_share_exists(ctx, service)) { werr = WERR_NO_SUCH_SERVICE; goto done; } - werr = libnet_conf_reg_open_service_key(mem_ctx, service, REG_KEY_READ, - &key); + werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, service, + REG_KEY_READ, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -791,17 +849,19 @@ done: /** * delete a parameter from configuration */ -WERROR libnet_conf_delete_parameter(const char *service, const char *param) +WERROR libnet_conf_delete_parameter(struct libnet_conf_ctx *ctx, + const char *service, const char *param) { struct registry_key *key = NULL; WERROR werr = WERR_OK; TALLOC_CTX *mem_ctx = talloc_stackframe(); - if (!libnet_conf_share_exists(service)) { + if (!libnet_conf_share_exists(ctx, service)) { return WERR_NO_SUCH_SERVICE; } - werr = libnet_conf_reg_open_service_key(mem_ctx, service, REG_KEY_ALL, + werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, service, + REG_KEY_ALL, &key); if (!W_ERROR_IS_OK(werr)) { goto done; @@ -826,8 +886,9 @@ done: * **********************************************************************/ -WERROR libnet_conf_set_global_parameter(const char *param, const char *val) +WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx, + const char *param, const char *val) { - return libnet_conf_set_parameter(GLOBAL_NAME, param, val); + return libnet_conf_set_parameter(ctx, GLOBAL_NAME, param, val); } diff --git a/source3/libnet/libnet_conf.h b/source3/libnet/libnet_conf.h new file mode 100644 index 0000000000..b518c0e3b0 --- /dev/null +++ b/source3/libnet/libnet_conf.h @@ -0,0 +1,27 @@ +/* + * Unix SMB/CIFS implementation. + * libnet smbconf registry support + * Copyright (C) Michael Adam 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LIBNET_CONF_H__ +#define __LIBNET_CONF_H__ + +struct libnet_conf_ctx { + NT_USER_TOKEN *token; +}; + +#endif diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 9b62286ecb..66b5461dc2 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -19,8 +19,7 @@ */ #include "includes.h" -#include "libnet/libnet_join.h" -#include "libnet/libnet_proto.h" +#include "libnet/libnet.h" /**************************************************************** ****************************************************************/ @@ -886,33 +885,48 @@ done: static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) { WERROR werr; + struct libnet_conf_ctx *ctx; + + werr = libnet_conf_open(r, &ctx); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) { - werr = libnet_conf_set_global_parameter("security", "user"); - W_ERROR_NOT_OK_RETURN(werr); + werr = libnet_conf_set_global_parameter(ctx, "security", "user"); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } - werr = libnet_conf_set_global_parameter("workgroup", + werr = libnet_conf_set_global_parameter(ctx, "workgroup", r->in.domain_name); - return werr; + goto done; } - werr = libnet_conf_set_global_parameter("security", "domain"); - W_ERROR_NOT_OK_RETURN(werr); + werr = libnet_conf_set_global_parameter(ctx, "security", "domain"); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } - werr = libnet_conf_set_global_parameter("workgroup", + werr = libnet_conf_set_global_parameter(ctx, "workgroup", r->out.netbios_domain_name); - W_ERROR_NOT_OK_RETURN(werr); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (r->out.domain_is_ad) { - werr = libnet_conf_set_global_parameter("security", "ads"); - W_ERROR_NOT_OK_RETURN(werr); + werr = libnet_conf_set_global_parameter(ctx, "security", "ads"); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } - werr = libnet_conf_set_global_parameter("realm", + werr = libnet_conf_set_global_parameter(ctx, "realm", r->out.dns_domain_name); - W_ERROR_NOT_OK_RETURN(werr); } +done: + libnet_conf_close(ctx); return werr; } @@ -922,15 +936,25 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) { WERROR werr = WERR_OK; + struct libnet_conf_ctx *ctx; + + werr = libnet_conf_open(r, &ctx); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - werr = libnet_conf_set_global_parameter("security", "user"); - W_ERROR_NOT_OK_RETURN(werr); + werr = libnet_conf_set_global_parameter(ctx, "security", "user"); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } } - libnet_conf_delete_parameter(GLOBAL_NAME, "realm"); + libnet_conf_delete_parameter(ctx, GLOBAL_NAME, "realm"); +done: + libnet_conf_close(ctx); return werr; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 38cdeacc11..f212ed7b19 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -188,6 +188,7 @@ static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm, } static int import_process_service(TALLOC_CTX *ctx, + struct libnet_conf_ctx *conf_ctx, struct share_params *share) { int ret = -1; @@ -210,8 +211,8 @@ static int import_process_service(TALLOC_CTX *ctx, if (opt_testmode) { d_printf("[%s]\n", servicename); } else { - if (libnet_conf_share_exists(servicename)) { - werr = libnet_conf_delete_share(servicename); + if (libnet_conf_share_exists(conf_ctx, servicename)) { + werr = libnet_conf_delete_share(conf_ctx, servicename); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -232,7 +233,8 @@ static int import_process_service(TALLOC_CTX *ctx, if (opt_testmode) { d_printf("\t%s = %s\n", parm->label, valstr); } else { - werr = libnet_conf_set_parameter(servicename, + werr = libnet_conf_set_parameter(conf_ctx, + servicename, parm->label, valstr); if (!W_ERROR_IS_OK(werr)) { @@ -275,7 +277,8 @@ static bool globals_exist(void) * the conf functions */ -static int net_conf_list(int argc, const char **argv) +static int net_conf_list(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { WERROR werr = WERR_OK; int ret = -1; @@ -294,9 +297,8 @@ static int net_conf_list(int argc, const char **argv) goto done; } - werr = libnet_conf_get_config(ctx, &num_shares, &share_names, - &num_params, ¶m_names, - ¶m_values); + werr = libnet_conf_get_config(ctx, conf_ctx, &num_shares, &share_names, + &num_params, ¶m_names, ¶m_values); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error getting config: %s\n", dos_errstr(werr)); @@ -322,7 +324,8 @@ done: return ret; } -static int net_conf_import(int argc, const char **argv) +static int net_conf_import(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { int ret = -1; const char *filename = NULL; @@ -369,7 +372,7 @@ static int net_conf_import(int argc, const char **argv) strequal(servicename, GLOBAL_NAME)) { service_found = true; - if (import_process_service(ctx, &global_share) != 0) { + if (import_process_service(ctx, conf_ctx, &global_share) != 0) { goto done; } } @@ -388,7 +391,7 @@ static int net_conf_import(int argc, const char **argv) || strequal(servicename, lp_servicename(share->service))) { service_found = true; - if (import_process_service(ctx, share)!= 0) { + if (import_process_service(ctx, conf_ctx, share)!= 0) { goto done; } } @@ -408,7 +411,8 @@ done: return ret; } -static int net_conf_listshares(int argc, const char **argv) +static int net_conf_listshares(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { WERROR werr = WERR_OK; int ret = -1; @@ -423,7 +427,8 @@ static int net_conf_listshares(int argc, const char **argv) goto done; } - werr = libnet_conf_get_share_names(ctx, &num_shares, &share_names); + werr = libnet_conf_get_share_names(ctx, conf_ctx, &num_shares, + &share_names); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -440,7 +445,8 @@ done: return ret; } -static int net_conf_drop(int argc, const char **argv) +static int net_conf_drop(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { int ret = -1; WERROR werr; @@ -450,7 +456,7 @@ static int net_conf_drop(int argc, const char **argv) goto done; } - werr = libnet_conf_drop(); + werr = libnet_conf_drop(conf_ctx); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error deleting configuration: %s\n", dos_errstr(werr)); @@ -463,7 +469,8 @@ done: return ret; } -static int net_conf_showshare(int argc, const char **argv) +static int net_conf_showshare(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; @@ -483,7 +490,7 @@ static int net_conf_showshare(int argc, const char **argv) sharename = argv[0]; - werr = libnet_conf_get_share(ctx, sharename, &num_params, + werr = libnet_conf_get_share(ctx, conf_ctx, sharename, &num_params, ¶m_names, ¶m_values); if (!W_ERROR_IS_OK(werr)) { d_printf("error getting share parameters: %s\n", @@ -511,7 +518,8 @@ done: * This is a high level utility function of the net conf utility, * not a direct frontend to the libnet_conf API. */ -static int net_conf_addshare(int argc, const char **argv) +static int net_conf_addshare(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; @@ -599,7 +607,7 @@ static int net_conf_addshare(int argc, const char **argv) goto done; } - if (libnet_conf_share_exists(sharename)) { + if (libnet_conf_share_exists(conf_ctx, sharename)) { d_fprintf(stderr, "ERROR: share %s already exists.\n", sharename); goto done; @@ -634,7 +642,7 @@ static int net_conf_addshare(int argc, const char **argv) * create the share */ - werr = libnet_conf_create_share(sharename); + werr = libnet_conf_create_share(conf_ctx, sharename); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error creating share %s: %s\n", sharename, dos_errstr(werr)); @@ -645,7 +653,7 @@ static int net_conf_addshare(int argc, const char **argv) * fill the share with parameters */ - werr = libnet_conf_set_parameter(sharename, "path", path); + werr = libnet_conf_set_parameter(conf_ctx, sharename, "path", path); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "path", dos_errstr(werr)); @@ -653,7 +661,8 @@ static int net_conf_addshare(int argc, const char **argv) } if (comment != NULL) { - werr = libnet_conf_set_parameter(sharename, "comment", comment); + werr = libnet_conf_set_parameter(conf_ctx, sharename, "comment", + comment); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "comment", dos_errstr(werr)); @@ -661,14 +670,16 @@ static int net_conf_addshare(int argc, const char **argv) } } - werr = libnet_conf_set_parameter(sharename, "guest ok", guest_ok); + werr = libnet_conf_set_parameter(conf_ctx, sharename, "guest ok", + guest_ok); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "'guest ok'", dos_errstr(werr)); goto done; } - werr = libnet_conf_set_parameter(sharename, "writeable", writeable); + werr = libnet_conf_set_parameter(conf_ctx, sharename, "writeable", + writeable); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting parameter %s: %s\n", "writeable", dos_errstr(werr)); @@ -682,7 +693,8 @@ done: return ret; } -static int net_conf_delshare(int argc, const char **argv) +static int net_conf_delshare(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { int ret = -1; const char *sharename = NULL; @@ -694,7 +706,7 @@ static int net_conf_delshare(int argc, const char **argv) } sharename = argv[0]; - werr = libnet_conf_delete_share(sharename); + werr = libnet_conf_delete_share(conf_ctx, sharename); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error deleting share %s: %s\n", sharename, dos_errstr(werr)); @@ -706,7 +718,8 @@ done: return ret; } -static int net_conf_setparm(int argc, const char **argv) +static int net_conf_setparm(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; @@ -722,8 +735,8 @@ static int net_conf_setparm(int argc, const char **argv) param = strdup_lower(argv[1]); value_str = argv[2]; - if (!libnet_conf_share_exists(service)) { - werr = libnet_conf_create_share(service); + if (!libnet_conf_share_exists(conf_ctx, service)) { + werr = libnet_conf_create_share(conf_ctx, service); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error creating share '%s': %s\n", service, dos_errstr(werr)); @@ -731,7 +744,7 @@ static int net_conf_setparm(int argc, const char **argv) } } - werr = libnet_conf_set_parameter(service, param, value_str); + werr = libnet_conf_set_parameter(conf_ctx, service, param, value_str); if (!W_ERROR_IS_OK(werr)) { d_fprintf(stderr, "Error setting value '%s': %s\n", @@ -747,7 +760,8 @@ done: return ret; } -static int net_conf_getparm(int argc, const char **argv) +static int net_conf_getparm(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; @@ -765,7 +779,7 @@ static int net_conf_getparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - werr = libnet_conf_get_parameter(ctx, service, param, &valstr); + werr = libnet_conf_get_parameter(ctx, conf_ctx, service, param, &valstr); if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, @@ -793,7 +807,8 @@ done: return ret; } -static int net_conf_delparm(int argc, const char **argv) +static int net_conf_delparm(struct libnet_conf_ctx *conf_ctx, + int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; @@ -807,7 +822,7 @@ static int net_conf_delparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - werr = libnet_conf_delete_parameter(service, param); + werr = libnet_conf_delete_parameter(conf_ctx, service, param); if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, @@ -833,6 +848,62 @@ done: return ret; } +static int net_conf_wrap_function(int (*fn)(struct libnet_conf_ctx *, + int, const char **), + int argc, const char **argv) +{ + WERROR werr; + TALLOC_CTX *mem_ctx = talloc_stackframe(); + struct libnet_conf_ctx *conf_ctx; + int ret = -1; + + werr = libnet_conf_open(mem_ctx, &conf_ctx); + + if (!W_ERROR_IS_OK(werr)) { + return -1; + } + + ret = fn(conf_ctx, argc, argv); + + libnet_conf_close(conf_ctx); + + return ret; +} + +/* + * We need a functable struct of our own, because the + * functions are called through a wrapper that handles + * the opening and closing of the configuration, and so on. + */ +struct conf_functable { + const char *funcname; + int (*fn)(struct libnet_conf_ctx *ctx, int argc, const char **argv); + const char *helptext; +}; + +static int net_conf_run_function(int argc, const char **argv, + const char *whoami, + struct conf_functable *table) +{ + int i; + + if (argc != 0) { + for (i=0; table[i].funcname; i++) { + if (StrCaseCmp(argv[0], table[i].funcname) == 0) + return net_conf_wrap_function(table[i].fn, + argc-1, + argv+1); + } + } + + for (i=0; table[i].funcname; i++) { + d_printf("%s %-15s %s\n", whoami, table[i].funcname, + table[i].helptext); + } + + return -1; +} + /* * Entry-point for all the CONF functions. */ @@ -840,7 +911,7 @@ done: int net_conf(int argc, const char **argv) { int ret = -1; - struct functable2 func[] = { + struct conf_functable func_table[] = { {"list", net_conf_list, "Dump the complete configuration in smb.conf like format."}, {"import", net_conf_import, @@ -864,7 +935,7 @@ int net_conf(int argc, const char **argv) {NULL, NULL, NULL} }; - ret = net_run_function2(argc, argv, "net conf", func); + ret = net_conf_run_function(argc, argv, "net conf", func_table); return ret; } -- cgit From 58d2f1ff81ce6af8337824427a88f6d035488edb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 12:52:25 +0100 Subject: Fix Compiler warnings by including the proper header. Michael (This used to be commit edaf52a301a38824c8beb30c49fba27c8fb0461a) --- source3/rpc_server/srv_wkssvc_nt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/rpc_server/srv_wkssvc_nt.c b/source3/rpc_server/srv_wkssvc_nt.c index b30a7f8792..849ec9c4eb 100644 --- a/source3/rpc_server/srv_wkssvc_nt.c +++ b/source3/rpc_server/srv_wkssvc_nt.c @@ -22,8 +22,7 @@ /* This is the implementation of the wks interface. */ #include "includes.h" -#include "libnet/libnet_join.h" -#include "libnet/libnet_proto.h" +#include "libnet/libnet.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -- cgit From d49ba81210970e44cc1c7179a959f74351684fdf Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Sun, 13 Jan 2008 12:07:18 -0500 Subject: Fix compile and linking errors since last this code was tested (This used to be commit 2f432842442859f98ecd263464ce02821ab10fca) --- examples/libsmbclient/Makefile | 2 +- examples/libsmbclient/smbwrapper/Makefile | 2 +- examples/libsmbclient/smbwrapper/wrapper.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 6500707e75..26b80575fb 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -13,7 +13,7 @@ CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS) LDFLAGS = -L/usr/local/samba/lib \ -lldap -lkrb5 -lgssapi_krb5 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so -LIBSMBCLIENT = -lsmbclient -ldl -lresolv +LIBSMBCLIENT = -lwbclient -lsmbclient -ldl -lresolv TESTS= testsmbc \ testacl \ diff --git a/examples/libsmbclient/smbwrapper/Makefile b/examples/libsmbclient/smbwrapper/Makefile index c94ef8fa6a..726435319f 100644 --- a/examples/libsmbclient/smbwrapper/Makefile +++ b/examples/libsmbclient/smbwrapper/Makefile @@ -1,4 +1,4 @@ -LIBS = -lsmbclient -ldl +LIBS = -lwbclient -lsmbclient -ldl DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE CFLAGS = -I$(SAMBA_INCL) $(EXTLIB_INCL) diff --git a/examples/libsmbclient/smbwrapper/wrapper.c b/examples/libsmbclient/smbwrapper/wrapper.c index 30f9037d53..958e00636e 100644 --- a/examples/libsmbclient/smbwrapper/wrapper.c +++ b/examples/libsmbclient/smbwrapper/wrapper.c @@ -61,6 +61,7 @@ #include #include #include +#include #ifdef __USE_GNU # define SMBW_USE_GNU #endif -- cgit From 5b6520044b7026baf1cff554b400f7ff1f024d77 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Jan 2008 23:00:48 +0100 Subject: Fix the max_dead_record calculations (This used to be commit 4aaf4e7e73a5c7fa97ef730fbff5c7cb12df2d6c) --- source3/lib/tdb/common/open.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source3/lib/tdb/common/open.c b/source3/lib/tdb/common/open.c index 6bd8fda2bf..94140a4baa 100644 --- a/source3/lib/tdb/common/open.c +++ b/source3/lib/tdb/common/open.c @@ -179,9 +179,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->page_size = 0x2000; } - if (open_flags & TDB_VOLATILE) { - tdb->max_dead_records = 5; - } + tdb->max_dead_records = (open_flags & TDB_VOLATILE) ? 5 : 0; if ((open_flags & O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n", @@ -288,7 +286,6 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; - tdb->max_dead_records = 0; tdb_mmap(tdb); if (locked) { if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) { -- cgit From 011e89c85868ec8f16e475a560a0e5bd41995920 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Sun, 13 Jan 2008 17:10:06 -0500 Subject: Fix smbc_listxattr() and friends (bug #5189) When the capability of using full names for DOS attributes was added, a bug was introduced which caused the wrong number of bytes to be returned. This patch to smbc_listxattr_ctx() fixes the problem. Thanks to Jack Schmidt for this patch. Derrell (This used to be commit 913c335d21c503d32b35bf65da7b2bddf0473875) --- examples/libsmbclient/testacl.c | 27 ++++++++++++++++++++++++++- source3/include/libsmbclient.h | 2 +- source3/libsmb/libsmbclient.c | 11 +++++++---- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c index 4d327b39a7..51cc90f101 100644 --- a/examples/libsmbclient/testacl.c +++ b/examples/libsmbclient/testacl.c @@ -7,6 +7,7 @@ enum acl_mode { + SMB_ACL_LIST, SMB_ACL_GET, SMB_ACL_SET, SMB_ACL_DELETE, @@ -24,7 +25,7 @@ int main(int argc, const char *argv[]) int debug = 0; int numeric = 0; int full_time_names = 0; - enum acl_mode mode = SMB_ACL_GET; + enum acl_mode mode = SMB_ACL_LIST; static char *the_acl = NULL; int ret; char *p; @@ -149,6 +150,30 @@ int main(int argc, const char *argv[]) switch(mode) { + case SMB_ACL_LIST: + ret = smbc_listxattr(path, value, sizeof(value)-2); + if (ret < 0) + { + printf("Could not get attribute list for [%s] %d: %s\n", + path, errno, strerror(errno)); + return 1; + } + + /* + * The list of attributes has a series of null-terminated strings. + * The list of strings terminates with an extra null byte, thus two in + * a row. Ensure that our buffer, which is conceivably shorter than + * the list of attributes, actually ends with two null bytes in a row. + */ + value[sizeof(value) - 2] = '\0'; + value[sizeof(value) - 1] = '\0'; + printf("Supported attributes:\n"); + for (p = value; *p; p += strlen(p) + 1) + { + printf("\t%s\n", p); + } + break; + case SMB_ACL_GET: if (the_acl == NULL) { diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h index 9175b33d60..07242f7956 100644 --- a/source3/include/libsmbclient.h +++ b/source3/include/libsmbclient.h @@ -1961,7 +1961,7 @@ int smbc_fremovexattr(int fd, * extended attributes * * @note This function always returns all attribute names supported - * by NT file systems, regardless of wether the referenced + * by NT file systems, regardless of whether the referenced * file system supports extended attributes (e.g. a Windows * 2000 machine supports extended attributes if NTFS is used, * but not if FAT is used, and Windows 98 doesn't support diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index da8f1e332b..179f6eba5d 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -6241,6 +6241,7 @@ smbc_listxattr_ctx(SMBCCTX *context, * the complete set of attribute names, always, rather than only those * attribute names which actually exist for a file. Hmmm... */ + size_t retsize; const char supported_old[] = "system.*\0" "system.*+\0" @@ -6284,22 +6285,24 @@ smbc_listxattr_ctx(SMBCCTX *context, if (context->internal->_full_time_names) { supported = supported_new; + retsize = sizeof(supported_new); } else { supported = supported_old; + retsize = sizeof(supported_old); } if (size == 0) { - return sizeof(supported); + return retsize; } - if (sizeof(supported) > size) { + if (retsize > size) { errno = ERANGE; return -1; } /* this can't be strcpy() because there are embedded null characters */ - memcpy(list, supported, sizeof(supported)); - return sizeof(supported); + memcpy(list, supported, retsize); + return retsize; } -- cgit From 89fb79ada6cf8cdc94ae181cdcfa9a2c0a4ffaeb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 22:49:42 +0100 Subject: Remove auto-generation of missing share from libnet_conf_set_parameter(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Günther, I wanted to have this as atomic as possible. I will add this behaviour to libnet_conf_set_global_parameter() next with the justification that [global] should exist transparently. Michael (This used to be commit e2b34e9c028d712c7c8b22aade2c11d347ae176d) --- source3/libnet/libnet_conf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 8e44e4f525..11dc1639ad 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -776,10 +776,8 @@ WERROR libnet_conf_set_parameter(struct libnet_conf_ctx *ctx, TALLOC_CTX *mem_ctx = talloc_stackframe(); if (!libnet_conf_share_exists(ctx, service)) { - werr = libnet_conf_create_share(ctx, service); - if (!W_ERROR_IS_OK(werr)) { - goto done; - } + werr = WERR_NO_SUCH_SERVICE; + goto done; } werr = libnet_conf_reg_open_service_key(mem_ctx, ctx, service, -- cgit From 8fc2db5070aadee5719fd1651e86d92378927cbf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 22:56:11 +0100 Subject: Add auto-adding of [global] to libnet_conf_set_global_parameter(). Michael (This used to be commit ad2497cfac90b2e91be6995931629453fd6ed5fa) --- source3/libnet/libnet_conf.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 11dc1639ad..3934f2c476 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -887,6 +887,17 @@ done: WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx, const char *param, const char *val) { - return libnet_conf_set_parameter(ctx, GLOBAL_NAME, param, val); + WERROR werr; + + if (!libnet_conf_share_exists(ctx, GLOBAL_NAME)) { + werr = libnet_conf_create_share(ctx, GLOBAL_NAME); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + } + werr = libnet_conf_set_parameter(ctx, GLOBAL_NAME, param, val); + +done: + return werr; } -- cgit From ecc53ab37147affbc0ee6fdae5a980dabe73b4f4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 22:56:56 +0100 Subject: Add a comment header to libnet_conf_set_global_parameter(). Michael (This used to be commit c050b148d00c79571ef0e85c6e7c86d551ca6efd) --- source3/libnet/libnet_conf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 3934f2c476..005a35fd0c 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -884,6 +884,12 @@ done: * **********************************************************************/ +/** + * Set a global parameter + * (i.e. a parameter in the [global] service). + * + * This also creates [global] when it does not exist. + */ WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx, const char *param, const char *val) { -- cgit From d042a6409225f17b9d8665477fffb08c311512d9 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 23:00:16 +0100 Subject: Move libnet_conf_set_global_parameter() inside libnet_conf.c Also remove the "convenience function" section comment. The set_global_parameter function now has a right to exist in the api. Michael (This used to be commit fd99c1804ae04b7c2a2b0a605e83ba88fa362edb) --- source3/libnet/libnet_conf.c | 53 +++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 005a35fd0c..858c4a06b4 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -793,6 +793,29 @@ done: return werr; } +/** + * Set a global parameter + * (i.e. a parameter in the [global] service). + * + * This also creates [global] when it does not exist. + */ +WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx, + const char *param, const char *val) +{ + WERROR werr; + + if (!libnet_conf_share_exists(ctx, GLOBAL_NAME)) { + werr = libnet_conf_create_share(ctx, GLOBAL_NAME); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + } + werr = libnet_conf_set_parameter(ctx, GLOBAL_NAME, param, val); + +done: + return werr; +} + /** * get the value of a configuration parameter as a string */ @@ -877,33 +900,3 @@ done: return werr; } - -/********************************************************************** - * - * Convenience functions that are also exported. - * - **********************************************************************/ - -/** - * Set a global parameter - * (i.e. a parameter in the [global] service). - * - * This also creates [global] when it does not exist. - */ -WERROR libnet_conf_set_global_parameter(struct libnet_conf_ctx *ctx, - const char *param, const char *val) -{ - WERROR werr; - - if (!libnet_conf_share_exists(ctx, GLOBAL_NAME)) { - werr = libnet_conf_create_share(ctx, GLOBAL_NAME); - if (!W_ERROR_IS_OK(werr)) { - goto done; - } - } - werr = libnet_conf_set_parameter(ctx, GLOBAL_NAME, param, val); - -done: - return werr; -} - -- cgit From c4899fec9f3957c52d3a856000631d59a3346ac0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 23:12:27 +0100 Subject: Add a function libnet_conf_get_global_parameter() to libnet_conf.c It creates the [global] section if it does not yet exist. Michael (This used to be commit 627a29b690c30f1096a4746186089cd9a1c92407) --- source3/libnet/libnet_conf.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 858c4a06b4..37e05b9fe9 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -867,6 +867,31 @@ done: return werr; } +/** + * Get the value of a global parameter. + * + * Create [global] if it does not exist. + */ +WERROR libnet_conf_get_global_parameter(TALLOC_CTX *mem_ctx, + struct libnet_conf_ctx *ctx, + const char *param, + char **valstr) +{ + WERROR werr; + + if (!libnet_conf_share_exists(ctx, GLOBAL_NAME)) { + werr = libnet_conf_create_share(ctx, GLOBAL_NAME); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + } + werr = libnet_conf_get_parameter(mem_ctx, ctx, GLOBAL_NAME, param, + valstr); + +done: + return werr; +} + /** * delete a parameter from configuration */ -- cgit From 864fc10a278869b1474e407c963f9f40464d55c0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 23:16:01 +0100 Subject: Add a function libnet_conf_delete_global_parameter() to libnet_conf.c Create the [global] section if it does not yet exist. Michael (This used to be commit 90fa2981c949e21f66a44d634ebe9d661819f0a3) --- source3/libnet/libnet_conf.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index 37e05b9fe9..d20e10b141 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -925,3 +925,24 @@ done: return werr; } +/** + * Delete a global parameter. + * + * Create [global] if it does not exist. + */ +WERROR libnet_conf_delete_global_parameter(struct libnet_conf_ctx *ctx, + const char *param) +{ + WERROR werr; + + if (!libnet_conf_share_exists(ctx, GLOBAL_NAME)) { + werr = libnet_conf_create_share(ctx, GLOBAL_NAME); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } + } + werr = libnet_conf_delete_parameter(ctx, GLOBAL_NAME, param); + +done: + return werr; +} -- cgit From 3910dd2e1b069a58ef68c6848495afc0df8fa2ae Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 23:20:51 +0100 Subject: Make use of the new libnet_conf_delete_global_parameter() function. Michael (This used to be commit aed01fd28c8e896e993239cbe9b2681132ddf980) --- source3/libnet/libnet_join.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 66b5461dc2..eaf851ccec 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -951,7 +951,7 @@ static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) } } - libnet_conf_delete_parameter(ctx, GLOBAL_NAME, "realm"); + libnet_conf_delete_global_parameter(ctx, "realm"); done: libnet_conf_close(ctx); -- cgit From a6bf13ce971a87c1291082a4bc90fdca6d2b8c2b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 23:30:08 +0100 Subject: Add explicit creation of shares to net conf import function. It has been removed from libnet_conf_set_parameter(). Michael (This used to be commit b5c533b06cba9a8ffd28a1fb3bc56ab248340775) --- source3/utils/net_conf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index f212ed7b19..9a4f3ff69a 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -217,6 +217,10 @@ static int import_process_service(TALLOC_CTX *ctx, goto done; } } + werr = libnet_conf_create_share(conf_ctx, servicename); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } } while ((parm = lp_next_parameter(share->service, &pnum, 0))) -- cgit From 801eeaec09f9a53759185a834f42e3d266ec4bce Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 23:45:57 +0100 Subject: Add and modify comments in net_conf.c Michael (This used to be commit b3afc8391d40745328172ba012f0ffc166d75aa9) --- source3/utils/net_conf.c | 50 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 9a4f3ff69a..26ed41b2a0 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -31,9 +31,11 @@ #include "utils/net.h" #include "libnet/libnet.h" -/* +/********************************************************************** + * * usage functions - */ + * + **********************************************************************/ static int net_conf_list_usage(int argc, const char **argv) { @@ -109,10 +111,16 @@ static int net_conf_delparm_usage(int argc, const char **argv) } -/* +/********************************************************************** + * * Helper functions - */ + * + **********************************************************************/ +/** + * This formats an in-memory smbconf parameter to a string. + * The result string is allocated with talloc. + */ static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm, struct share_params *share) { @@ -187,6 +195,10 @@ static char *parm_valstr(TALLOC_CTX *ctx, struct parm_struct *parm, return valstr; } +/** + * This functions imports a configuration that has previously + * been loaded with lp_load() to registry. + */ static int import_process_service(TALLOC_CTX *ctx, struct libnet_conf_ctx *conf_ctx, struct share_params *share) @@ -263,7 +275,10 @@ done: return ret; } -/* return true iff there are nondefault globals */ +/** + * Return true iff there are nondefault globals in the + * currently loaded configuration. + */ static bool globals_exist(void) { int i = 0; @@ -277,9 +292,12 @@ static bool globals_exist(void) return false; } -/* - * the conf functions - */ + +/********************************************************************** + * + * the main conf functions + * + **********************************************************************/ static int net_conf_list(struct libnet_conf_ctx *conf_ctx, int argc, const char **argv) @@ -852,6 +870,18 @@ done: return ret; } + +/********************************************************************** + * + * Wrapper and net_conf_run_function mechanism. + * + **********************************************************************/ + +/** + * Wrapper function to call the main conf functions. + * The wrapper calls handles opening and closing of the + * configuration. + */ static int net_conf_wrap_function(int (*fn)(struct libnet_conf_ctx *, int, const char **), int argc, const char **argv) @@ -885,6 +915,10 @@ struct conf_functable { const char *helptext; }; +/** + * This imitates net_run_function2 but calls the main functions + * through the wrapper net_conf_wrap_function(). + */ static int net_conf_run_function(int argc, const char **argv, const char *whoami, struct conf_functable *table) -- cgit From 971abee49014c78fc5990225a130e1671ed776fd Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Jan 2008 23:54:48 +0100 Subject: Fix a syntax error in script/tests/test_local_s3.sh . This will reveal the currently breaking tdbtorture to the build farm... Michael (This used to be commit 50f65c3c5500da8d657d5fc340e666ee8cfe148e) --- source3/script/tests/test_local_s3.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/script/tests/test_local_s3.sh b/source3/script/tests/test_local_s3.sh index 6117106c8a..fd8f98ccab 100755 --- a/source3/script/tests/test_local_s3.sh +++ b/source3/script/tests/test_local_s3.sh @@ -21,6 +21,6 @@ testit "replacetort" $VALGRIND $BINDIR/replacetort || \ failed=`expr $failed + 1` testit "tdbtorture" $VALGRIND $BINDIR/tdbtorture || \ - failed=`expr $failed +1` + failed=`expr $failed + 1` testok $0 $failed -- cgit From 8a76e6aff0bea259f4233f914c5987bb290e3b9e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 14 Jan 2008 00:23:11 +0100 Subject: Reset the failed counter in test_wbinfo_s3.sh. Michael (This used to be commit 3eedb8928413da102446b76aa64d1feaecb95b52) --- source3/script/tests/test_wbinfo_s3.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/script/tests/test_wbinfo_s3.sh b/source3/script/tests/test_wbinfo_s3.sh index 6a8faa1f87..01eed6ead6 100755 --- a/source3/script/tests/test_wbinfo_s3.sh +++ b/source3/script/tests/test_wbinfo_s3.sh @@ -35,6 +35,8 @@ tests="$tests:--name-to-sid=$username" #Didn't pass yet# tests="$tests:--user-info=$username" tests="$tests:--user-groups=$username" +failed=0 + OLDIFS=$IFS NEWIFS=$':' IFS=$NEWIFS -- cgit From a1902700c45935f0a1071100810e91142ceb273e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Jan 2008 15:38:43 +1100 Subject: merged tdb fix from ctdb tree (This used to be commit c91e9c785b5bf4b0c479edf8eb33da22bf615387) --- source3/lib/tdb/common/tdb.c | 47 ++++++++++++++++++++++ source3/lib/tdb/common/transaction.c | 75 ++++++++++++++++++++++++++++++++++++ source3/lib/tdb/include/tdb.h | 1 + 3 files changed, 123 insertions(+) diff --git a/source3/lib/tdb/common/tdb.c b/source3/lib/tdb/common/tdb.c index bf3abb71ac..fd4e1cc8af 100644 --- a/source3/lib/tdb/common/tdb.c +++ b/source3/lib/tdb/common/tdb.c @@ -715,6 +715,11 @@ int tdb_wipe_all(struct tdb_context *tdb) goto failed; } + if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, &offset) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write recovery head\n")); + goto failed; + } + /* add all the rest of the file to the freelist */ data_len = (tdb->map_size - TDB_DATA_START(tdb->header.hash_size)) - sizeof(struct list_struct); if (data_len > 0) { @@ -738,3 +743,45 @@ failed: tdb_unlockall(tdb); return -1; } + + +/* + validate the integrity of all tdb hash chains. Useful when debugging + */ +int tdb_validate(struct tdb_context *tdb) +{ + int h; + for (h=-1;h<(int)tdb->header.hash_size;h++) { + tdb_off_t rec_ptr; + uint32_t count = 0; + if (tdb_ofs_read(tdb, TDB_HASH_TOP(h), &rec_ptr) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed ofs_read at top of hash %d\n", h)); + return -1; + } + while (rec_ptr) { + struct list_struct r; + tdb_off_t size; + + if (tdb_rec_read(tdb, rec_ptr, &r) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed rec_read h=%d rec_ptr=%u count=%u\n", + h, rec_ptr, count)); + return -1; + } + if (tdb_ofs_read(tdb, rec_ptr + sizeof(r) + r.rec_len - sizeof(tdb_off_t), &size) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed ofs_read h=%d rec_ptr=%u count=%u\n", + h, rec_ptr, count)); + return -1; + } + if (size != r.rec_len + sizeof(r)) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed size check size=%u h=%d rec_ptr=%u count=%u\n", + size, h, rec_ptr, count)); + return -1; + } + rec_ptr = r.next; + count++; + } + } + return 0; +} + + diff --git a/source3/lib/tdb/common/transaction.c b/source3/lib/tdb/common/transaction.c index 2da09face0..0ecfb9b7ff 100644 --- a/source3/lib/tdb/common/transaction.c +++ b/source3/lib/tdb/common/transaction.c @@ -87,6 +87,7 @@ */ + /* hold the context of any current transaction */ @@ -280,6 +281,63 @@ fail: return -1; } + +/* + write while in a transaction - this varient never expands the transaction blocks, it only + updates existing blocks. This means it cannot change the recovery size +*/ +static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, + const void *buf, tdb_len_t len) +{ + uint32_t blk; + + /* break it up into block sized chunks */ + while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) { + tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size); + if (transaction_write_existing(tdb, off, buf, len2) != 0) { + return -1; + } + len -= len2; + off += len2; + if (buf != NULL) { + buf = (const void *)(len2 + (const char *)buf); + } + } + + if (len == 0) { + return 0; + } + + blk = off / tdb->transaction->block_size; + off = off % tdb->transaction->block_size; + + if (tdb->transaction->num_blocks <= blk || + tdb->transaction->blocks[blk] == NULL) { + return 0; + } + + /* overwrite part of an existing block */ + if (buf == NULL) { + memset(tdb->transaction->blocks[blk] + off, 0, len); + } else { + memcpy(tdb->transaction->blocks[blk] + off, buf, len); + } + if (blk == tdb->transaction->num_blocks-1) { + if (len + off > tdb->transaction->last_block_size) { + tdb->transaction->last_block_size = len + off; + } + } + + return 0; + +fail: + TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", + (blk*tdb->transaction->block_size) + off, len)); + tdb->transaction->transaction_error = 1; + return -1; +} + + /* accelerated hash chain head search, using the cached hash heads */ @@ -629,6 +687,10 @@ static int tdb_recovery_allocate(struct tdb_context *tdb, TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to write recovery head\n")); return -1; } + if (transaction_write_existing(tdb, TDB_RECOVERY_HEAD, &recovery_head, sizeof(tdb_off_t)) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to write recovery head\n")); + return -1; + } return 0; } @@ -726,6 +788,12 @@ static int transaction_setup_recovery(struct tdb_context *tdb, tdb->ecode = TDB_ERR_IO; return -1; } + if (transaction_write_existing(tdb, recovery_offset, data, sizeof(*rec) + recovery_size) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: failed to write secondary recovery data\n")); + free(data); + tdb->ecode = TDB_ERR_IO; + return -1; + } /* as we don't have ordered writes, we have to sync the recovery data before we update the magic to indicate that the recovery @@ -747,6 +815,11 @@ static int transaction_setup_recovery(struct tdb_context *tdb, tdb->ecode = TDB_ERR_IO; return -1; } + if (transaction_write_existing(tdb, *magic_offset, &magic, sizeof(magic)) == -1) { + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: failed to write secondary recovery magic\n")); + tdb->ecode = TDB_ERR_IO; + return -1; + } /* ensure the recovery magic marker is on disk */ if (transaction_sync(tdb, *magic_offset, sizeof(magic)) == -1) { @@ -778,6 +851,7 @@ int tdb_transaction_commit(struct tdb_context *tdb) return -1; } + if (tdb->transaction->nesting != 0) { tdb->transaction->nesting--; return 0; @@ -916,6 +990,7 @@ int tdb_transaction_commit(struct tdb_context *tdb) /* use a transaction cancel to free memory and remove the transaction locks */ tdb_transaction_cancel(tdb); + return 0; } diff --git a/source3/lib/tdb/include/tdb.h b/source3/lib/tdb/include/tdb.h index 0008085de5..daa2d43135 100644 --- a/source3/lib/tdb/include/tdb.h +++ b/source3/lib/tdb/include/tdb.h @@ -157,6 +157,7 @@ int tdb_printfreelist(struct tdb_context *tdb); int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); int tdb_wipe_all(struct tdb_context *tdb); int tdb_freelist_size(struct tdb_context *tdb); +int tdb_validate(struct tdb_context *tdb); extern TDB_DATA tdb_null; -- cgit From 63b1c765de439b295c73430be14f8656873bfad7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Jan 2008 16:26:52 +1100 Subject: samba3 already has tdb_validate() (This used to be commit 9f002eeff9bcf33a00e5641cb14338e866a17afe) --- source3/lib/tdb/common/tdb.c | 42 ------------------------------------------ source3/lib/tdb/include/tdb.h | 1 - 2 files changed, 43 deletions(-) diff --git a/source3/lib/tdb/common/tdb.c b/source3/lib/tdb/common/tdb.c index fd4e1cc8af..ea5d9ccc60 100644 --- a/source3/lib/tdb/common/tdb.c +++ b/source3/lib/tdb/common/tdb.c @@ -743,45 +743,3 @@ failed: tdb_unlockall(tdb); return -1; } - - -/* - validate the integrity of all tdb hash chains. Useful when debugging - */ -int tdb_validate(struct tdb_context *tdb) -{ - int h; - for (h=-1;h<(int)tdb->header.hash_size;h++) { - tdb_off_t rec_ptr; - uint32_t count = 0; - if (tdb_ofs_read(tdb, TDB_HASH_TOP(h), &rec_ptr) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed ofs_read at top of hash %d\n", h)); - return -1; - } - while (rec_ptr) { - struct list_struct r; - tdb_off_t size; - - if (tdb_rec_read(tdb, rec_ptr, &r) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed rec_read h=%d rec_ptr=%u count=%u\n", - h, rec_ptr, count)); - return -1; - } - if (tdb_ofs_read(tdb, rec_ptr + sizeof(r) + r.rec_len - sizeof(tdb_off_t), &size) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed ofs_read h=%d rec_ptr=%u count=%u\n", - h, rec_ptr, count)); - return -1; - } - if (size != r.rec_len + sizeof(r)) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed size check size=%u h=%d rec_ptr=%u count=%u\n", - size, h, rec_ptr, count)); - return -1; - } - rec_ptr = r.next; - count++; - } - } - return 0; -} - - diff --git a/source3/lib/tdb/include/tdb.h b/source3/lib/tdb/include/tdb.h index daa2d43135..0008085de5 100644 --- a/source3/lib/tdb/include/tdb.h +++ b/source3/lib/tdb/include/tdb.h @@ -157,7 +157,6 @@ int tdb_printfreelist(struct tdb_context *tdb); int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); int tdb_wipe_all(struct tdb_context *tdb); int tdb_freelist_size(struct tdb_context *tdb); -int tdb_validate(struct tdb_context *tdb); extern TDB_DATA tdb_null; -- cgit From e41fe768b60c90e11644222ec549b82429f2a6e6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 10:43:49 +0100 Subject: "make test_shlibs" shows unresolved symbols for -lwbclient. Guenther (This used to be commit 0093f618e91f7dcc69d57dbd09d23acc614999aa) --- source3/Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index f03bd1959e..9adf285e77 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -342,7 +342,8 @@ LIBWBCLIENT_OBJ = nsswitch/libwbclient/wbclient.o \ nsswitch/libwbclient/wbc_pwd.o \ nsswitch/libwbclient/wbc_idmap.o \ nsswitch/libwbclient/wbc_sid.o \ - nsswitch/libwbclient/wbc_pam.o + nsswitch/libwbclient/wbc_pam.o \ + $(SOCKET_WRAPPER_OBJ) LIBGPO_OBJ0 = libgpo/gpo_ldap.o libgpo/gpo_ini.o libgpo/gpo_util.o \ -- cgit From 43d7bb53ad5b74aa7737c32167c0fe5d62f5fe09 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 12:01:06 +0100 Subject: Revert ""make test_shlibs" shows unresolved symbols for -lwbclient." This reverts commit 0093f618e91f7dcc69d57dbd09d23acc614999aa. (This used to be commit ad6cb9afc9794b226e3453d36865edfe5a15f572) --- source3/Makefile.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 9adf285e77..f03bd1959e 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -342,8 +342,7 @@ LIBWBCLIENT_OBJ = nsswitch/libwbclient/wbclient.o \ nsswitch/libwbclient/wbc_pwd.o \ nsswitch/libwbclient/wbc_idmap.o \ nsswitch/libwbclient/wbc_sid.o \ - nsswitch/libwbclient/wbc_pam.o \ - $(SOCKET_WRAPPER_OBJ) + nsswitch/libwbclient/wbc_pam.o LIBGPO_OBJ0 = libgpo/gpo_ldap.o libgpo/gpo_ini.o libgpo/gpo_util.o \ -- cgit From ff256b4284f6a3f5e8babb9f2e2e430ff609b809 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 14 Jan 2008 14:57:30 +0100 Subject: Fix "make test_shlibs": it showed unresolved symbols for -lwbclient. Michael (This used to be commit 9a435b510f8ccfd0ca3b3d100d6176e643273578) --- source3/Makefile.in | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index f03bd1959e..c34f3283db 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -285,9 +285,12 @@ NSS_WRAPPER_OBJ = @NSS_WRAPPER_OBJS@ TALLOC_OBJ = lib/talloc/talloc.o -LIBSAMBAUTIL_OBJ = $(TALLOC_OBJ) $(LIBREPLACE_OBJ) +LIBSAMBAUTIL_OBJ = $(TALLOC_OBJ) \ + $(LIBREPLACE_OBJ) \ + $(SOCKET_WRAPPER_OBJ) \ + $(NSS_WRAPPER_OBJ) -LIB_WITHOUT_PROTO_OBJ = $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) $(NSS_WRAPPER_OBJ) $(TALLOC_OBJ) \ +LIB_WITHOUT_PROTO_OBJ = $(LIBSAMBAUTIL_OBJ) \ lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \ lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \ lib/interfaces.o lib/rbtree.o lib/memcache.o \ @@ -1393,9 +1396,9 @@ bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@ @POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \ $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@ -bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) nsswitch/wb_common.o lib/talloc/talloc.o +bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) nsswitch/wb_common.o $(LIBSAMBAUTIL_OBJ) @echo Linking shared library $@ - @$(SHLD_DSO) $(LIBWBCLIENT_OBJ) nsswitch/wb_common.o lib/talloc/talloc.o \ + @$(SHLD_DSO) $(LIBWBCLIENT_OBJ) nsswitch/wb_common.o $(LIBSAMBAUTIL_OBJ) \ @SONAMEFLAG@`basename $@`.$(SONAME_VER) @ln -s -f `basename $@` $@.$(SONAME_VER) -- cgit From 463fd6b3a86826c2fb12b66bc85faac8f1d0647a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 15:15:47 +0100 Subject: Use some more pidl generated LSA rpc in rpcclient. Guenther (This used to be commit 153e4dd162423a846dbd4a9a1be1fd747792bdbf) --- source3/rpcclient/cmd_lsarpc.c | 105 ++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 59 deletions(-) diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index d54f67264a..a6d065f503 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -893,25 +893,15 @@ static NTSTATUS cmd_lsa_query_secobj(struct rpc_pipe_client *cli, return result; } -static void display_trust_dom_info_1(TRUSTED_DOMAIN_INFO_NAME *n) -{ - printf("NetBIOS Name:\t%s\n", unistr2_static(&n->netbios_name.unistring)); -} - -static void display_trust_dom_info_3(TRUSTED_DOMAIN_INFO_POSIX_OFFSET *p) -{ - printf("Posix Offset:\t%08x (%d)\n", p->posix_offset, p->posix_offset); -} - -static void display_trust_dom_info_4(TRUSTED_DOMAIN_INFO_PASSWORD *p, const char *password) +static void display_trust_dom_info_4(struct lsa_TrustDomainInfoPassword *p, const char *password) { char *pwd, *pwd_old; - DATA_BLOB data = data_blob(NULL, p->password.length); - DATA_BLOB data_old = data_blob(NULL, p->old_password.length); + DATA_BLOB data = data_blob(NULL, p->password->length); + DATA_BLOB data_old = data_blob(NULL, p->old_password->length); - memcpy(data.data, p->password.data, p->password.length); - memcpy(data_old.data, p->old_password.data, p->old_password.length); + memcpy(data.data, p->password->data, p->password->length); + memcpy(data_old.data, p->old_password->data, p->old_password->length); pwd = decrypt_trustdom_secret(password, &data); pwd_old = decrypt_trustdom_secret(password, &data_old); @@ -926,36 +916,20 @@ static void display_trust_dom_info_4(TRUSTED_DOMAIN_INFO_PASSWORD *p, const char data_blob_free(&data_old); } -static void display_trust_dom_info_6(TRUSTED_DOMAIN_INFO_EX *i) -{ - printf("Domain Name:\t\t%s\n", unistr2_static(&i->domain_name.unistring)); - printf("NetBIOS Name:\t\t%s\n", unistr2_static(&i->netbios_name.unistring)); - printf("SID:\t\t\t%s\n", sid_string_tos(&i->sid.sid)); - printf("Trust Direction:\t0x%08x\n", i->trust_direction); - printf("Trust Type:\t\t0x%08x\n", i->trust_type); - printf("Trust Attributes:\t0x%08x\n", i->trust_attributes); -} - - -static void display_trust_dom_info(LSA_TRUSTED_DOMAIN_INFO *info, uint32 info_class, const char *pass) +static void display_trust_dom_info(union lsa_TrustedDomainInfo *info, + enum lsa_TrustDomInfoEnum info_class, + const char *pass) { switch (info_class) { - case 1: - display_trust_dom_info_1(&info->name); - break; - case 3: - display_trust_dom_info_3(&info->posix_offset); - break; - case 4: - display_trust_dom_info_4(&info->password, pass); - break; - case 6: - display_trust_dom_info_6(&info->info_ex); - break; - default: - printf("unsupported info-class: %d\n", info_class); - break; + case LSA_TRUSTED_DOMAIN_INFO_PASSWORD: + display_trust_dom_info_4(&info->password, pass); + break; + default: + NDR_PRINT_UNION_DEBUG(lsa_TrustedDomainInfo, + info_class, &info); + break; } + } static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli, @@ -966,9 +940,8 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli, NTSTATUS result = NT_STATUS_UNSUCCESSFUL; DOM_SID dom_sid; uint32 access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - LSA_TRUSTED_DOMAIN_INFO *info; - - uint32 info_class = 1; + union lsa_TrustedDomainInfo info; + enum lsa_TrustDomInfoEnum info_class = 1; if (argc > 3 || argc < 2) { printf("Usage: %s [sid] [info_class]\n", argv[0]); @@ -986,13 +959,15 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_lsa_query_trusted_domain_info_by_sid(cli, mem_ctx, &pol, - info_class, &dom_sid, &info); - + result = rpccli_lsa_QueryTrustedDomainInfoBySid(cli, mem_ctx, + &pol, + &dom_sid, + info_class, + &info); if (!NT_STATUS_IS_OK(result)) goto done; - display_trust_dom_info(info, info_class, cli->pwd.password); + display_trust_dom_info(&info, info_class, cli->pwd.password); done: if (&pol) @@ -1001,6 +976,11 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli, return result; } +static void init_lsa_String(struct lsa_String *name, const char *s) +{ + name->string = s; +} + static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) @@ -1008,8 +988,9 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli, POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; uint32 access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - LSA_TRUSTED_DOMAIN_INFO *info; - uint32 info_class = 1; + union lsa_TrustedDomainInfo info; + enum lsa_TrustDomInfoEnum info_class = 1; + struct lsa_String trusted_domain; if (argc > 3 || argc < 2) { printf("Usage: %s [name] [info_class]\n", argv[0]); @@ -1024,13 +1005,17 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_lsa_query_trusted_domain_info_by_name(cli, mem_ctx, &pol, - info_class, argv[1], &info); + init_lsa_String(&trusted_domain, argv[1]); + result = rpccli_lsa_QueryTrustedDomainInfoByName(cli, mem_ctx, + &pol, + trusted_domain, + info_class, + &info); if (!NT_STATUS_IS_OK(result)) goto done; - display_trust_dom_info(info, info_class, cli->pwd.password); + display_trust_dom_info(&info, info_class, cli->pwd.password); done: if (&pol) @@ -1046,9 +1031,9 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli, POLICY_HND pol, trustdom_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; uint32 access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - LSA_TRUSTED_DOMAIN_INFO *info; + union lsa_TrustedDomainInfo info; DOM_SID dom_sid; - uint32 info_class = 1; + enum lsa_TrustDomInfoEnum info_class = 1; if (argc > 3 || argc < 2) { printf("Usage: %s [sid] [info_class]\n", argv[0]); @@ -1073,13 +1058,15 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_lsa_query_trusted_domain_info(cli, mem_ctx, &trustdom_pol, - info_class, &info); + result = rpccli_lsa_QueryTrustedDomainInfo(cli, mem_ctx, + &trustdom_pol, + info_class, + &info); if (!NT_STATUS_IS_OK(result)) goto done; - display_trust_dom_info(info, info_class, cli->pwd.password); + display_trust_dom_info(&info, info_class, cli->pwd.password); done: if (&pol) -- cgit From c9394414114d4b0a7f2cbf586eb6f30ed9ed9fca Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 15:19:30 +0100 Subject: Start removing hand-written lsa marshalling code (namely rpccli_lsa_open_trusted_domain_by_name, rpccli_lsa_query_trusted_domain_info_by_sid and rpccli_lsa_query_trusted_domain_info_by_name). Guenther (This used to be commit f2fb3473455f20e7314a9d33f5a1c923d3057d97) --- source3/include/rpc_lsa.h | 38 ---------- source3/rpc_client/cli_lsarpc.c | 111 ---------------------------- source3/rpc_parse/parse_lsa.c | 158 ---------------------------------------- 3 files changed, 307 deletions(-) diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index 9f90b53ffa..beb12c2df5 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -988,25 +988,6 @@ typedef struct { /*******************************************************/ -/* LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME - LSA Query Open Trusted Domain by Name*/ -typedef struct lsa_q_open_trusted_domain_by_name -{ - POLICY_HND pol; /* policy handle */ - LSA_STRING name; /* domain name */ - uint32 access_mask; /* access mask */ - -} LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME; - -/* LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME - response to LSA Query Open Trusted Domain by Name */ -typedef struct { - POLICY_HND handle; /* trustdom policy handle */ - NTSTATUS status; /* return code */ -} LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME; - - -/*******************************************************/ - - typedef struct { POLICY_HND handle; UNISTR4 secretname; @@ -1086,24 +1067,6 @@ typedef struct lsa_query_trusted_domain_info } LSA_Q_QUERY_TRUSTED_DOMAIN_INFO; -/* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID - LSA query trusted domain info */ -typedef struct lsa_query_trusted_domain_info_by_sid -{ - POLICY_HND pol; /* policy handle */ - DOM_SID2 dom_sid; /* domain sid */ - uint16 info_class; /* info class */ - -} LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID; - -/* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME - LSA query trusted domain info */ -typedef struct lsa_query_trusted_domain_info_by_name -{ - POLICY_HND pol; /* policy handle */ - LSA_STRING domain_name; /* domain name */ - uint16 info_class; /* info class */ - -} LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME; - typedef struct trusted_domain_info_name { LSA_STRING netbios_name; } TRUSTED_DOMAIN_INFO_NAME; @@ -1125,7 +1088,6 @@ typedef struct lsa_data_buf_hdr { uint32 data_ptr; } LSA_DATA_BUF_HDR; - typedef struct lsa_data_buf2 { uint32 size; uint8 *data; diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 6abc67fc35..70123ebcc6 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -1541,117 +1541,6 @@ done: return result; } -NTSTATUS rpccli_lsa_open_trusted_domain_by_name(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, const char *name, uint32 access_mask, - POLICY_HND *trustdom_pol) -{ - prs_struct qbuf, rbuf; - LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME q; - LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME r; - NTSTATUS result; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialise input parameters */ - - init_lsa_q_open_trusted_domain_by_name(&q, pol, name, access_mask); - - /* Marshall data and send request */ - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_OPENTRUSTDOMBYNAME, - q, r, - qbuf, rbuf, - lsa_io_q_open_trusted_domain_by_name, - lsa_io_r_open_trusted_domain_by_name, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (NT_STATUS_IS_OK(result)) { - *trustdom_pol = r.handle; - } - - return result; -} - - -NTSTATUS rpccli_lsa_query_trusted_domain_info_by_sid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, - uint16 info_class, DOM_SID *dom_sid, - LSA_TRUSTED_DOMAIN_INFO **info) -{ - prs_struct qbuf, rbuf; - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID q; - LSA_R_QUERY_TRUSTED_DOMAIN_INFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_q_query_trusted_domain_info_by_sid(&q, pol, info_class, dom_sid); - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYTRUSTDOMINFOBYSID, - q, r, - qbuf, rbuf, - lsa_io_q_query_trusted_domain_info_by_sid, - lsa_io_r_query_trusted_domain_info, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - - if (!NT_STATUS_IS_OK(result)) { - goto done; - } - - *info = r.info; - -done: - - return result; -} - -NTSTATUS rpccli_lsa_query_trusted_domain_info_by_name(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, - uint16 info_class, const char *domain_name, - LSA_TRUSTED_DOMAIN_INFO **info) -{ - prs_struct qbuf, rbuf; - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME q; - LSA_R_QUERY_TRUSTED_DOMAIN_INFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_q_query_trusted_domain_info_by_name(&q, pol, info_class, domain_name); - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYTRUSTDOMINFOBYNAME, - q, r, - qbuf, rbuf, - lsa_io_q_query_trusted_domain_info_by_name, - lsa_io_r_query_trusted_domain_info, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - - if (!NT_STATUS_IS_OK(result)) { - goto done; - } - - *info = r.info; - -done: - - return result; -} - NTSTATUS cli_lsa_query_domain_info_policy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, POLICY_HND *pol, uint16 info_class, LSA_DOM_INFO_UNION **info) diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 59fce4a904..4b087b7ca1 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3410,76 +3410,6 @@ bool lsa_io_q_open_trusted_domain(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN *i #endif -/******************************************************************* - Inits an LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME structure. -********************************************************************/ - -void init_lsa_q_open_trusted_domain_by_name(LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q, - POLICY_HND *hnd, - const char *name, - uint32 desired_access) -{ - memcpy(&q->pol, hnd, sizeof(q->pol)); - - init_lsa_string(&q->name, name); - q->access_mask = desired_access; -} - -/******************************************************************* -********************************************************************/ - - -/******************************************************************* - Reads or writes an LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME structure. -********************************************************************/ - -bool lsa_io_q_open_trusted_domain_by_name(const char *desc, LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME *q_o, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_open_trusted_domain_by_name"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_o->pol, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_lsa_string("name", &q_o->name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("access", ps, depth, &q_o->access_mask)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME structure. -********************************************************************/ - -bool lsa_io_r_open_trusted_domain_by_name(const char *desc, LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_open_trusted_domain_by_name"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!smb_io_pol_hnd("handle", &out->handle, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - /******************************************************************* ********************************************************************/ @@ -3719,36 +3649,6 @@ void init_q_query_trusted_domain_info(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q, q->info_class = info_class; } -/******************************************************************* - Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME structure. -********************************************************************/ - -void init_q_query_trusted_domain_info_by_name(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q, - POLICY_HND *hnd, uint16 info_class, - const char *dom_name) -{ - DEBUG(5, ("init_q_query_trusted_domain_info_by_name\n")); - - q->pol = *hnd; - init_lsa_string(&q->domain_name, dom_name ); - q->info_class = info_class; -} - -/******************************************************************* - Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID structure. -********************************************************************/ - -void init_q_query_trusted_domain_info_by_sid(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q, - POLICY_HND *hnd, uint16 info_class, - DOM_SID *dom_sid) -{ - DEBUG(5, ("init_q_query_trusted_domain_info_by_sid\n")); - - q->pol = *hnd; - init_dom_sid2(&q->dom_sid, dom_sid); - q->info_class = info_class; -} - /******************************************************************* Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. ********************************************************************/ @@ -3773,64 +3673,6 @@ bool lsa_io_q_query_trusted_domain_info(const char *desc, } -/******************************************************************* - Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID structure. -********************************************************************/ - -bool lsa_io_q_query_trusted_domain_info_by_sid(const char *desc, - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID *q_q, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_sid"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_dom_sid2("dom_sid", &q_q->dom_sid, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME structure. -********************************************************************/ - -bool lsa_io_q_query_trusted_domain_info_by_name(const char *desc, - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME *q_q, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info_by_name"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_lsa_string("domain_name", &q_q->domain_name, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) - return False; - - return True; -} - /******************************************************************* ********************************************************************/ -- cgit From 08946cc54669e63306ca7f388930f2020a982fcd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 15:27:57 +0100 Subject: Remove some more hand written LSA rpc. (rpccli_lsa_open_trusted_domain, rpccli_lsa_query_trusted_domain_info, cli_lsa_query_domain_info_policy). Guenther (This used to be commit 5bfb33f1c5a16d10f77cb76962df4a949626a062) --- source3/rpc_client/cli_lsarpc.c | 108 ---------------------------------------- source3/rpcclient/cmd_lsarpc.c | 9 ++-- 2 files changed, 6 insertions(+), 111 deletions(-) diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 70123ebcc6..a023fe75ef 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -1468,111 +1468,3 @@ Error was : %s.\n", remote_machine, cli_errstr(&cli) )); } #endif - -NTSTATUS rpccli_lsa_open_trusted_domain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, DOM_SID *dom_sid, uint32 access_mask, - POLICY_HND *trustdom_pol) -{ - prs_struct qbuf, rbuf; - LSA_Q_OPEN_TRUSTED_DOMAIN q; - LSA_R_OPEN_TRUSTED_DOMAIN r; - NTSTATUS result; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialise input parameters */ - - init_lsa_q_open_trusted_domain(&q, pol, dom_sid, access_mask); - - /* Marshall data and send request */ - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_OPENTRUSTDOM, - q, r, - qbuf, rbuf, - lsa_io_q_open_trusted_domain, - lsa_io_r_open_trusted_domain, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (NT_STATUS_IS_OK(result)) { - *trustdom_pol = r.handle; - } - - return result; -} - -NTSTATUS rpccli_lsa_query_trusted_domain_info(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, - uint16 info_class, - LSA_TRUSTED_DOMAIN_INFO **info) -{ - prs_struct qbuf, rbuf; - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO q; - LSA_R_QUERY_TRUSTED_DOMAIN_INFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_q_query_trusted_domain_info(&q, pol, info_class); - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYTRUSTDOMINFO, - q, r, - qbuf, rbuf, - lsa_io_q_query_trusted_domain_info, - lsa_io_r_query_trusted_domain_info, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - - if (!NT_STATUS_IS_OK(result)) { - goto done; - } - - *info = r.info; - -done: - return result; -} - -NTSTATUS cli_lsa_query_domain_info_policy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, - uint16 info_class, LSA_DOM_INFO_UNION **info) -{ - prs_struct qbuf, rbuf; - LSA_Q_QUERY_DOM_INFO_POLICY q; - LSA_R_QUERY_DOM_INFO_POLICY r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_q_query_dom_info(&q, pol, info_class); - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYDOMINFOPOL, - q, r, - qbuf, rbuf, - lsa_io_q_query_dom_info, - lsa_io_r_query_dom_info, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - - if (!NT_STATUS_IS_OK(result)) { - goto done; - } - - *info = r.info; - -done: - return result; -} - diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index a6d065f503..2e48c3fa74 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -1051,9 +1051,12 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - - result = rpccli_lsa_open_trusted_domain(cli, mem_ctx, &pol, - &dom_sid, access_mask, &trustdom_pol); + + result = rpccli_lsa_OpenTrustedDomain(cli, mem_ctx, + &pol, + &dom_sid, + access_mask, + &trustdom_pol); if (!NT_STATUS_IS_OK(result)) goto done; -- cgit From cb1a0905779a9e4be2894f14a62bc7f950e2140b Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 15:33:26 +0100 Subject: Use pidl generated rpccli_lsa_QueryTrustedDomainInfoBySid when vampiring trusted domain secrets. Guenther (This used to be commit aa3de6f9f5b5375ca9f1e8a60a378afba1c0848b) --- source3/utils/net_rpc.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 155cda64df..2bd867fff3 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -5850,24 +5850,30 @@ static NTSTATUS vampire_trusted_domain(struct rpc_pipe_client *pipe_hnd, const char *trusted_dom_name) { NTSTATUS nt_status; - LSA_TRUSTED_DOMAIN_INFO *info; + union lsa_TrustedDomainInfo info; char *cleartextpwd = NULL; DATA_BLOB data; - nt_status = rpccli_lsa_query_trusted_domain_info_by_sid(pipe_hnd, mem_ctx, pol, 4, &dom_sid, &info); - + nt_status = rpccli_lsa_QueryTrustedDomainInfoBySid(pipe_hnd, mem_ctx, + pol, + &dom_sid, + LSA_TRUSTED_DOMAIN_INFO_PASSWORD, + &info); if (NT_STATUS_IS_ERR(nt_status)) { DEBUG(0,("Could not query trusted domain info. Error was %s\n", nt_errstr(nt_status))); goto done; } - data = data_blob(NULL, info->password.password.length); + data = data_blob(NULL, info.password.password->length); - memcpy(data.data, info->password.password.data, info->password.password.length); - data.length = info->password.password.length; - - cleartextpwd = decrypt_trustdom_secret(pipe_hnd->cli->pwd.password, &data); + memcpy(data.data, + info.password.password->data, + info.password.password->length); + data.length = info.password.password->length; + + cleartextpwd = decrypt_trustdom_secret(pipe_hnd->cli->pwd.password, + &data); if (cleartextpwd == NULL) { DEBUG(0,("retrieved NULL password\n")); -- cgit From c6f2bbb59f9585bddfe1f3c23452aa61346e7e39 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 15:39:51 +0100 Subject: Fix rpcclient display_trust_dom_info(). Guenther (This used to be commit 54bdd22a07e885f896a8f784bc12096f65afac75) --- source3/rpcclient/cmd_lsarpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index 2e48c3fa74..7743269ce0 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -926,7 +926,7 @@ static void display_trust_dom_info(union lsa_TrustedDomainInfo *info, break; default: NDR_PRINT_UNION_DEBUG(lsa_TrustedDomainInfo, - info_class, &info); + info_class, info); break; } -- cgit From f326cd2be51f2d83de4f5fcb656a9ffc9073d987 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 14 Jan 2008 15:44:41 +0100 Subject: Fix bug #5171 (perl syntax error) found by Jason Filley Michael (This used to be commit dcb5034acd35d219106e1d855f4c4d36b3c8d83b) --- examples/logon/genlogon/genlogon.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/logon/genlogon/genlogon.pl b/examples/logon/genlogon/genlogon.pl index 8ebf392141..4799ac8452 100644 --- a/examples/logon/genlogon/genlogon.pl +++ b/examples/logon/genlogon/genlogon.pl @@ -45,7 +45,7 @@ if ($ARGV[1] eq "SUPPORT" || $ARGV[0] eq "support") } # Connect shares just used by Administration staff -If ($ARGV[1] eq "ADMIN" || $ARGV[0] eq "admin") +if ($ARGV[1] eq "ADMIN" || $ARGV[0] eq "admin") { print LOGON "NET USE L: \\\\$ARGV[2]\\ADMIN\r\n"; print LOGON "NET USE K: \\\\$ARGV[2]\\MKTING\r\n"; -- cgit From 351377a90e44d8011a697779d2e9e225427e5cbb Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 15:47:42 +0100 Subject: Remove more redundant lsa parsing functions. Guenther (This used to be commit 99dd28da84c270f46535bd2ffa6bfef96d2e2eed) --- source3/include/rpc_lsa.h | 115 ------------------- source3/rpc_parse/parse_lsa.c | 257 ------------------------------------------ 2 files changed, 372 deletions(-) diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index beb12c2df5..22436c59b2 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -1059,121 +1059,6 @@ typedef struct { NTSTATUS status; } LSA_R_SET_SECRET; -/* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO - LSA query trusted domain info */ -typedef struct lsa_query_trusted_domain_info -{ - POLICY_HND pol; /* policy handle */ - uint16 info_class; /* info class */ - -} LSA_Q_QUERY_TRUSTED_DOMAIN_INFO; - -typedef struct trusted_domain_info_name { - LSA_STRING netbios_name; -} TRUSTED_DOMAIN_INFO_NAME; - -typedef struct trusted_domain_info_posix_offset { - uint32 posix_offset; -} TRUSTED_DOMAIN_INFO_POSIX_OFFSET; - -typedef struct lsa_data_buf { - uint32 size; - uint32 offset; - uint32 length; - uint8 *data; -} LSA_DATA_BUF; - -typedef struct lsa_data_buf_hdr { - uint32 length; - uint32 size; - uint32 data_ptr; -} LSA_DATA_BUF_HDR; - -typedef struct lsa_data_buf2 { - uint32 size; - uint8 *data; -} LSA_DATA_BUF2; - -typedef struct trusted_domain_info_password { - uint32 ptr_password; - uint32 ptr_old_password; - LSA_DATA_BUF_HDR password_hdr; - LSA_DATA_BUF_HDR old_password_hdr; - LSA_DATA_BUF password; - LSA_DATA_BUF old_password; -} TRUSTED_DOMAIN_INFO_PASSWORD; - -typedef struct trusted_domain_info_basic { - LSA_STRING netbios_name; - DOM_SID2 sid; -} TRUSTED_DOMAIN_INFO_BASIC; - -typedef struct trusted_domain_info_ex { - LSA_STRING domain_name; - LSA_STRING netbios_name; - DOM_SID2 sid; - uint32 trust_direction; - uint32 trust_type; - uint32 trust_attributes; -} TRUSTED_DOMAIN_INFO_EX; - -typedef struct trust_domain_info_buffer { - NTTIME last_update_time; - uint32 secret_type; - LSA_DATA_BUF2 data; -} LSA_TRUSTED_DOMAIN_INFO_BUFFER; - -typedef struct trusted_domain_info_auth_info { - uint32 incoming_count; - LSA_TRUSTED_DOMAIN_INFO_BUFFER incoming_current_auth_info; - LSA_TRUSTED_DOMAIN_INFO_BUFFER incoming_previous_auth_info; - uint32 outgoing_count; - LSA_TRUSTED_DOMAIN_INFO_BUFFER outgoing_current_auth_info; - LSA_TRUSTED_DOMAIN_INFO_BUFFER outgoing_previous_auth_info; -} TRUSTED_DOMAIN_INFO_AUTH_INFO; - -typedef struct trusted_domain_info_full_info { - TRUSTED_DOMAIN_INFO_EX info_ex; - TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset; - TRUSTED_DOMAIN_INFO_AUTH_INFO auth_info; -} TRUSTED_DOMAIN_INFO_FULL_INFO; - -typedef struct trusted_domain_info_11 { - TRUSTED_DOMAIN_INFO_EX info_ex; - LSA_DATA_BUF2 data1; -} TRUSTED_DOMAIN_INFO_11; - -typedef struct trusted_domain_info_all { - TRUSTED_DOMAIN_INFO_EX info_ex; - LSA_DATA_BUF2 data1; - TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset; - TRUSTED_DOMAIN_INFO_AUTH_INFO auth_info; -} TRUSTED_DOMAIN_INFO_ALL; - -/* LSA_TRUSTED_DOMAIN_INFO */ -typedef union lsa_trusted_domain_info -{ - uint16 info_class; - TRUSTED_DOMAIN_INFO_NAME name; - /* deprecated - gd - TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO controllers; */ - TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset; - TRUSTED_DOMAIN_INFO_PASSWORD password; - TRUSTED_DOMAIN_INFO_BASIC basic; - TRUSTED_DOMAIN_INFO_EX info_ex; - TRUSTED_DOMAIN_INFO_AUTH_INFO auth_info; - TRUSTED_DOMAIN_INFO_FULL_INFO full_info; - TRUSTED_DOMAIN_INFO_11 info11; - TRUSTED_DOMAIN_INFO_ALL info_all; - -} LSA_TRUSTED_DOMAIN_INFO; - -/* LSA_R_QUERY_TRUSTED_DOMAIN_INFO - LSA query trusted domain info */ -typedef struct r_lsa_query_trusted_domain_info -{ - LSA_TRUSTED_DOMAIN_INFO *info; - NTSTATUS status; -} LSA_R_QUERY_TRUSTED_DOMAIN_INFO; - typedef struct dom_info_kerberos { uint32 enforce_restrictions; NTTIME service_tkt_lifetime; diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 4b087b7ca1..e4d5d15112 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3636,263 +3636,6 @@ bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_stru return True; } -/******************************************************************* - Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. -********************************************************************/ - -void init_q_query_trusted_domain_info(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q, - POLICY_HND *hnd, uint16 info_class) -{ - DEBUG(5, ("init_q_query_trusted_domain_info\n")); - - q->pol = *hnd; - q->info_class = info_class; -} - -/******************************************************************* - Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. -********************************************************************/ - -bool lsa_io_q_query_trusted_domain_info(const char *desc, - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q_q, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) - return False; - - return True; -} - - -/******************************************************************* -********************************************************************/ - -static bool smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_lsa_data_buf_hdr"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("length", ps, depth, &buf_hdr->length)) - return False; - - if(!prs_uint32("size", ps, depth, &buf_hdr->size)) - return False; - - if (!prs_uint32("data_ptr", ps, depth, &buf_hdr->data_ptr)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, - prs_struct *ps, int depth, int length, int size) -{ - prs_debug(ps, depth, desc, "smb_io_lsa_data_buf"); - depth++; - - if ( UNMARSHALLING(ps) && length ) { - if ( !(buf->data = PRS_ALLOC_MEM( ps, uint8, length )) ) - return False; - } - - if (!prs_uint32("size", ps, depth, &buf->size)) - return False; - - if (!prs_uint32("offset", ps, depth, &buf->offset)) - return False; - - if (!prs_uint32("length", ps, depth, &buf->length)) - return False; - - if(!prs_uint8s(False, "data", ps, depth, buf->data, length)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME *name, - prs_struct *ps, int depth) -{ - if (!smb_io_lsa_string("netbios_name", &name->netbios_name, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_OFFSET *posix, - prs_struct *ps, int depth) -{ - if(!prs_uint32("posix_offset", ps, depth, &posix->posix_offset)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWORD *password, - prs_struct *ps, int depth) -{ - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_password", ps, depth, &password->ptr_password)) - return False; - - if(!prs_uint32("ptr_old_password", ps, depth, &password->ptr_old_password)) - return False; - - if (&password->ptr_password) { - - if (!smb_io_lsa_data_buf_hdr("password_hdr", &password->password_hdr, ps, depth)) - return False; - - if (!smb_io_lsa_data_buf("password", &password->password, ps, depth, - password->password_hdr.length, password->password_hdr.size)) - return False; - } - - if (&password->ptr_old_password) { - - if (!smb_io_lsa_data_buf_hdr("old_password_hdr", &password->old_password_hdr, ps, depth)) - return False; - - if (!smb_io_lsa_data_buf("old_password", &password->old_password, ps, depth, - password->old_password_hdr.length, password->old_password_hdr.size)) - return False; - } - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *info_ex, - prs_struct *ps, int depth) -{ - uint32 dom_sid_ptr; - - if (!smb_io_unihdr("domain_name_hdr", &info_ex->domain_name.hdr, ps, depth)) - return False; - - if (!smb_io_unihdr("netbios_name_hdr", &info_ex->netbios_name.hdr, ps, depth)) - return False; - - if (!prs_uint32("dom_sid_ptr", ps, depth, &dom_sid_ptr)) - return False; - - if (!prs_uint32("trust_direction", ps, depth, &info_ex->trust_direction)) - return False; - - if (!prs_uint32("trust_type", ps, depth, &info_ex->trust_type)) - return False; - - if (!prs_uint32("trust_attributes", ps, depth, &info_ex->trust_attributes)) - return False; - - if (!smb_io_unistr2("domain_name_unistring", &info_ex->domain_name.unistring, info_ex->domain_name.hdr.buffer, ps, depth)) - return False; - - if (!smb_io_unistr2("netbios_name_unistring", &info_ex->netbios_name.unistring, info_ex->netbios_name.hdr.buffer, ps, depth)) - return False; - - if (!smb_io_dom_sid2("sid", &info_ex->sid, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info) -{ - prs_debug(ps, depth, desc, "lsa_io_trustdom_query"); - depth++; - - if(!prs_uint16("info_class", ps, depth, &info->info_class)) - return False; - - if(!prs_align(ps)) - return False; - - switch (info->info_class) { - case 1: - if(!lsa_io_trustdom_query_1("name", &info->name, ps, depth)) - return False; - break; - case 3: - if(!lsa_io_trustdom_query_3("posix_offset", &info->posix_offset, ps, depth)) - return False; - break; - case 4: - if(!lsa_io_trustdom_query_4("password", &info->password, ps, depth)) - return False; - break; - case 6: - if(!lsa_io_trustdom_query_6("info_ex", &info->info_ex, ps, depth)) - return False; - break; - default: - DEBUG(0,("unsupported info-level: %d\n", info->info_class)); - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_QUERY_TRUSTED_DOMAIN_INFO structure. -********************************************************************/ - -bool lsa_io_r_query_trusted_domain_info(const char *desc, - LSA_R_QUERY_TRUSTED_DOMAIN_INFO *r_q, - prs_struct *ps, int depth) -{ - if (r_q == NULL) - return False; - - prs_debug(ps, depth, desc, "lsa_io_r_query_trusted_domain_info"); - depth++; - - if (!prs_pointer("trustdom", ps, depth, (void*)&r_q->info, - sizeof(LSA_TRUSTED_DOMAIN_INFO), - (PRS_POINTER_CAST)lsa_io_trustdom_query) ) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_q->status)) - return False; - - return True; -} - /******************************************************************* Inits an LSA_Q_QUERY_DOM_INFO_POLICY structure. ********************************************************************/ -- cgit From aa9335491fc2a514572b78aa3726f1c3af116252 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 17:10:31 +0100 Subject: Fill in IDL for lsa_SetInfoPolicy and lsa_SetInfoPolicy2. Guenther (This used to be commit dceb9a4c80fb241e12fafc6229aa8e81f5d2df1a) --- source3/librpc/idl/lsa.idl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source3/librpc/idl/lsa.idl b/source3/librpc/idl/lsa.idl index 6cf57b88d4..a7e04dc962 100644 --- a/source3/librpc/idl/lsa.idl +++ b/source3/librpc/idl/lsa.idl @@ -239,7 +239,11 @@ import "security.idl"; /******************/ /* Function: 0x08 */ - NTSTATUS lsa_SetInfoPolicy (); + NTSTATUS lsa_SetInfoPolicy ( + [in] policy_handle *handle, + [in] uint16 level, + [in,switch_is(level)] lsa_PolicyInformation *info + ); /******************/ /* Function: 0x09 */ @@ -710,7 +714,11 @@ import "security.idl"; ); /* Function 0x2f */ - NTSTATUS lsa_SetInfoPolicy2(); + NTSTATUS lsa_SetInfoPolicy2( + [in] policy_handle *handle, + [in] uint16 level, + [in,switch_is(level)] lsa_PolicyInformation *info + ); /**********************/ /* Function 0x30 */ -- cgit From 003694b4a7b9844c2b210c3b40efb57dd8d96c0e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 17:13:17 +0100 Subject: Re-run make idl for new lsa calls. Guenther (This used to be commit add28753b2e740804c48db5f6235cb2f8908d82b) --- source3/librpc/gen_ndr/cli_lsa.c | 16 +++++++-- source3/librpc/gen_ndr/lsa.h | 12 +++++++ source3/librpc/gen_ndr/ndr_lsa.c | 76 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 2 deletions(-) diff --git a/source3/librpc/gen_ndr/cli_lsa.c b/source3/librpc/gen_ndr/cli_lsa.c index 470ab3e0a5..4d81833fa1 100644 --- a/source3/librpc/gen_ndr/cli_lsa.c +++ b/source3/librpc/gen_ndr/cli_lsa.c @@ -341,12 +341,18 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, } NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx) + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_PolicyInformation *info) { struct lsa_SetInfoPolicy r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; + r.in.level = level; + r.in.info = info; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy, &r); @@ -2031,12 +2037,18 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, } NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx) + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_PolicyInformation *info) { struct lsa_SetInfoPolicy2 r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; + r.in.level = level; + r.in.info = info; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(lsa_SetInfoPolicy2, &r); diff --git a/source3/librpc/gen_ndr/lsa.h b/source3/librpc/gen_ndr/lsa.h index 6c081562da..066d5682fb 100644 --- a/source3/librpc/gen_ndr/lsa.h +++ b/source3/librpc/gen_ndr/lsa.h @@ -566,6 +566,12 @@ struct lsa_QueryInfoPolicy { struct lsa_SetInfoPolicy { + struct { + struct policy_handle *handle;/* [ref] */ + uint16_t level; + union lsa_PolicyInformation *info;/* [ref,switch_is(level)] */ + } in; + struct { NTSTATUS result; } out; @@ -1078,6 +1084,12 @@ struct lsa_QueryInfoPolicy2 { struct lsa_SetInfoPolicy2 { + struct { + struct policy_handle *handle;/* [ref] */ + uint16_t level; + union lsa_PolicyInformation *info;/* [ref,switch_is(level)] */ + } in; + struct { NTSTATUS result; } out; diff --git a/source3/librpc/gen_ndr/ndr_lsa.c b/source3/librpc/gen_ndr/ndr_lsa.c index ec22c9be38..57810bcb28 100644 --- a/source3/librpc/gen_ndr/ndr_lsa.c +++ b/source3/librpc/gen_ndr/ndr_lsa.c @@ -4602,6 +4602,16 @@ _PUBLIC_ void ndr_print_lsa_QueryInfoPolicy(struct ndr_print *ndr, const char *n static enum ndr_err_code ndr_push_lsa_SetInfoPolicy(struct ndr_push *ndr, int flags, const struct lsa_SetInfoPolicy *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + if (r->in.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_push_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); @@ -4611,7 +4621,25 @@ static enum ndr_err_code ndr_push_lsa_SetInfoPolicy(struct ndr_push *ndr, int fl static enum ndr_err_code ndr_pull_lsa_SetInfoPolicy(struct ndr_pull *ndr, int flags, struct lsa_SetInfoPolicy *r) { + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_info_0; if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_pull_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); @@ -4629,6 +4657,16 @@ _PUBLIC_ void ndr_print_lsa_SetInfoPolicy(struct ndr_print *ndr, const char *nam if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "lsa_SetInfoPolicy"); ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_ptr(ndr, "info", r->in.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->in.info, r->in.level); + ndr_print_lsa_PolicyInformation(ndr, "info", r->in.info); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { @@ -8124,6 +8162,16 @@ _PUBLIC_ void ndr_print_lsa_QueryInfoPolicy2(struct ndr_print *ndr, const char * static enum ndr_err_code ndr_push_lsa_SetInfoPolicy2(struct ndr_push *ndr, int flags, const struct lsa_SetInfoPolicy2 *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + if (r->in.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_push_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); @@ -8133,7 +8181,25 @@ static enum ndr_err_code ndr_push_lsa_SetInfoPolicy2(struct ndr_push *ndr, int f static enum ndr_err_code ndr_pull_lsa_SetInfoPolicy2(struct ndr_pull *ndr, int flags, struct lsa_SetInfoPolicy2 *r) { + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_info_0; if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_pull_lsa_PolicyInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); @@ -8151,6 +8217,16 @@ _PUBLIC_ void ndr_print_lsa_SetInfoPolicy2(struct ndr_print *ndr, const char *na if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "lsa_SetInfoPolicy2"); ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_ptr(ndr, "info", r->in.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->in.info, r->in.level); + ndr_print_lsa_PolicyInformation(ndr, "info", r->in.info); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { -- cgit From 862e1685b8b4f0ec76b5f715d39781e0fd8fa4f0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 17:16:06 +0100 Subject: Remove old lsa set info policy call. Guenther (This used to be commit b37b2b77edec72fc3f53b3461aa1c210e4366c1b) --- source3/include/rpc_lsa.h | 16 ------------ source3/rpc_client/cli_lsarpc.c | 35 ------------------------- source3/rpc_parse/parse_lsa.c | 58 ----------------------------------------- 3 files changed, 109 deletions(-) diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index 22436c59b2..ef6ff6db28 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -334,22 +334,6 @@ typedef struct lsa_info_ctr typedef LSA_INFO_CTR LSA_INFO_CTR2; -/* LSA_Q_SET_INFO - LSA set info policy */ -typedef struct lsa_set_info -{ - POLICY_HND pol; /* policy handle */ - uint16 info_class; /* info class */ - LSA_INFO_CTR ctr; - -} LSA_Q_SET_INFO; - -/* LSA_R_SET_INFO - response to LSA set info policy */ -typedef struct lsa_r_set_info -{ - NTSTATUS status; /* return code */ - -} LSA_R_SET_INFO; - /* LSA_R_QUERY_INFO - response to LSA query info policy */ typedef struct lsa_r_query_info { diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index a023fe75ef..77ade5cba1 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -716,41 +716,6 @@ NTSTATUS rpccli_lsa_query_info_policy2(struct rpc_pipe_client *cli, return result; } -NTSTATUS rpccli_lsa_set_info_policy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint16 info_class, - LSA_INFO_CTR ctr) -{ - prs_struct qbuf, rbuf; - LSA_Q_SET_INFO q; - LSA_R_SET_INFO r; - NTSTATUS result; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - init_q_set(&q, pol, info_class, ctr); - - CLI_DO_RPC(cli, mem_ctx, PI_LSARPC, LSA_SETINFOPOLICY, - q, r, - qbuf, rbuf, - lsa_io_q_set, - lsa_io_r_set, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - - if (!NT_STATUS_IS_OK(result)) { - goto done; - } - - /* Return output parameters */ - - done: - - return result; -} - - /** * Enumerate list of trusted domains * diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index e4d5d15112..98c4283347 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -909,21 +909,6 @@ bool lsa_io_dom_query_12(const char *desc, DOM_QUERY_12 *info, prs_struct *ps, i } -/******************************************************************* - Inits an LSA_Q_QUERY_INFO structure. -********************************************************************/ - -void init_q_set(LSA_Q_SET_INFO *in, POLICY_HND *hnd, uint16 info_class, LSA_INFO_CTR ctr) -{ - DEBUG(5,("init_q_set\n")); - - in->info_class = info_class; - - in->pol = *hnd; - - in->ctr = ctr; - in->ctr.info_class = info_class; -} /******************************************************************* reads or writes a structure. @@ -1064,49 +1049,6 @@ bool lsa_io_r_query(const char *desc, LSA_R_QUERY_INFO *out, prs_struct *ps, int return True; } -/******************************************************************* - Reads or writes an LSA_Q_SET_INFO structure. -********************************************************************/ - -bool lsa_io_q_set(const char *desc, LSA_Q_SET_INFO *in, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_set"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &in->pol, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &in->info_class)) - return False; - - if(!lsa_io_query_info_ctr("", ps, depth, &in->ctr)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_SET_INFO structure. -********************************************************************/ - -bool lsa_io_r_set(const char *desc, LSA_R_SET_INFO *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_set"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - /******************************************************************* Inits a LSA_SID_ENUM structure. ********************************************************************/ -- cgit From 495c38e5463559505500ac1106c27481ad0036e0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 17:16:31 +0100 Subject: Fix prototypes for lsa set info policy calls. Guenther (This used to be commit 33f6eff92b6bdf804d54c84375cece8a867933f2) --- source3/librpc/gen_ndr/cli_lsa.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source3/librpc/gen_ndr/cli_lsa.h b/source3/librpc/gen_ndr/cli_lsa.h index ad5e60d591..59c0b9293d 100644 --- a/source3/librpc/gen_ndr/cli_lsa.h +++ b/source3/librpc/gen_ndr/cli_lsa.h @@ -34,7 +34,10 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, uint16_t level, union lsa_PolicyInformation *info); NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx); + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_PolicyInformation *info); NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli, @@ -215,7 +218,10 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, uint16_t level, union lsa_PolicyInformation *info); NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx); + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint16_t level, + union lsa_PolicyInformation *info); NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, -- cgit From 662d61e742f89543362a2d96edbf504175ad7e74 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 17:17:20 +0100 Subject: Fix all callers of old rpccli_lsa_set_info_policy() call. Guenther (This used to be commit be8071779fa14d964e86810f5fb16bc52aea4e36) --- source3/utils/net_rpc_audit.c | 84 +++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/source3/utils/net_rpc_audit.c b/source3/utils/net_rpc_audit.c index b7fda2b8e3..115f8f6a8e 100644 --- a/source3/utils/net_rpc_audit.c +++ b/source3/utils/net_rpc_audit.c @@ -72,7 +72,7 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid, { POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - LSA_INFO_CTR dom; + union lsa_PolicyInformation info; int i; uint32 info_class = 2; @@ -97,15 +97,16 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid, goto done; } - result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, - info_class, - &dom); + result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, + &pol, + info_class, + &info); if (!NT_STATUS_IS_OK(result)) { goto done; } - for (i=0; i < dom.info.id2.count1; i++) { + for (i=0; i < info.audit_events.count; i++) { const char *val = NULL, *policy = NULL; @@ -113,14 +114,15 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid, continue; } - val = audit_policy_str(mem_ctx, dom.info.id2.auditsettings[i]); + val = audit_policy_str(mem_ctx, info.audit_events.settings[i]); policy = audit_description_str(i); print_auditing_category(policy, val); } done: if (!NT_STATUS_IS_OK(result)) { - d_printf("failed to get auditing policy: %s\n", nt_errstr(result)); + d_printf("failed to get auditing policy: %s\n", + nt_errstr(result)); } return result; @@ -139,7 +141,7 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid, { POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - LSA_INFO_CTR dom; + union lsa_PolicyInformation info; uint32 info_class = 2; uint32 audit_policy, audit_category; @@ -178,29 +180,32 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid, goto done; } - result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, - info_class, - &dom); + result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, + &pol, + info_class, + &info); if (!NT_STATUS_IS_OK(result)) { goto done; } - dom.info.id2.auditsettings[audit_category] = audit_policy; + info.audit_events.settings[audit_category] = audit_policy; + + result = rpccli_lsa_SetInfoPolicy(pipe_hnd, mem_ctx, + &pol, + info_class, + &info); - result = rpccli_lsa_set_info_policy(pipe_hnd, mem_ctx, &pol, - info_class, - dom); if (!NT_STATUS_IS_OK(result)) { goto done; } - result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, - info_class, - &dom); - + result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, + &pol, + info_class, + &info); { - const char *val = audit_policy_str(mem_ctx, dom.info.id2.auditsettings[audit_category]); + const char *val = audit_policy_str(mem_ctx, info.audit_events.settings[audit_category]); const char *policy = audit_description_str(audit_category); print_auditing_category(policy, val); } @@ -221,7 +226,7 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd, { POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - LSA_INFO_CTR dom; + union lsa_PolicyInformation info; uint32 info_class = 2; @@ -233,19 +238,20 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd, goto done; } - result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, - info_class, - &dom); - + result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, + &pol, + info_class, + &info); if (!NT_STATUS_IS_OK(result)) { goto done; } - dom.info.id2.auditing_enabled = enable; + info.audit_events.auditing_mode = enable; - result = rpccli_lsa_set_info_policy(pipe_hnd, mem_ctx, &pol, - info_class, - dom); + result = rpccli_lsa_SetInfoPolicy(pipe_hnd, mem_ctx, + &pol, + info_class, + &info); if (!NT_STATUS_IS_OK(result)) { goto done; @@ -300,7 +306,7 @@ static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid, { POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - LSA_INFO_CTR dom; + union lsa_PolicyInformation info; int i; uint32 info_class = 2; @@ -313,16 +319,16 @@ static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid, goto done; } - result = rpccli_lsa_query_info_policy_new(pipe_hnd, mem_ctx, &pol, - info_class, - &dom); - + result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, + &pol, + info_class, + &info); if (!NT_STATUS_IS_OK(result)) { goto done; } printf("Auditing:\t\t"); - switch (dom.info.id2.auditing_enabled) { + switch (info.audit_events.auditing_mode) { case True: printf("Enabled"); break; @@ -330,16 +336,16 @@ static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid, printf("Disabled"); break; default: - printf("unknown (%d)", dom.info.id2.auditing_enabled); + printf("unknown (%d)", info.audit_events.auditing_mode); break; } printf("\n"); - printf("Auditing categories:\t%d\n", dom.info.id2.count1); + printf("Auditing categories:\t%d\n", info.audit_events.count); printf("Auditing settings:\n"); - for (i=0; i < dom.info.id2.count1; i++) { - const char *val = audit_policy_str(mem_ctx, dom.info.id2.auditsettings[i]); + for (i=0; i < info.audit_events.count; i++) { + const char *val = audit_policy_str(mem_ctx, info.audit_events.settings[i]); const char *policy = audit_description_str(i); print_auditing_category(policy, val); } -- cgit From e2d32e040758158daf6d08b112c56be4d36c2ba9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 17:37:35 +0100 Subject: Use lsa_PolicyInfo enum in lsa policy info calls. Guenther (This used to be commit 8b63a1665795d2739b54144212926113d9be7f09) --- source3/librpc/idl/lsa.idl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/librpc/idl/lsa.idl b/source3/librpc/idl/lsa.idl index a7e04dc962..7daf648a63 100644 --- a/source3/librpc/idl/lsa.idl +++ b/source3/librpc/idl/lsa.idl @@ -214,7 +214,7 @@ import "security.idl"; LSA_POLICY_INFO_AUDIT_FULL_SET=10, LSA_POLICY_INFO_AUDIT_FULL_QUERY=11, LSA_POLICY_INFO_DNS=12 - } lsaPolicyInfo; + } lsa_PolicyInfo; typedef [switch_type(uint16)] union { [case(LSA_POLICY_INFO_AUDIT_LOG)] lsa_AuditLogInfo audit_log; @@ -233,7 +233,7 @@ import "security.idl"; NTSTATUS lsa_QueryInfoPolicy ( [in] policy_handle *handle, - [in] uint16 level, + [in] lsa_PolicyInfo level, [out,unique,switch_is(level)] lsa_PolicyInformation *info ); @@ -241,7 +241,7 @@ import "security.idl"; /* Function: 0x08 */ NTSTATUS lsa_SetInfoPolicy ( [in] policy_handle *handle, - [in] uint16 level, + [in] lsa_PolicyInfo level, [in,switch_is(level)] lsa_PolicyInformation *info ); @@ -709,14 +709,14 @@ import "security.idl"; NTSTATUS lsa_QueryInfoPolicy2( [in] policy_handle *handle, - [in] uint16 level, + [in] lsa_PolicyInfo level, [out,unique,switch_is(level)] lsa_PolicyInformation *info ); /* Function 0x2f */ NTSTATUS lsa_SetInfoPolicy2( [in] policy_handle *handle, - [in] uint16 level, + [in] lsa_PolicyInfo level, [in,switch_is(level)] lsa_PolicyInformation *info ); -- cgit From dbd3efe942fcc7f609a7bdd36579a7ab318fe18d Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 17:39:33 +0100 Subject: Re-run make idl to update lsa idl. Guenther (This used to be commit 94693755a291993217b5cb74794504a8593eae30) --- source3/librpc/gen_ndr/cli_lsa.c | 8 +++--- source3/librpc/gen_ndr/cli_lsa.h | 8 +++--- source3/librpc/gen_ndr/lsa.h | 12 ++++---- source3/librpc/gen_ndr/ndr_lsa.c | 59 ++++++++++++++++++++++++++++++++-------- source3/librpc/gen_ndr/ndr_lsa.h | 1 + 5 files changed, 62 insertions(+), 26 deletions(-) diff --git a/source3/librpc/gen_ndr/cli_lsa.c b/source3/librpc/gen_ndr/cli_lsa.c index 4d81833fa1..92ba8bdfee 100644 --- a/source3/librpc/gen_ndr/cli_lsa.c +++ b/source3/librpc/gen_ndr/cli_lsa.c @@ -298,7 +298,7 @@ NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - uint16_t level, + enum lsa_PolicyInfo level, union lsa_PolicyInformation *info) { struct lsa_QueryInfoPolicy r; @@ -343,7 +343,7 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - uint16_t level, + enum lsa_PolicyInfo level, union lsa_PolicyInformation *info) { struct lsa_SetInfoPolicy r; @@ -1994,7 +1994,7 @@ NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - uint16_t level, + enum lsa_PolicyInfo level, union lsa_PolicyInformation *info) { struct lsa_QueryInfoPolicy2 r; @@ -2039,7 +2039,7 @@ NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - uint16_t level, + enum lsa_PolicyInfo level, union lsa_PolicyInformation *info) { struct lsa_SetInfoPolicy2 r; diff --git a/source3/librpc/gen_ndr/cli_lsa.h b/source3/librpc/gen_ndr/cli_lsa.h index 59c0b9293d..4ab8be9939 100644 --- a/source3/librpc/gen_ndr/cli_lsa.h +++ b/source3/librpc/gen_ndr/cli_lsa.h @@ -31,12 +31,12 @@ NTSTATUS rpccli_lsa_OpenPolicy(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_QueryInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - uint16_t level, + enum lsa_PolicyInfo level, union lsa_PolicyInformation *info); NTSTATUS rpccli_lsa_SetInfoPolicy(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - uint16_t level, + enum lsa_PolicyInfo level, union lsa_PolicyInformation *info); NTSTATUS rpccli_lsa_ClearAuditLog(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); @@ -215,12 +215,12 @@ NTSTATUS rpccli_lsa_GetUserName(struct rpc_pipe_client *cli, NTSTATUS rpccli_lsa_QueryInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - uint16_t level, + enum lsa_PolicyInfo level, union lsa_PolicyInformation *info); NTSTATUS rpccli_lsa_SetInfoPolicy2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, - uint16_t level, + enum lsa_PolicyInfo level, union lsa_PolicyInformation *info); NTSTATUS rpccli_lsa_QueryTrustedDomainInfoByName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/librpc/gen_ndr/lsa.h b/source3/librpc/gen_ndr/lsa.h index 066d5682fb..513d17b5df 100644 --- a/source3/librpc/gen_ndr/lsa.h +++ b/source3/librpc/gen_ndr/lsa.h @@ -132,7 +132,7 @@ struct lsa_DnsDomainInfo { struct dom_sid2 *sid;/* [unique] */ }; -enum lsaPolicyInfo +enum lsa_PolicyInfo #ifndef USE_UINT_ENUMS { LSA_POLICY_INFO_AUDIT_LOG=1, @@ -149,7 +149,7 @@ enum lsaPolicyInfo LSA_POLICY_INFO_DNS=12 } #else - { __donnot_use_enum_lsaPolicyInfo=0x7FFFFFFF} + { __donnot_use_enum_lsa_PolicyInfo=0x7FFFFFFF} #define LSA_POLICY_INFO_AUDIT_LOG ( 1 ) #define LSA_POLICY_INFO_AUDIT_EVENTS ( 2 ) #define LSA_POLICY_INFO_DOMAIN ( 3 ) @@ -554,7 +554,7 @@ struct lsa_OpenPolicy { struct lsa_QueryInfoPolicy { struct { struct policy_handle *handle;/* [ref] */ - uint16_t level; + enum lsa_PolicyInfo level; } in; struct { @@ -568,7 +568,7 @@ struct lsa_QueryInfoPolicy { struct lsa_SetInfoPolicy { struct { struct policy_handle *handle;/* [ref] */ - uint16_t level; + enum lsa_PolicyInfo level; union lsa_PolicyInformation *info;/* [ref,switch_is(level)] */ } in; @@ -1072,7 +1072,7 @@ struct lsa_GetUserName { struct lsa_QueryInfoPolicy2 { struct { struct policy_handle *handle;/* [ref] */ - uint16_t level; + enum lsa_PolicyInfo level; } in; struct { @@ -1086,7 +1086,7 @@ struct lsa_QueryInfoPolicy2 { struct lsa_SetInfoPolicy2 { struct { struct policy_handle *handle;/* [ref] */ - uint16_t level; + enum lsa_PolicyInfo level; union lsa_PolicyInformation *info;/* [ref,switch_is(level)] */ } in; diff --git a/source3/librpc/gen_ndr/ndr_lsa.c b/source3/librpc/gen_ndr/ndr_lsa.c index 57810bcb28..eed2a8e0e3 100644 --- a/source3/librpc/gen_ndr/ndr_lsa.c +++ b/source3/librpc/gen_ndr/ndr_lsa.c @@ -1147,6 +1147,41 @@ _PUBLIC_ void ndr_print_lsa_DnsDomainInfo(struct ndr_print *ndr, const char *nam ndr->depth--; } +static enum ndr_err_code ndr_push_lsa_PolicyInfo(struct ndr_push *ndr, int ndr_flags, enum lsa_PolicyInfo r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_lsa_PolicyInfo(struct ndr_pull *ndr, int ndr_flags, enum lsa_PolicyInfo *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_lsa_PolicyInfo(struct ndr_print *ndr, const char *name, enum lsa_PolicyInfo r) +{ + const char *val = NULL; + + switch (r) { + case LSA_POLICY_INFO_AUDIT_LOG: val = "LSA_POLICY_INFO_AUDIT_LOG"; break; + case LSA_POLICY_INFO_AUDIT_EVENTS: val = "LSA_POLICY_INFO_AUDIT_EVENTS"; break; + case LSA_POLICY_INFO_DOMAIN: val = "LSA_POLICY_INFO_DOMAIN"; break; + case LSA_POLICY_INFO_PD: val = "LSA_POLICY_INFO_PD"; break; + case LSA_POLICY_INFO_ACCOUNT_DOMAIN: val = "LSA_POLICY_INFO_ACCOUNT_DOMAIN"; break; + case LSA_POLICY_INFO_ROLE: val = "LSA_POLICY_INFO_ROLE"; break; + case LSA_POLICY_INFO_REPLICA: val = "LSA_POLICY_INFO_REPLICA"; break; + case LSA_POLICY_INFO_QUOTA: val = "LSA_POLICY_INFO_QUOTA"; break; + case LSA_POLICY_INFO_DB: val = "LSA_POLICY_INFO_DB"; break; + case LSA_POLICY_INFO_AUDIT_FULL_SET: val = "LSA_POLICY_INFO_AUDIT_FULL_SET"; break; + case LSA_POLICY_INFO_AUDIT_FULL_QUERY: val = "LSA_POLICY_INFO_AUDIT_FULL_QUERY"; break; + case LSA_POLICY_INFO_DNS: val = "LSA_POLICY_INFO_DNS"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + static enum ndr_err_code ndr_push_lsa_PolicyInformation(struct ndr_push *ndr, int ndr_flags, const union lsa_PolicyInformation *r) { if (ndr_flags & NDR_SCALARS) { @@ -4517,7 +4552,7 @@ static enum ndr_err_code ndr_push_lsa_QueryInfoPolicy(struct ndr_push *ndr, int return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info)); @@ -4545,7 +4580,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryInfoPolicy(struct ndr_pull *ndr, int NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); @@ -4580,7 +4615,7 @@ _PUBLIC_ void ndr_print_lsa_QueryInfoPolicy(struct ndr_print *ndr, const char *n ndr->depth++; ndr_print_policy_handle(ndr, "handle", r->in.handle); ndr->depth--; - ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_PolicyInfo(ndr, "level", r->in.level); ndr->depth--; } if (flags & NDR_OUT) { @@ -4606,7 +4641,7 @@ static enum ndr_err_code ndr_push_lsa_SetInfoPolicy(struct ndr_push *ndr, int fl return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level)); if (r->in.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -4631,7 +4666,7 @@ static enum ndr_err_code ndr_pull_lsa_SetInfoPolicy(struct ndr_pull *ndr, int fl NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level)); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.info); } @@ -4661,7 +4696,7 @@ _PUBLIC_ void ndr_print_lsa_SetInfoPolicy(struct ndr_print *ndr, const char *nam ndr->depth++; ndr_print_policy_handle(ndr, "handle", r->in.handle); ndr->depth--; - ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_PolicyInfo(ndr, "level", r->in.level); ndr_print_ptr(ndr, "info", r->in.info); ndr->depth++; ndr_print_set_switch_value(ndr, r->in.info, r->in.level); @@ -8077,7 +8112,7 @@ static enum ndr_err_code ndr_push_lsa_QueryInfoPolicy2(struct ndr_push *ndr, int return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info)); @@ -8105,7 +8140,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryInfoPolicy2(struct ndr_pull *ndr, int NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); @@ -8140,7 +8175,7 @@ _PUBLIC_ void ndr_print_lsa_QueryInfoPolicy2(struct ndr_print *ndr, const char * ndr->depth++; ndr_print_policy_handle(ndr, "handle", r->in.handle); ndr->depth--; - ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_PolicyInfo(ndr, "level", r->in.level); ndr->depth--; } if (flags & NDR_OUT) { @@ -8166,7 +8201,7 @@ static enum ndr_err_code ndr_push_lsa_SetInfoPolicy2(struct ndr_push *ndr, int f return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level)); if (r->in.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -8191,7 +8226,7 @@ static enum ndr_err_code ndr_pull_lsa_SetInfoPolicy2(struct ndr_pull *ndr, int f NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level)); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.info); } @@ -8221,7 +8256,7 @@ _PUBLIC_ void ndr_print_lsa_SetInfoPolicy2(struct ndr_print *ndr, const char *na ndr->depth++; ndr_print_policy_handle(ndr, "handle", r->in.handle); ndr->depth--; - ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_PolicyInfo(ndr, "level", r->in.level); ndr_print_ptr(ndr, "info", r->in.info); ndr->depth++; ndr_print_set_switch_value(ndr, r->in.info, r->in.level); diff --git a/source3/librpc/gen_ndr/ndr_lsa.h b/source3/librpc/gen_ndr/ndr_lsa.h index e6630d12df..dc100297f5 100644 --- a/source3/librpc/gen_ndr/ndr_lsa.h +++ b/source3/librpc/gen_ndr/ndr_lsa.h @@ -204,6 +204,7 @@ void ndr_print_lsa_ModificationInfo(struct ndr_print *ndr, const char *name, con void ndr_print_lsa_AuditFullSetInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullSetInfo *r); void ndr_print_lsa_AuditFullQueryInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullQueryInfo *r); void ndr_print_lsa_DnsDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DnsDomainInfo *r); +void ndr_print_lsa_PolicyInfo(struct ndr_print *ndr, const char *name, enum lsa_PolicyInfo r); void ndr_print_lsa_PolicyInformation(struct ndr_print *ndr, const char *name, const union lsa_PolicyInformation *r); void ndr_print_lsa_SidPtr(struct ndr_print *ndr, const char *name, const struct lsa_SidPtr *r); enum ndr_err_code ndr_push_lsa_SidArray(struct ndr_push *ndr, int ndr_flags, const struct lsa_SidArray *r); -- cgit From a32cca7f372217e483ffda059e7775e3327982cc Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 14:18:53 +0100 Subject: Print principal in debug statement in kerberos_kinit_password() as well. Guenther (This used to be commit 44d67e84625a2a1a93baecef0e418b48e982443b) --- source3/libads/kerberos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index 4fc23956bd..e9222e8401 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -209,7 +209,8 @@ int kerberos_kinit_password_ext(const char *principal, krb5_set_real_time(ctx, time(NULL) + time_offset, 0); } - DEBUG(10,("kerberos_kinit_password: using [%s] as ccache and config [%s]\n", + DEBUG(10,("kerberos_kinit_password: as %s using [%s] as ccache and config [%s]\n", + principal, cache_name ? cache_name: krb5_cc_default_name(ctx), getenv("KRB5_CONFIG"))); -- cgit From 36a7316bfc9d7582ccd908f2b9d96e0fe983e884 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 18:26:24 +0100 Subject: Some more minor cleanup for "net rpc audit". Guenther (This used to be commit 558ce4ec3eaa93c827316d92c346f35c140fadf0) --- source3/utils/net_rpc_audit.c | 112 ++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 58 deletions(-) diff --git a/source3/utils/net_rpc_audit.c b/source3/utils/net_rpc_audit.c index 115f8f6a8e..50bd555f16 100644 --- a/source3/utils/net_rpc_audit.c +++ b/source3/utils/net_rpc_audit.c @@ -1,21 +1,21 @@ -/* - Samba Unix/Linux SMB client library - Distributed SMB/CIFS Server Management Utility +/* + Samba Unix/Linux SMB client library + Distributed SMB/CIFS Server Management Utility Copyright (C) 2006 Guenther Deschner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ - + #include "includes.h" #include "utils/net.h" @@ -54,19 +54,18 @@ static void print_auditing_category(const char *policy, const char *value) pad_len = col_len - strlen(policy); padding[pad_len] = 0; do padding[--pad_len] = ' '; while (pad_len > 0); - + d_printf("\t%s%s%s\n", policy, padding, value); } - /******************************************************************** ********************************************************************/ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid, - const char *domain_name, + const char *domain_name, struct cli_state *cli, struct rpc_pipe_client *pipe_hnd, - TALLOC_CTX *mem_ctx, + TALLOC_CTX *mem_ctx, int argc, const char **argv) { @@ -74,9 +73,7 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid, NTSTATUS result = NT_STATUS_UNSUCCESSFUL; union lsa_PolicyInformation info; int i; - - uint32 info_class = 2; - uint32 audit_category; + uint32_t audit_category; if (argc < 1 || argc > 2) { d_printf("insufficient arguments\n"); @@ -89,7 +86,7 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid, return NT_STATUS_INVALID_PARAMETER; } - result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, + result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true, SEC_RIGHTS_MAXIMUM_ALLOWED, &pol); @@ -99,7 +96,7 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid, result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, &pol, - info_class, + LSA_POLICY_INFO_AUDIT_EVENTS, &info); if (!NT_STATUS_IS_OK(result)) { @@ -132,19 +129,17 @@ static NTSTATUS rpc_audit_get_internal(const DOM_SID *domain_sid, ********************************************************************/ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid, - const char *domain_name, + const char *domain_name, struct cli_state *cli, struct rpc_pipe_client *pipe_hnd, - TALLOC_CTX *mem_ctx, + TALLOC_CTX *mem_ctx, int argc, const char **argv) { POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; union lsa_PolicyInformation info; - - uint32 info_class = 2; - uint32 audit_policy, audit_category; + uint32_t audit_policy, audit_category; if (argc < 2 || argc > 3) { d_printf("insufficient arguments\n"); @@ -172,7 +167,7 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid, return NT_STATUS_INVALID_PARAMETER; } - result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, + result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true, SEC_RIGHTS_MAXIMUM_ALLOWED, &pol); @@ -182,7 +177,7 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid, result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, &pol, - info_class, + LSA_POLICY_INFO_AUDIT_EVENTS, &info); if (!NT_STATUS_IS_OK(result)) { @@ -193,7 +188,7 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid, result = rpccli_lsa_SetInfoPolicy(pipe_hnd, mem_ctx, &pol, - info_class, + LSA_POLICY_INFO_AUDIT_EVENTS, &info); if (!NT_STATUS_IS_OK(result)) { @@ -202,7 +197,7 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid, result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, &pol, - info_class, + LSA_POLICY_INFO_AUDIT_EVENTS, &info); { const char *val = audit_policy_str(mem_ctx, info.audit_events.settings[audit_category]); @@ -214,11 +209,14 @@ static NTSTATUS rpc_audit_set_internal(const DOM_SID *domain_sid, if (!NT_STATUS_IS_OK(result)) { d_printf("failed to set audit policy: %s\n", nt_errstr(result)); } - + return result; } -static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd, +/******************************************************************** +********************************************************************/ + +static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd, TALLOC_CTX *mem_ctx, int argc, const char **argv, @@ -228,9 +226,7 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd, NTSTATUS result = NT_STATUS_UNSUCCESSFUL; union lsa_PolicyInformation info; - uint32 info_class = 2; - - result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, + result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true, SEC_RIGHTS_MAXIMUM_ALLOWED, &pol); @@ -240,7 +236,7 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd, result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, &pol, - info_class, + LSA_POLICY_INFO_AUDIT_EVENTS, &info); if (!NT_STATUS_IS_OK(result)) { goto done; @@ -250,7 +246,7 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd, result = rpccli_lsa_SetInfoPolicy(pipe_hnd, mem_ctx, &pol, - info_class, + LSA_POLICY_INFO_AUDIT_EVENTS, &info); if (!NT_STATUS_IS_OK(result)) { @@ -259,48 +255,51 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd, done: if (!NT_STATUS_IS_OK(result)) { - d_printf("failed to %s audit policy: %s\n", enable ? "enable":"disable", - nt_errstr(result)); + d_printf("failed to %s audit policy: %s\n", + enable ? "enable":"disable", nt_errstr(result)); } return result; } + /******************************************************************** ********************************************************************/ static NTSTATUS rpc_audit_disable_internal(const DOM_SID *domain_sid, - const char *domain_name, + const char *domain_name, struct cli_state *cli, struct rpc_pipe_client *pipe_hnd, - TALLOC_CTX *mem_ctx, + TALLOC_CTX *mem_ctx, int argc, const char **argv) { - return rpc_audit_enable_internal_ext(pipe_hnd, mem_ctx, argc, argv, False); + return rpc_audit_enable_internal_ext(pipe_hnd, mem_ctx, argc, argv, + false); } /******************************************************************** ********************************************************************/ static NTSTATUS rpc_audit_enable_internal(const DOM_SID *domain_sid, - const char *domain_name, + const char *domain_name, struct cli_state *cli, struct rpc_pipe_client *pipe_hnd, - TALLOC_CTX *mem_ctx, + TALLOC_CTX *mem_ctx, int argc, const char **argv) { - return rpc_audit_enable_internal_ext(pipe_hnd, mem_ctx, argc, argv, True); + return rpc_audit_enable_internal_ext(pipe_hnd, mem_ctx, argc, argv, + true); } /******************************************************************** ********************************************************************/ static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid, - const char *domain_name, + const char *domain_name, struct cli_state *cli, struct rpc_pipe_client *pipe_hnd, - TALLOC_CTX *mem_ctx, + TALLOC_CTX *mem_ctx, int argc, const char **argv) { @@ -309,9 +308,7 @@ static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid, union lsa_PolicyInformation info; int i; - uint32 info_class = 2; - - result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, + result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true, SEC_RIGHTS_MAXIMUM_ALLOWED, &pol); @@ -321,7 +318,7 @@ static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid, result = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx, &pol, - info_class, + LSA_POLICY_INFO_AUDIT_EVENTS, &info); if (!NT_STATUS_IS_OK(result)) { goto done; @@ -329,10 +326,10 @@ static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid, printf("Auditing:\t\t"); switch (info.audit_events.auditing_mode) { - case True: + case true: printf("Enabled"); break; - case False: + case false: printf("Disabled"); break; default: @@ -352,20 +349,19 @@ static NTSTATUS rpc_audit_list_internal(const DOM_SID *domain_sid, done: if (!NT_STATUS_IS_OK(result)) { - d_printf("failed to list auditing policies: %s\n", nt_errstr(result)); + d_printf("failed to list auditing policies: %s\n", + nt_errstr(result)); } return result; } - - /******************************************************************** ********************************************************************/ static int rpc_audit_get(int argc, const char **argv) { - return run_rpc_command(NULL, PI_LSARPC, 0, + return run_rpc_command(NULL, PI_LSARPC, 0, rpc_audit_get_internal, argc, argv); } @@ -374,7 +370,7 @@ static int rpc_audit_get(int argc, const char **argv) static int rpc_audit_set(int argc, const char **argv) { - return run_rpc_command(NULL, PI_LSARPC, 0, + return run_rpc_command(NULL, PI_LSARPC, 0, rpc_audit_set_internal, argc, argv); } @@ -383,7 +379,7 @@ static int rpc_audit_set(int argc, const char **argv) static int rpc_audit_enable(int argc, const char **argv) { - return run_rpc_command(NULL, PI_LSARPC, 0, + return run_rpc_command(NULL, PI_LSARPC, 0, rpc_audit_enable_internal, argc, argv); } @@ -392,7 +388,7 @@ static int rpc_audit_enable(int argc, const char **argv) static int rpc_audit_disable(int argc, const char **argv) { - return run_rpc_command(NULL, PI_LSARPC, 0, + return run_rpc_command(NULL, PI_LSARPC, 0, rpc_audit_disable_internal, argc, argv); } @@ -401,14 +397,14 @@ static int rpc_audit_disable(int argc, const char **argv) static int rpc_audit_list(int argc, const char **argv) { - return run_rpc_command(NULL, PI_LSARPC, 0, + return run_rpc_command(NULL, PI_LSARPC, 0, rpc_audit_list_internal, argc, argv); } /******************************************************************** ********************************************************************/ -int net_rpc_audit(int argc, const char **argv) +int net_rpc_audit(int argc, const char **argv) { struct functable func[] = { {"get", rpc_audit_get}, @@ -418,9 +414,9 @@ int net_rpc_audit(int argc, const char **argv) {"list", rpc_audit_list}, {NULL, NULL} }; - + if (argc) return net_run_function(argc, argv, func, net_help_audit); - + return net_help_audit(argc, argv); } -- cgit From 978eb313448fe9612db5491385a91dd3b67d0e97 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Mon, 14 Jan 2008 21:32:59 +0300 Subject: Fix crash in winbind clients: instead of talloc-based pointer we passed address of a local variable. (This used to be commit 0afd2153c7649e89d595cb7eff0f7b3c0b56ea15) --- source3/lib/winbind_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 3cf068a6e0..14356b09cf 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -201,7 +201,7 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); for(i=0; i Date: Mon, 14 Jan 2008 18:31:11 +0100 Subject: Add detection for need of update to the registry db. This only detects if the tdb sequence number has changed since the data has last been read. Michael (This used to be commit 3f081ebeadf30a7943723703ecae479e0412c60c) --- source3/include/reg_objects.h | 4 ++++ source3/registry/reg_api.c | 8 ++++++-- source3/registry/reg_db.c | 29 ++++++++++++++++++++++++++++- source3/registry/reg_frontend_hilvl.c | 29 +++++++++++++++++++++++++++++ source3/registry/reg_printing.c | 2 +- source3/registry/reg_shares.c | 2 +- source3/registry/reg_smbconf.c | 4 +++- 7 files changed, 72 insertions(+), 6 deletions(-) diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h index f6cf9cccb7..23a14e6757 100644 --- a/source3/include/reg_objects.h +++ b/source3/include/reg_objects.h @@ -61,6 +61,7 @@ struct registry_value { typedef struct { uint32 num_values; REGISTRY_VALUE **values; + int seqnum; } REGVAL_CTR; /* container for registry subkey names */ @@ -68,6 +69,7 @@ typedef struct { typedef struct { uint32 num_subkeys; char **subkeys; + int seqnum; } REGSUBKEY_CTR; /* @@ -128,6 +130,8 @@ typedef struct { struct security_descriptor **psecdesc); WERROR (*set_secdesc)(const char *key, struct security_descriptor *sec_desc); + bool (*subkeys_need_update)(REGSUBKEY_CTR *subkeys); + bool (*values_need_update)(REGVAL_CTR *values); } REGISTRY_OPS; typedef struct { diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index bb410e646b..8bbdb6abd3 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -27,7 +27,9 @@ static WERROR fill_value_cache(struct registry_key *key) { if (key->values != NULL) { - return WERR_OK; + if (!reg_values_need_update(key->key, key->values)) { + return WERR_OK; + } } if (!(key->values = TALLOC_ZERO_P(key, REGVAL_CTR))) { @@ -44,7 +46,9 @@ static WERROR fill_value_cache(struct registry_key *key) static WERROR fill_subkey_cache(struct registry_key *key) { if (key->subkeys != NULL) { - return WERR_OK; + if (!reg_subkeys_need_update(key->key, key->subkeys)) { + return WERR_OK; + } } if (!(key->subkeys = TALLOC_ZERO_P(key, REGSUBKEY_CTR))) { diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index f50a41816c..c4bfc2b6c9 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -622,7 +622,15 @@ int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr) } strupper_m(path); + if (tdb_read_lock_bystring_with_timeout(tdb_reg->tdb, path, 10) == -1) { + return 0; + } + dbuf = tdb_fetch_bystring(tdb_reg->tdb, path); + ctr->seqnum = regdb_get_seqnum(); + + tdb_read_unlock_bystring(tdb_reg->tdb, path); + buf = dbuf.dptr; buflen = dbuf.dsize; @@ -750,7 +758,14 @@ int regdb_fetch_values( const char* key, REGVAL_CTR *values ) return 0; } + if (tdb_read_lock_bystring_with_timeout(tdb_reg->tdb, keystr, 10) == -1) { + return 0; + } + data = tdb_fetch_bystring(tdb_reg->tdb, keystr); + values->seqnum = regdb_get_seqnum(); + + tdb_read_unlock_bystring(tdb_reg->tdb, keystr); if (!data.dptr) { /* all keys have zero values by default */ @@ -907,6 +922,16 @@ static WERROR regdb_set_secdesc(const char *key, return err; } +bool regdb_subkeys_need_update(REGSUBKEY_CTR *subkeys) +{ + return (regdb_get_seqnum() != subkeys->seqnum); +} + +bool regdb_values_need_update(REGVAL_CTR *values) +{ + return (regdb_get_seqnum() != values->seqnum); +} + /* * Table of function pointers for default access */ @@ -918,5 +943,7 @@ REGISTRY_OPS regdb_ops = { regdb_store_values, NULL, regdb_get_secdesc, - regdb_set_secdesc + regdb_set_secdesc, + regdb_subkeys_need_update, + regdb_values_need_update }; diff --git a/source3/registry/reg_frontend_hilvl.c b/source3/registry/reg_frontend_hilvl.c index a4b78b24c0..73fcf87e17 100644 --- a/source3/registry/reg_frontend_hilvl.c +++ b/source3/registry/reg_frontend_hilvl.c @@ -214,3 +214,32 @@ WERROR regkey_set_secdesc(REGISTRY_KEY *key, return WERR_ACCESS_DENIED; } + +/** + * Check whether the in-memory version of the subkyes of a + * registry key needs update from disk. + */ +bool reg_subkeys_need_update(REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys) +{ + if (key->hook && key->hook->ops && key->hook->ops->subkeys_need_update) + { + return key->hook->ops->subkeys_need_update(subkeys); + } + + return false; +} + +/** + * Check whether the in-memory version of the values of a + * registry key needs update from disk. + */ +bool reg_values_need_update(REGISTRY_KEY *key, REGVAL_CTR *values) +{ + if (key->hook && key->hook->ops && key->hook->ops->values_need_update) + { + return key->hook->ops->values_need_update(values); + } + + return false; +} + diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c index 2ca74f7c16..5be0796002 100644 --- a/source3/registry/reg_printing.c +++ b/source3/registry/reg_printing.c @@ -1266,5 +1266,5 @@ REGISTRY_OPS printing_ops = { regprint_fetch_reg_values, regprint_store_reg_keys, regprint_store_reg_values, - NULL, NULL, NULL + NULL, NULL, NULL, NULL, NULL }; diff --git a/source3/registry/reg_shares.c b/source3/registry/reg_shares.c index 178f23e21c..4ac6e1d151 100644 --- a/source3/registry/reg_shares.c +++ b/source3/registry/reg_shares.c @@ -159,7 +159,7 @@ REGISTRY_OPS shares_reg_ops = { shares_value_info, shares_store_subkey, shares_store_value, - NULL, NULL, NULL + NULL, NULL, NULL, NULL, NULL }; diff --git a/source3/registry/reg_smbconf.c b/source3/registry/reg_smbconf.c index 116cde936e..8dfb745a7e 100644 --- a/source3/registry/reg_smbconf.c +++ b/source3/registry/reg_smbconf.c @@ -271,5 +271,7 @@ REGISTRY_OPS smbconf_reg_ops = { smbconf_store_values, smbconf_reg_access_check, smbconf_get_secdesc, - smbconf_set_secdesc + smbconf_set_secdesc, + NULL, + NULL }; -- cgit From edd4cb0373a668c422b3aa2a460c1004682f3d1d Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Mon, 14 Jan 2008 21:32:59 +0300 Subject: Fix crash in winbind clients: instead of talloc-based pointer we passed address of a local variable. (This used to be commit a861ff20917eeca303e2d36de71cd8614e937d5f) --- source3/lib/winbind_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 3cf068a6e0..14356b09cf 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -201,7 +201,7 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); for(i=0; i Date: Mon, 14 Jan 2008 11:06:46 -0800 Subject: From Alexander Bokovoy names is a 'const char **names' here, passed from upper level. Passing 'names' as a talloc context will break things as 'names' is usually likely is a local variable, not a talloc'd. And we want to have array elements on a context of the array anyway. Jeremy. (This used to be commit 22a4129fabf70e01cc638c2f7347c28201838830) --- source3/lib/winbind_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 3cf068a6e0..14356b09cf 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -201,7 +201,7 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); for(i=0; i Date: Mon, 14 Jan 2008 13:46:06 -0800 Subject: Windows insists on write sizes < max_xmit on signed connections. Jeremy. (This used to be commit ef9b278b6289a9ecdd6b103927058f64fbb7eb97) --- source3/libsmb/clireadwrite.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 0b33e43563..6b39a885f0 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -404,6 +404,9 @@ ssize_t cli_write(struct cli_state *cli, mpx = 1; } + /* Default (small) writesize. */ + writesize = (cli->max_xmit - (smb_size+32)) & ~1023; + if (write_mode == 0 && !client_is_signing_on(cli) && !cli_encryption_on(cli) && @@ -415,11 +418,11 @@ ssize_t cli_write(struct cli_state *cli, } else if (cli->capabilities & CAP_LARGE_WRITEX) { if (cli->is_samba) { writesize = CLI_SAMBA_MAX_LARGE_WRITEX_SIZE; - } else { + } else if (!client_is_signing_on(cli)) { + /* Windows restricts signed writes to max_xmit. + * Found by Volker. */ writesize = CLI_WINDOWS_MAX_LARGE_WRITEX_SIZE; } - } else { - writesize = (cli->max_xmit - (smb_size+32)) & ~1023; } blocks = (size + (writesize-1)) / writesize; -- cgit From 8a6f492e57a06501c91f5fc37a2d242dd6d37bdf Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 15 Jan 2008 10:33:25 +0100 Subject: Add True/False bool cleanup script. Guenther (This used to be commit 9f05d2eae7c55d39ad61da54c4a38d6b6f8d4d3a) --- source3/script/fix_bool.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 source3/script/fix_bool.pl diff --git a/source3/script/fix_bool.pl b/source3/script/fix_bool.pl new file mode 100755 index 0000000000..c09645de7c --- /dev/null +++ b/source3/script/fix_bool.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl -w + +open(INFILE, "$ARGV[0]") || die $@; +open(OUTFILE, ">$ARGV[0].new") || die $@; + +while () { + $_ =~ s/True/true/; + $_ =~ s/False/false/; + print OUTFILE "$_"; +} + +close(INFILE); +close(OUTFILE); + +rename("$ARGV[0].new", "$ARGV[0]") || die @_; + +exit(0); + + -- cgit From bfc4e62e61291670b1bcddfa260c59742ed67026 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 15 Jan 2008 10:24:09 +0100 Subject: libwbclient: move wbc_err.h into wbclient.h as we only install one header This makes the installed wbclient.h header usable. metze (This used to be commit 7dd65599a15bf1d164fcfa554c8057d43c51eb6d) --- source3/nsswitch/libwbclient/wbc_err.h | 51 --------------------------------- source3/nsswitch/libwbclient/wbclient.h | 27 ++++++++++++++++- 2 files changed, 26 insertions(+), 52 deletions(-) delete mode 100644 source3/nsswitch/libwbclient/wbc_err.h diff --git a/source3/nsswitch/libwbclient/wbc_err.h b/source3/nsswitch/libwbclient/wbc_err.h deleted file mode 100644 index 069f68f189..0000000000 --- a/source3/nsswitch/libwbclient/wbc_err.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Winbind client API - - Copyright (C) Gerald (Jerry) Carter 2007 - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . -*/ - -#ifndef _WBC_ERR_H -#define _WBC_ERR_H - - -/* Define error types */ - -/** - * @brief Status codes returned from wbc functions - **/ - -enum _wbcErrType { - WBC_ERR_SUCCESS = 0, /**< Successful completion **/ - WBC_ERR_NOT_IMPLEMENTED,/**< Function not implemented **/ - WBC_ERR_UNKNOWN_FAILURE,/**< General failure **/ - WBC_ERR_NO_MEMORY, /**< Memory allocation error **/ - WBC_ERR_INVALID_SID, /**< Invalid SID format **/ - WBC_ERR_INVALID_PARAM, /**< An Invalid parameter was supplied **/ - WBC_ERR_WINBIND_NOT_AVAILABLE, /**< Winbind daemon is not available **/ - WBC_ERR_DOMAIN_NOT_FOUND, /**< Domain is not trusted or cannot be found **/ - WBC_INVALID_RESPONSE, /**< Winbind returned an invalid response **/ - WBC_ERR_NSS_ERROR /**< NSS_STATUS error **/ -}; - -typedef enum _wbcErrType wbcErr; - -#define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS) - -char *wbcErrorString(wbcErr error); - -#endif /* _WBC_ERR_H */ diff --git a/source3/nsswitch/libwbclient/wbclient.h b/source3/nsswitch/libwbclient/wbclient.h index 6b85d7e8b3..0b256d343f 100644 --- a/source3/nsswitch/libwbclient/wbclient.h +++ b/source3/nsswitch/libwbclient/wbclient.h @@ -23,7 +23,32 @@ #define _WBCLIENT_H #include -#include +#include + +/* Define error types */ + +/** + * @brief Status codes returned from wbc functions + **/ + +enum _wbcErrType { + WBC_ERR_SUCCESS = 0, /**< Successful completion **/ + WBC_ERR_NOT_IMPLEMENTED,/**< Function not implemented **/ + WBC_ERR_UNKNOWN_FAILURE,/**< General failure **/ + WBC_ERR_NO_MEMORY, /**< Memory allocation error **/ + WBC_ERR_INVALID_SID, /**< Invalid SID format **/ + WBC_ERR_INVALID_PARAM, /**< An Invalid parameter was supplied **/ + WBC_ERR_WINBIND_NOT_AVAILABLE, /**< Winbind daemon is not available **/ + WBC_ERR_DOMAIN_NOT_FOUND, /**< Domain is not trusted or cannot be found **/ + WBC_INVALID_RESPONSE, /**< Winbind returned an invalid response **/ + WBC_ERR_NSS_ERROR /**< NSS_STATUS error **/ +}; + +typedef enum _wbcErrType wbcErr; + +#define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS) + +char *wbcErrorString(wbcErr error); /* * Data types used by the Winbind Client API -- cgit From 1e9c289d84947a2ea175b3fde5a537bf3189976b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 15 Jan 2008 10:42:03 +0100 Subject: libwbclient: install wbclient.h into the same path as smbclient.h metze (This used to be commit 7cb81bfc6bcdd56a8886e18aa9a7e05ec963d33d) --- source3/Makefile.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index c34f3283db..3918d29a3e 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1884,9 +1884,10 @@ installlibaddns: installdirs libaddns -$(INSTALLLIBCMD_A) bin/libaddns.a $(DESTDIR)$(LIBDIR) installlibwbclient: installdirs libwbclient - @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) $(INCLUDEDIR)/samba + @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) -$(INSTALLLIBCMD_SH) bin/libwbclient.@SHLIBEXT@ $(DESTDIR)$(LIBDIR) - -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/nsswitch/libwbclient/wbclient.h $(DESTDIR)${prefix}/include/samba + @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) ${prefix}/include + -$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/nsswitch/libwbclient/wbclient.h $(DESTDIR)${prefix}/include installlibnetapi: installdirs libnetapi @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) -- cgit From e00e080034124805092e7f888e3a1cf61cf85a5b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 15 Jan 2008 10:43:24 +0100 Subject: libwbclient: add wbclient.pc.in metze (This used to be commit e6bd1395f2c1da7bcf1a31cdb297919ed6a15469) --- source3/configure.in | 5 ++++- source3/pkgconfig/wbclient.pc.in | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 source3/pkgconfig/wbclient.pc.in diff --git a/source3/configure.in b/source3/configure.in index 4222d93227..98f5c450a8 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -6656,7 +6656,10 @@ AC_SUBST(SMBD_LIBS) AC_OUTPUT(Makefile library-versions script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh lib/netapi/examples/Makefile - pkgconfig/smbclient.pc pkgconfig/netapi.pc pkgconfig/smbsharemodes.pc + pkgconfig/smbclient.pc + pkgconfig/wbclient.pc + pkgconfig/netapi.pc + pkgconfig/smbsharemodes.pc ) ################################################# diff --git a/source3/pkgconfig/wbclient.pc.in b/source3/pkgconfig/wbclient.pc.in new file mode 100644 index 0000000000..158fa923d6 --- /dev/null +++ b/source3/pkgconfig/wbclient.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Samba libwbclient +Description: A library to access winbindd +Version: 0 +URL: http://www.samba.org/ +#Libs: -L@libdir@ -lwbclient +Libs: -lwbclient +Libs.private: -lwbclient +Cflags: -I@includedir@ -- cgit From 57cc992e0f9a5d729ecf3c8effc862542ef7a84e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 22 Oct 2007 18:14:57 +0200 Subject: Implement vfs_ea_tdb This is an option for file systems that do not implement xattrs: in lockdir/eas.tdb an array of xatts per inode is stored. It can not solve the problem that xattrs might reappear if a posix-level process deletes a file and happens to re-create it under the same name. On file systems with birthtime we might have a chance to detect this, but not with standard posix. A future version might put relief on file systems that do have xattrs but where these are severely limited in size/speed/whatever: We can put a simple marker as a native xattr, but the xattrs proper are stored in the tdb. Volker (This used to be commit 2036b4c5ad677b8a477b34b0f076febab0abff5e) --- source3/Makefile.in | 7 +- source3/configure.in | 3 +- source3/librpc/gen_ndr/ndr_xattr.c | 102 +++++ source3/librpc/gen_ndr/ndr_xattr.h | 16 + source3/librpc/gen_ndr/xattr.h | 18 + source3/librpc/idl/xattr.idl | 23 ++ source3/modules/vfs_ea_tdb.c | 736 ++++++++++++++++++++++++++++++++++ source3/script/tests/selftest.sh | 1 + source3/script/tests/test_posix_s3.sh | 2 +- 9 files changed, 905 insertions(+), 3 deletions(-) create mode 100644 source3/librpc/gen_ndr/ndr_xattr.c create mode 100644 source3/librpc/gen_ndr/ndr_xattr.h create mode 100644 source3/librpc/gen_ndr/xattr.h create mode 100644 source3/librpc/idl/xattr.idl create mode 100644 source3/modules/vfs_ea_tdb.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 3918d29a3e..1d480552eb 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -503,6 +503,7 @@ VFS_CAP_OBJ = modules/vfs_cap.o VFS_EXPAND_MSDFS_OBJ = modules/vfs_expand_msdfs.o VFS_SHADOW_COPY_OBJ = modules/vfs_shadow_copy.o VFS_AFSACL_OBJ = modules/vfs_afsacl.o +VFS_EA_TDB_OBJ = modules/vfs_ea_tdb.o librpc/gen_ndr/ndr_xattr.o VFS_POSIXACL_OBJ = modules/vfs_posixacl.o VFS_AIXACL_OBJ = modules/vfs_aixacl.o modules/vfs_aixacl_util.o VFS_AIXACL2_OBJ = modules/vfs_aixacl2.o modules/vfs_aixacl_util.o modules/nfs4_acls.o @@ -1060,7 +1061,7 @@ modules: SHOWFLAGS $(MODULES) ## Perl IDL Compiler IDL_FILES = unixinfo.idl lsa.idl dfs.idl echo.idl winreg.idl initshutdown.idl \ srvsvc.idl svcctl.idl eventlog.idl wkssvc.idl netlogon.idl notify.idl \ - epmapper.idl messaging.idl + epmapper.idl messaging.idl xattr.idl idl: @IDL_FILES="$(IDL_FILES)" CPP="$(CPP)" PERL="$(PERL)" \ @@ -1684,6 +1685,10 @@ bin/afsacl.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_AFSACL_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_AFSACL_OBJ) +bin/ea_tdb.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_EA_TDB_OBJ) + @echo "Building plugin $@" + @$(SHLD_MODULE) $(VFS_EA_TDB_OBJ) + bin/posixacl.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_POSIXACL_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_POSIXACL_OBJ) diff --git a/source3/configure.in b/source3/configure.in index 98f5c450a8..4ddc64407c 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -707,7 +707,7 @@ dnl These have to be built static: default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_winreg rpc_initshutdown rpc_lsa_ds rpc_wkssvc rpc_svcctl2 rpc_ntsvcs rpc_net rpc_netdfs rpc_srvsvc2 rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default nss_info_template" dnl These are preferably build shared, and static if dlopen() is not available -default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops" +default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops vfs_ea_tdb" if test "x$developer" = xyes; then default_static_modules="$default_static_modules rpc_rpcecho" @@ -6489,6 +6489,7 @@ SMB_MODULE(vfs_cap, \$(VFS_CAP_OBJ), "bin/cap.$SHLIBEXT", VFS) SMB_MODULE(vfs_expand_msdfs, \$(VFS_EXPAND_MSDFS_OBJ), "bin/expand_msdfs.$SHLIBEXT", VFS) SMB_MODULE(vfs_shadow_copy, \$(VFS_SHADOW_COPY_OBJ), "bin/shadow_copy.$SHLIBEXT", VFS) SMB_MODULE(vfs_afsacl, \$(VFS_AFSACL_OBJ), "bin/afsacl.$SHLIBEXT", VFS) +SMB_MODULE(vfs_ea_tdb, \$(VFS_EA_TDB_OBJ), "bin/ea_tdb.$SHLIBEXT", VFS) SMB_MODULE(vfs_posixacl, \$(VFS_POSIXACL_OBJ), "bin/posixacl.$SHLIBEXT", VFS) SMB_MODULE(vfs_aixacl, \$(VFS_AIXACL_OBJ), "bin/aixacl.$SHLIBEXT", VFS) SMB_MODULE(vfs_aixacl2, \$(VFS_AIXACL2_OBJ), "bin/aixacl2.$SHLIBEXT", VFS) diff --git a/source3/librpc/gen_ndr/ndr_xattr.c b/source3/librpc/gen_ndr/ndr_xattr.c new file mode 100644 index 0000000000..29a31a12b2 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_xattr.c @@ -0,0 +1,102 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_xattr.h" + +_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name)); + ndr->flags = _flags_save_string; + } + NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_tdb_xattr(struct ndr_print *ndr, const char *name, const struct tdb_xattr *r) +{ + ndr_print_struct(ndr, name, "tdb_xattr"); + ndr->depth++; + ndr_print_string(ndr, "name", r->name); + ndr_print_DATA_BLOB(ndr, "value", r->value); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r) +{ + uint32_t cntr_xattrs_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_xattrs)); + for (cntr_xattrs_0 = 0; cntr_xattrs_0 < r->num_xattrs; cntr_xattrs_0++) { + NDR_CHECK(ndr_push_tdb_xattr(ndr, NDR_SCALARS, &r->xattrs[cntr_xattrs_0])); + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r) +{ + uint32_t cntr_xattrs_0; + TALLOC_CTX *_mem_save_xattrs_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_xattrs)); + NDR_PULL_ALLOC_N(ndr, r->xattrs, r->num_xattrs); + _mem_save_xattrs_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->xattrs, 0); + for (cntr_xattrs_0 = 0; cntr_xattrs_0 < r->num_xattrs; cntr_xattrs_0++) { + NDR_CHECK(ndr_pull_tdb_xattr(ndr, NDR_SCALARS, &r->xattrs[cntr_xattrs_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_xattrs_0, 0); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r) +{ + uint32_t cntr_xattrs_0; + ndr_print_struct(ndr, name, "tdb_xattrs"); + ndr->depth++; + ndr_print_uint32(ndr, "num_xattrs", r->num_xattrs); + ndr->print(ndr, "%s: ARRAY(%d)", "xattrs", r->num_xattrs); + ndr->depth++; + for (cntr_xattrs_0=0;cntr_xattrs_0num_xattrs;cntr_xattrs_0++) { + char *idx_0=NULL; + asprintf(&idx_0, "[%d]", cntr_xattrs_0); + if (idx_0) { + ndr_print_tdb_xattr(ndr, "xattrs", &r->xattrs[cntr_xattrs_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; +} diff --git a/source3/librpc/gen_ndr/ndr_xattr.h b/source3/librpc/gen_ndr/ndr_xattr.h new file mode 100644 index 0000000000..a18477f347 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_xattr.h @@ -0,0 +1,16 @@ +/* header auto-generated by pidl */ + +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/xattr.h" + +#ifndef _HEADER_NDR_xattr +#define _HEADER_NDR_xattr + +#define NDR_XATTR_CALL_COUNT (0) +enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattr *r); +enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattr *r); +void ndr_print_tdb_xattr(struct ndr_print *ndr, const char *name, const struct tdb_xattr *r); +enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r); +enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r); +void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r); +#endif /* _HEADER_NDR_xattr */ diff --git a/source3/librpc/gen_ndr/xattr.h b/source3/librpc/gen_ndr/xattr.h new file mode 100644 index 0000000000..ee30376be8 --- /dev/null +++ b/source3/librpc/gen_ndr/xattr.h @@ -0,0 +1,18 @@ +/* header auto-generated by pidl */ + +#include + +#ifndef _HEADER_xattr +#define _HEADER_xattr + +struct tdb_xattr { + const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */ + DATA_BLOB value; +}/* [public] */; + +struct tdb_xattrs { + uint32_t num_xattrs; + struct tdb_xattr *xattrs; +}/* [public] */; + +#endif /* _HEADER_xattr */ diff --git a/source3/librpc/idl/xattr.idl b/source3/librpc/idl/xattr.idl new file mode 100644 index 0000000000..ec230a4efb --- /dev/null +++ b/source3/librpc/idl/xattr.idl @@ -0,0 +1,23 @@ +#include "idl_types.h" + +/* + IDL structures for xattrs +*/ + +[ + pointer_default(unique) +] +interface xattr +{ + /* xattrs for file systems that don't have any */ + + typedef [public] struct { + utf8string name; + DATA_BLOB value; + } tdb_xattr; + + typedef [public] struct { + uint32 num_xattrs; + tdb_xattr xattrs[num_xattrs]; + } tdb_xattrs; +} diff --git a/source3/modules/vfs_ea_tdb.c b/source3/modules/vfs_ea_tdb.c new file mode 100644 index 0000000000..8cf04d79ad --- /dev/null +++ b/source3/modules/vfs_ea_tdb.c @@ -0,0 +1,736 @@ +/* + * Store posix-level xattrs in a tdb + * + * Copyright (C) Volker Lendecke, 2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" +#include "librpc/gen_ndr/xattr.h" +#include "librpc/gen_ndr/ndr_xattr.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_VFS + +/* + * unmarshall tdb_xattrs + */ + +static NTSTATUS ea_tdb_pull_attrs(TALLOC_CTX *mem_ctx, + const TDB_DATA *data, + struct tdb_xattrs **presult) +{ + DATA_BLOB blob; + enum ndr_err_code ndr_err; + struct tdb_xattrs *result; + + if (!(result = TALLOC_ZERO_P(mem_ctx, struct tdb_xattrs))) { + return NT_STATUS_NO_MEMORY; + } + + if (data->dsize == 0) { + *presult = result; + return NT_STATUS_OK; + } + + blob = data_blob_const(data->dptr, data->dsize); + + ndr_err = ndr_pull_struct_blob( + &blob, result, result, + (ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs); + + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + DEBUG(0, ("ndr_pull_tdb_xattrs failed: %s\n", + ndr_errstr(ndr_err))); + TALLOC_FREE(result); + return ndr_map_error2ntstatus(ndr_err);; + } + + *presult = result; + return NT_STATUS_OK; +} + +/* + * marshall tdb_xattrs + */ + +static NTSTATUS ea_tdb_push_attrs(TALLOC_CTX *mem_ctx, + const struct tdb_xattrs *attribs, + TDB_DATA *data) +{ + DATA_BLOB blob; + enum ndr_err_code ndr_err; + + ndr_err = ndr_push_struct_blob( + &blob, mem_ctx, attribs, + (ndr_push_flags_fn_t)ndr_push_tdb_xattrs); + + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + DEBUG(0, ("ndr_push_tdb_xattrs failed: %s\n", + ndr_errstr(ndr_err))); + return ndr_map_error2ntstatus(ndr_err);; + } + + *data = make_tdb_data(blob.data, blob.length); + return NT_STATUS_OK; +} + +/* + * Load tdb_xattrs for a file from the tdb + */ + +static NTSTATUS ea_tdb_load_attrs(TALLOC_CTX *mem_ctx, + struct db_context *db_ctx, + const struct file_id *id, + struct tdb_xattrs **presult) +{ + uint8 id_buf[16]; + NTSTATUS status; + TDB_DATA data; + + push_file_id_16((char *)id_buf, id); + + if (db_ctx->fetch(db_ctx, mem_ctx, + make_tdb_data(id_buf, sizeof(id_buf)), + &data) == -1) { + return NT_STATUS_INTERNAL_DB_CORRUPTION; + } + + status = ea_tdb_pull_attrs(mem_ctx, &data, presult); + TALLOC_FREE(data.dptr); + return NT_STATUS_OK; +} + +/* + * fetch_lock the tdb_ea record for a file + */ + +static struct db_record *ea_tdb_lock_attrs(TALLOC_CTX *mem_ctx, + struct db_context *db_ctx, + const struct file_id *id) +{ + uint8 id_buf[16]; + push_file_id_16((char *)id_buf, id); + return db_ctx->fetch_locked(db_ctx, mem_ctx, + make_tdb_data(id_buf, sizeof(id_buf))); +} + +/* + * Save tdb_xattrs to a previously fetch_locked record + */ + +static NTSTATUS ea_tdb_save_attrs(struct db_record *rec, + const struct tdb_xattrs *attribs) +{ + TDB_DATA data; + NTSTATUS status; + + status = ea_tdb_push_attrs(talloc_tos(), attribs, &data); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("ea_tdb_push_attrs failed: %s\n", + nt_errstr(status))); + return status; + } + + status = rec->store(rec, data, 0); + + TALLOC_FREE(data.dptr); + + return status; +} + +/* + * Worker routine for getxattr and fgetxattr + */ + +static ssize_t ea_tdb_getattr(struct db_context *db_ctx, + const struct file_id *id, + const char *name, void *value, size_t size) +{ + struct tdb_xattrs *attribs; + uint32_t i; + ssize_t result = -1; + NTSTATUS status; + + status = ea_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("ea_tdb_fetch_attrs failed: %s\n", + nt_errstr(status))); + errno = EINVAL; + return -1; + } + + for (i=0; inum_xattrs; i++) { + if (strcmp(attribs->xattrs[i].name, name) == 0) { + break; + } + } + + if (i == attribs->num_xattrs) { + errno = ENOATTR; + goto fail; + } + + if (attribs->xattrs[i].value.length > size) { + errno = ERANGE; + goto fail; + } + + memcpy(value, attribs->xattrs[i].value.data, + attribs->xattrs[i].value.length); + result = attribs->xattrs[i].value.length; + + fail: + TALLOC_FREE(attribs); + return result; +} + +static ssize_t ea_tdb_getxattr(struct vfs_handle_struct *handle, + const char *path, const char *name, + void *value, size_t size) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + return ea_tdb_getattr(db, &id, name, value, size); +} + +static ssize_t ea_tdb_fgetxattr(struct vfs_handle_struct *handle, + struct files_struct *fsp, + const char *name, void *value, size_t size) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + return ea_tdb_getattr(db, &id, name, value, size); +} + +/* + * Worker routine for setxattr and fsetxattr + */ + +static int ea_tdb_setattr(struct db_context *db_ctx, + const struct file_id *id, const char *name, + const void *value, size_t size, int flags) +{ + NTSTATUS status; + struct db_record *rec; + struct tdb_xattrs *attribs; + uint32_t i; + + rec = ea_tdb_lock_attrs(talloc_tos(), db_ctx, id); + + if (rec == NULL) { + DEBUG(0, ("ea_tdb_lock_attrs failed\n")); + errno = EINVAL; + return -1; + } + + status = ea_tdb_pull_attrs(rec, &rec->value, &attribs); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("ea_tdb_fetch_attrs failed: %s\n", + nt_errstr(status))); + TALLOC_FREE(rec); + return -1; + } + + for (i=0; inum_xattrs; i++) { + if (strcmp(attribs->xattrs[i].name, name) == 0) { + break; + } + } + + if (i == attribs->num_xattrs) { + struct tdb_xattr *tmp; + + tmp = TALLOC_REALLOC_ARRAY( + attribs, attribs->xattrs, struct tdb_xattr, + attribs->num_xattrs + 1); + + if (tmp == NULL) { + DEBUG(0, ("TALLOC_REALLOC_ARRAY failed\n")); + TALLOC_FREE(rec); + errno = ENOMEM; + return -1; + } + + attribs->xattrs = tmp; + attribs->num_xattrs += 1; + } + + attribs->xattrs[i].name = name; + attribs->xattrs[i].value.data = CONST_DISCARD(uint8 *, value); + attribs->xattrs[i].value.length = size; + + status = ea_tdb_save_attrs(rec, attribs); + + TALLOC_FREE(rec); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("save failed: %s\n", nt_errstr(status))); + return -1; + } + + return 0; +} + +static int ea_tdb_setxattr(struct vfs_handle_struct *handle, + const char *path, const char *name, + const void *value, size_t size, int flags) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + return ea_tdb_setattr(db, &id, name, value, size, flags); +} + +static int ea_tdb_fsetxattr(struct vfs_handle_struct *handle, + struct files_struct *fsp, + const char *name, const void *value, + size_t size, int flags) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + return ea_tdb_setattr(db, &id, name, value, size, flags); +} + +/* + * Worker routine for listxattr and flistxattr + */ + +static ssize_t ea_tdb_listattr(struct db_context *db_ctx, + const struct file_id *id, char *list, + size_t size) +{ + NTSTATUS status; + struct tdb_xattrs *attribs; + uint32_t i; + size_t len = 0; + + status = ea_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("ea_tdb_fetch_attrs failed: %s\n", + nt_errstr(status))); + errno = EINVAL; + return -1; + } + + DEBUG(10, ("ea_tdb_listattr: Found %d xattrs\n", attribs->num_xattrs)); + + for (i=0; inum_xattrs; i++) { + size_t tmp; + + DEBUG(10, ("ea_tdb_listattr: xattrs[i].name: %s\n", + attribs->xattrs[i].name)); + + tmp = strlen(attribs->xattrs[i].name); + + /* + * Try to protect against overflow + */ + + if (len + (tmp+1) < len) { + TALLOC_FREE(attribs); + errno = EINVAL; + return -1; + } + + /* + * Take care of the terminating NULL + */ + len += (tmp + 1); + } + + if (len > size) { + TALLOC_FREE(attribs); + errno = ERANGE; + return -1; + } + + len = 0; + + for (i=0; inum_xattrs; i++) { + strlcpy(list+len, attribs->xattrs[i].name, + size-len); + len += (strlen(attribs->xattrs[i].name) + 1); + } + + TALLOC_FREE(attribs); + return len; +} + +static ssize_t ea_tdb_listxattr(struct vfs_handle_struct *handle, + const char *path, char *list, size_t size) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + return ea_tdb_listattr(db, &id, list, size); +} + +static ssize_t ea_tdb_flistxattr(struct vfs_handle_struct *handle, + struct files_struct *fsp, char *list, + size_t size) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + return ea_tdb_listattr(db, &id, list, size); +} + +/* + * Worker routine for removexattr and fremovexattr + */ + +static int ea_tdb_removeattr(struct db_context *db_ctx, + const struct file_id *id, const char *name) +{ + NTSTATUS status; + struct db_record *rec; + struct tdb_xattrs *attribs; + uint32_t i; + + rec = ea_tdb_lock_attrs(talloc_tos(), db_ctx, id); + + if (rec == NULL) { + DEBUG(0, ("ea_tdb_lock_attrs failed\n")); + errno = EINVAL; + return -1; + } + + status = ea_tdb_pull_attrs(rec, &rec->value, &attribs); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("ea_tdb_fetch_attrs failed: %s\n", + nt_errstr(status))); + TALLOC_FREE(rec); + return -1; + } + + for (i=0; inum_xattrs; i++) { + if (strcmp(attribs->xattrs[i].name, name) == 0) { + break; + } + } + + if (i == attribs->num_xattrs) { + TALLOC_FREE(rec); + errno = ENOATTR; + return -1; + } + + attribs->xattrs[i] = + attribs->xattrs[attribs->num_xattrs-1]; + attribs->num_xattrs -= 1; + + if (attribs->num_xattrs == 0) { + rec->delete_rec(rec); + TALLOC_FREE(rec); + return 0; + } + + status = ea_tdb_save_attrs(rec, attribs); + + TALLOC_FREE(rec); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("save failed: %s\n", nt_errstr(status))); + return -1; + } + + return 0; +} + +static int ea_tdb_removexattr(struct vfs_handle_struct *handle, + const char *path, const char *name) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + return ea_tdb_removeattr(db, &id, name); +} + +static int ea_tdb_fremovexattr(struct vfs_handle_struct *handle, + struct files_struct *fsp, const char *name) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + return ea_tdb_removeattr(db, &id, name); +} + +/* + * Open the tdb file upon VFS_CONNECT + */ + +static bool ea_tdb_init(int snum, struct db_context **p_db) +{ + struct db_context *db; + const char *dbname; + + dbname = lp_parm_const_string(snum, "ea", "tdb", lock_path("eas.tdb")); + + if (dbname == NULL) { + errno = ENOTSUP; + return false; + } + + become_root(); + db = db_open(NULL, dbname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); + unbecome_root(); + + if (db == NULL) { + errno = ENOTSUP; + return false; + } + + *p_db = db; + return true; +} + +/* + * On unlink we need to delete the tdb record + */ +static int ea_tdb_unlink(vfs_handle_struct *handle, const char *path) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + struct db_record *rec; + int ret; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) { + return -1; + } + + ret = SMB_VFS_NEXT_UNLINK(handle, path); + + if (ret == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + rec = ea_tdb_lock_attrs(talloc_tos(), db, &id); + + /* + * If rec == NULL there's not much we can do about it + */ + + if (rec != NULL) { + rec->delete_rec(rec); + TALLOC_FREE(rec); + } + + return 0; +} + +/* + * On rmdir we need to delete the tdb record + */ +static int ea_tdb_rmdir(vfs_handle_struct *handle, const char *path) +{ + SMB_STRUCT_STAT sbuf; + struct file_id id; + struct db_context *db; + struct db_record *rec; + int ret; + + SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1); + + if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) { + return -1; + } + + ret = SMB_VFS_NEXT_RMDIR(handle, path); + + if (ret == -1) { + return -1; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino); + + rec = ea_tdb_lock_attrs(talloc_tos(), db, &id); + + /* + * If rec == NULL there's not much we can do about it + */ + + if (rec != NULL) { + rec->delete_rec(rec); + TALLOC_FREE(rec); + } + + return 0; +} + +/* + * Destructor for the VFS private data + */ + +static void close_ea_db(void **data) +{ + struct db_context **p_db = (struct db_context **)data; + TALLOC_FREE(*p_db); +} + +static int ea_tdb_connect(vfs_handle_struct *handle, const char *service, + const char *user) +{ + fstring sname; + int res, snum; + struct db_context *db; + + res = SMB_VFS_NEXT_CONNECT(handle, service, user); + if (res < 0) { + return res; + } + + fstrcpy(sname, service); + snum = find_service(sname); + if (snum == -1) { + /* + * Should not happen, but we should not fail just *here*. + */ + return 0; + } + + if (!ea_tdb_init(snum, &db)) { + DEBUG(5, ("Could not init ea tdb\n")); + lp_do_parameter(snum, "ea support", "False"); + return 0; + } + + lp_do_parameter(snum, "ea support", "True"); + + SMB_VFS_HANDLE_SET_DATA(handle, db, close_ea_db, + struct db_context, return -1); + + return 0; +} + +/* VFS operations structure */ + +static const vfs_op_tuple ea_tdb_ops[] = { + {SMB_VFS_OP(ea_tdb_getxattr), SMB_VFS_OP_GETXATTR, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_fgetxattr), SMB_VFS_OP_FGETXATTR, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_setxattr), SMB_VFS_OP_SETXATTR, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_fsetxattr), SMB_VFS_OP_FSETXATTR, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_listxattr), SMB_VFS_OP_LISTXATTR, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_flistxattr), SMB_VFS_OP_FLISTXATTR, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_removexattr), SMB_VFS_OP_REMOVEXATTR, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_fremovexattr), SMB_VFS_OP_FREMOVEXATTR, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_unlink), SMB_VFS_OP_UNLINK, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_rmdir), SMB_VFS_OP_RMDIR, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(ea_tdb_connect), SMB_VFS_OP_CONNECT, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +NTSTATUS vfs_ea_tdb_init(void); +NTSTATUS vfs_ea_tdb_init(void) +{ + return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "ea_tdb", + ea_tdb_ops); +} diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index 86abb15ed1..08bfdf601c 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -186,6 +186,7 @@ cat >$SERVERCONFFILE<