From a00a9e4e2cc30338b4b44109e384f16f5df76f0b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 18 Mar 2009 20:00:28 -0700 Subject: Fix bug #6196 - Unable to serve files with colons to Linux CIFS/VFS client Looks like the pathname parsing for POSIX paths got broken when the code for doing Windows streams parsing got added. Jeremy. --- source3/smbd/reply.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index a743385f7f..8b560bd8ca 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -72,11 +72,16 @@ static NTSTATUS check_path_syntax_internal(char *path, } } - if (!stream_started && *s == ':') { + if (!posix_path && !stream_started && *s == ':') { if (*p_last_component_contains_wcard) { return NT_STATUS_OBJECT_NAME_INVALID; } - /* stream names allow more characters than file names */ + /* Stream names allow more characters than file names. + We're overloading posix_path here to allow a wider + range of characters. If stream_started is true this + is still a Windows path even if posix_path is true. + JRA. + */ stream_started = true; start_of_name_component = false; posix_path = true; -- cgit From 28e03f2011b331ab01b99f9ff6e049f938ec1a00 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 18 Mar 2009 20:56:48 -0700 Subject: Allow DFS client paths to work when POSIX pathnames have been selected (we need to path in pathname /that/look/like/this). Jeremy. --- source3/libsmb/clidfs.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 18e7ab1dec..430807eb7f 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -551,13 +551,23 @@ static char *cli_dfs_make_full_path(TALLOC_CTX *ctx, struct cli_state *cli, const char *dir) { + char path_sep = '\\'; + /* Ensure the extrapath doesn't start with a separator. */ while (IS_DIRECTORY_SEP(*dir)) { dir++; } - return talloc_asprintf(ctx, "\\%s\\%s\\%s", - cli->desthost, cli->share, dir); + if (cli->posix_capabilities & CIFS_UNIX_POSIX_PATHNAMES_CAP) { + path_sep = '/'; + } + return talloc_asprintf(ctx, "%c%s%c%s%c%s", + path_sep, + cli->desthost, + path_sep, + cli->share, + path_sep, + dir); } /******************************************************************** -- cgit From c5394cd7cfd5a234d9ece5bcdf0166652f69234e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 18 Mar 2009 21:49:32 -0700 Subject: Modify simple POSIX open test to use filenames containing a ':' character. Should stop regressions of bug #6196. Jeremy. --- source3/torture/torture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 19849a84a8..6029eb0727 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -4160,8 +4160,8 @@ static bool run_opentest(int dummy) static bool run_simple_posix_open_test(int dummy) { static struct cli_state *cli1; - const char *fname = "\\posix.file"; - const char *dname = "\\posix.dir"; + const char *fname = "\\posix:file"; + const char *dname = "\\posix:dir"; uint16 major, minor; uint32 caplow, caphigh; int fnum1 = -1; -- cgit From 0dfdb7b911ed4fe013fc4a22a8c3a28620277a67 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 19 Mar 2009 09:06:38 +0100 Subject: s3:lib/util_sock: use sys_recv() instead of sys_read() on sockets This ways the pcap support in socket wrapper sees the received data. metze --- source3/lib/util_sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index de5b232aac..a0dbca1a00 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -519,7 +519,7 @@ NTSTATUS read_socket_with_timeout(int fd, char *buf, } while (nread < mincnt) { - readret = sys_read(fd, buf + nread, maxcnt - nread); + readret = sys_recv(fd, buf + nread, maxcnt - nread, 0); if (readret == 0) { DEBUG(5,("read_socket_with_timeout: " @@ -588,7 +588,7 @@ NTSTATUS read_socket_with_timeout(int fd, char *buf, return NT_STATUS_IO_TIMEOUT; } - readret = sys_read(fd, buf+nread, maxcnt-nread); + readret = sys_recv(fd, buf+nread, maxcnt-nread, 0); if (readret == 0) { /* we got EOF on the file descriptor */ -- cgit From 880fbc4e8cd67de73c4bcda94489eb1e1422a04b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 18 Mar 2009 07:56:51 +0100 Subject: s3:libsmb: fix smb signing for fragmented trans/trans2/nttrans requests Before we send the secondary requests we need to remove the old mid=>seqnum mapping and reset cli->mid and make the new mid=>seqnum mapping "persistent". The bug we had in cli_send_trans was this: The first cli_send_smb() incremented cli->mid and the secondary requests used the incremented mid, but as cli->outbuf still had the correct mid, we send the correct mid to the server. The real problem was that the cli_send_smb() function stored the seqnum under the wrong mid. cli_send_nttrans() was totally broken and now follows the same logic as cli_send_trans(). The good thing is that in practice the problem is unlikely to happen, because max_xmit is large enough to avoid secondary requests. metze --- source3/libsmb/clitrans.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'source3') diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index 69e2be3af7..f5794ea04e 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -112,9 +112,6 @@ 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)); - client_set_trans_sign_state_off(cli, mid); - client_set_trans_sign_state_on(cli, mid); - cli_set_message(cli->outbuf,trans==SMBtrans?8:9,0,True); SCVAL(cli->outbuf,smb_com,(trans==SMBtrans ? SMBtranss : SMBtranss2)); @@ -138,20 +135,14 @@ bool cli_send_trans(struct cli_state *cli, int trans, memcpy(outdata,data+tot_data,this_ldata); cli_setup_bcc(cli, outdata+this_ldata); - /* - * Save the mid we're using. We need this for finding - * signing replies. - */ - mid = cli->mid; - show_msg(cli->outbuf); + + client_set_trans_sign_state_off(cli, mid); + cli->mid = mid; if (!cli_send_smb(cli)) { - client_set_trans_sign_state_off(cli, mid); return False; } - - /* Ensure we use the same mid for the secondaries. */ - cli->mid = mid; + client_set_trans_sign_state_on(cli, mid); tot_data += this_ldata; tot_param += this_lparam; @@ -461,21 +452,14 @@ bool cli_send_nt_trans(struct cli_state *cli, memcpy(outdata,data+tot_data,this_ldata); cli_setup_bcc(cli, outdata+this_ldata); - /* - * Save the mid we're using. We need this for finding - * signing replies. - */ - mid = cli->mid; - show_msg(cli->outbuf); + client_set_trans_sign_state_off(cli, mid); + cli->mid = mid; if (!cli_send_smb(cli)) { - client_set_trans_sign_state_off(cli, mid); return False; } - - /* Ensure we use the same mid for the secondaries. */ - cli->mid = mid; + client_set_trans_sign_state_on(cli, mid); tot_data += this_ldata; tot_param += this_lparam; -- cgit From 88dd6af605dc5754b7e146a068272d37651da710 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 18 Mar 2009 08:46:38 +0100 Subject: s3:libsmb: always create bytes array in cli_trans code Otherwise we return NO_MEMORY without a reason for fragmented trans requests, as talloc_append_blob() returns buf if we append a 0 length blob. When we pass buf = NULL we'll get back NULL and then assume NO_MEMORY... metze --- source3/libsmb/clitrans.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'source3') diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index f5794ea04e..0266c0307e 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -731,6 +731,7 @@ static struct async_req *cli_ship_trans(TALLOC_CTX *mem_ctx, uint16_t this_data = 0; uint32_t useable_space; uint8_t cmd; + uint8_t pad[3]; frame = talloc_stackframe(); @@ -743,9 +744,16 @@ static struct async_req *cli_ship_trans(TALLOC_CTX *mem_ctx, param_offset = smb_size - 4; + bytes = TALLOC_ARRAY(talloc_tos(), uint8_t, 0); /* padding */ + if (bytes == NULL) { + goto fail; + } + switch (cmd) { case SMBtrans: - bytes = TALLOC_ZERO_P(talloc_tos(), uint8_t); /* padding */ + pad[0] = 0; + bytes = (uint8_t *)talloc_append_blob(talloc_tos(), bytes, + data_blob_const(pad, 1)); if (bytes == NULL) { goto fail; } @@ -759,13 +767,14 @@ static struct async_req *cli_ship_trans(TALLOC_CTX *mem_ctx, param_offset += talloc_get_size(bytes); break; case SMBtrans2: - bytes = TALLOC_ARRAY(talloc_tos(), uint8_t, 3); /* padding */ + pad[0] = 0; + pad[1] = 'D'; /* Copy this from "old" 3.0 behaviour */ + pad[2] = ' '; + bytes = (uint8_t *)talloc_append_blob(talloc_tos(), bytes, + data_blob_const(pad, 3)); if (bytes == NULL) { goto fail; } - bytes[0] = 0; - bytes[1] = 'D'; /* Copy this from "old" 3.0 behaviour */ - bytes[2] = ' '; wct = 14 + state->num_setup; param_offset += talloc_get_size(bytes); break; -- cgit From 011ad7245d53a716c4c766f5ef8d317bb3a53d0f Mon Sep 17 00:00:00 2001 From: Björn Jacke Date: Mon, 16 Mar 2009 01:51:09 +0100 Subject: fix build on old Heimdal based systems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- source3/libads/krb5_errs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source3') diff --git a/source3/libads/krb5_errs.c b/source3/libads/krb5_errs.c index 53023cc75a..0e03ebb90d 100644 --- a/source3/libads/krb5_errs.c +++ b/source3/libads/krb5_errs.c @@ -30,12 +30,10 @@ static const struct { {KRB5KDC_ERR_CLIENT_REVOKED, NT_STATUS_ACCESS_DENIED}, {KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN, NT_STATUS_INVALID_ACCOUNT_NAME}, {KRB5KDC_ERR_ETYPE_NOSUPP, NT_STATUS_LOGON_FAILURE}, -#if defined(KRB5KDC_ERR_KEY_EXPIRED) /* Heimdal */ - {KRB5KDC_ERR_KEY_EXPIRED, NT_STATUS_PASSWORD_EXPIRED}, -#elif defined(KRB5KDC_ERR_KEY_EXP) /* MIT */ +#if defined(KRB5KDC_ERR_KEY_EXP) /* MIT */ {KRB5KDC_ERR_KEY_EXP, NT_STATUS_PASSWORD_EXPIRED}, -#else -#error Neither KRB5KDC_ERR_KEY_EXPIRED nor KRB5KDC_ERR_KEY_EXP available +#else /* old Heimdal releases have it with different name only in an enum: */ + {KRB5KDC_ERR_KEY_EXPIRED, NT_STATUS_PASSWORD_EXPIRED}, #endif {25, NT_STATUS_PASSWORD_EXPIRED}, /* FIXME: bug in heimdal 0.7 krb5_get_init_creds_password (Inappropriate ioctl for device (25)) */ {KRB5KDC_ERR_NULL_KEY, NT_STATUS_LOGON_FAILURE}, -- cgit From 4508152282758bfa60b5ab55038359fc837a2609 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 24 Feb 2009 18:27:45 +0100 Subject: s3:build: compile lib/tsocket and libcli/cldap metze --- source3/Makefile.in | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/Makefile.in b/source3/Makefile.in index e3b46ada4d..a7fc01de56 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -448,7 +448,19 @@ LIBSAMBA_OBJ = $(LIBSMB_OBJ0) \ LIBCLI_LDAP_MESSAGE_OBJ = ../libcli/ldap/ldap_message.o LIBCLI_LDAP_NDR_OBJ = ../libcli/ldap/ldap_ndr.o -CLDAP_OBJ = libads/cldap.o $(LIBCLI_LDAP_MESSAGE_OBJ) $(LIBCLI_LDAP_NDR_OBJ) +LIBTSOCKET_OBJ = ../lib/tsocket/tsocket.o \ + ../lib/tsocket/tsocket_helpers.o \ + ../lib/tsocket/tsocket_bsd.o \ + ../lib/tsocket/tsocket_recvfrom.o \ + ../lib/tsocket/tsocket_sendto.o \ + ../lib/tsocket/tsocket_connect.o \ + ../lib/tsocket/tsocket_writev.o \ + ../lib/tsocket/tsocket_readv.o + +CLDAP_OBJ = libads/cldap.o \ + ../libcli/cldap/cldap.o \ + ../lib/util/idtree.o \ + $(LIBCLI_LDAP_MESSAGE_OBJ) $(LIBCLI_LDAP_NDR_OBJ) $(LIBTSOCKET_OBJ) LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \ libsmb/clikrb5.o libsmb/clispnego.o ../lib/util/asn1.o \ -- cgit From 18b4925031f7b378fdd3cde0cb90d48ff967cdc3 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 24 Feb 2009 19:05:33 +0100 Subject: s3:libads: use libcli/cldap code metze --- source3/libads/cldap.c | 296 +++++++++++-------------------------------------- 1 file changed, 67 insertions(+), 229 deletions(-) (limited to 'source3') diff --git a/source3/libads/cldap.c b/source3/libads/cldap.c index d66e35cacb..d941ba60cd 100644 --- a/source3/libads/cldap.c +++ b/source3/libads/cldap.c @@ -4,6 +4,7 @@ Copyright (C) 2001 Andrew Tridgell (tridge@samba.org) Copyright (C) 2003 Jim McDonough (jmcd@us.ibm.com) Copyright (C) 2008 Guenther Deschner (gd@samba.org) + Copyright (C) 2009 Stefan Metzmacher (metze@samba.org) 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,221 +21,8 @@ */ #include "includes.h" - -/* - do a cldap netlogon query -*/ -static int send_cldap_netlogon(TALLOC_CTX *mem_ctx, int sock, const char *domain, - const char *hostname, unsigned ntversion) -{ - ASN1_DATA *data; - char ntver[4]; -#ifdef CLDAP_USER_QUERY - char aac[4]; - - SIVAL(aac, 0, 0x00000180); -#endif - SIVAL(ntver, 0, ntversion); - - data = asn1_init(mem_ctx); - if (data == NULL) { - return -1; - } - - asn1_push_tag(data,ASN1_SEQUENCE(0)); - asn1_write_Integer(data, 4); - asn1_push_tag(data, ASN1_APPLICATION(3)); - asn1_write_OctetString(data, NULL, 0); - asn1_write_enumerated(data, 0); - asn1_write_enumerated(data, 0); - asn1_write_Integer(data, 0); - asn1_write_Integer(data, 0); - asn1_write_BOOLEAN(data, False); - asn1_push_tag(data, ASN1_CONTEXT(0)); - - if (domain) { - asn1_push_tag(data, ASN1_CONTEXT(3)); - asn1_write_OctetString(data, "DnsDomain", 9); - asn1_write_OctetString(data, domain, strlen(domain)); - asn1_pop_tag(data); - } - - asn1_push_tag(data, ASN1_CONTEXT(3)); - asn1_write_OctetString(data, "Host", 4); - asn1_write_OctetString(data, hostname, strlen(hostname)); - asn1_pop_tag(data); - -#ifdef CLDAP_USER_QUERY - asn1_push_tag(data, ASN1_CONTEXT(3)); - asn1_write_OctetString(data, "User", 4); - asn1_write_OctetString(data, "SAMBA$", 6); - asn1_pop_tag(data); - - asn1_push_tag(data, ASN1_CONTEXT(3)); - asn1_write_OctetString(data, "AAC", 4); - asn1_write_OctetString(data, aac, 4); - asn1_pop_tag(data); -#endif - - asn1_push_tag(data, ASN1_CONTEXT(3)); - asn1_write_OctetString(data, "NtVer", 5); - asn1_write_OctetString(data, ntver, 4); - asn1_pop_tag(data); - - asn1_pop_tag(data); - - asn1_push_tag(data,ASN1_SEQUENCE(0)); - asn1_write_OctetString(data, "NetLogon", 8); - asn1_pop_tag(data); - asn1_pop_tag(data); - asn1_pop_tag(data); - - if (data->has_error) { - DEBUG(2,("Failed to build cldap netlogon at offset %d\n", (int)data->ofs)); - asn1_free(data); - return -1; - } - - if (write(sock, data->data, data->length) != (ssize_t)data->length) { - DEBUG(2,("failed to send cldap query (%s)\n", strerror(errno))); - asn1_free(data); - return -1; - } - - asn1_free(data); - - return 0; -} - -/* - receive a cldap netlogon reply -*/ -static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx, - int sock, - uint32_t nt_version, - struct netlogon_samlogon_response **reply) -{ - int ret; - ASN1_DATA *data; - DATA_BLOB blob = data_blob_null; - DATA_BLOB os1 = data_blob_null; - DATA_BLOB os2 = data_blob_null; - DATA_BLOB os3 = data_blob_null; - int i1; - struct netlogon_samlogon_response *r = NULL; - NTSTATUS status; - - fd_set r_fds; - struct timeval timeout; - - blob = data_blob(NULL, 8192); - if (blob.data == NULL) { - DEBUG(1, ("data_blob failed\n")); - errno = ENOMEM; - return -1; - } - - FD_ZERO(&r_fds); - FD_SET(sock, &r_fds); - - /* - * half the time of a regular ldap timeout, not less than 3 seconds. - */ - timeout.tv_sec = MAX(3,lp_ldap_timeout()/2); - timeout.tv_usec = 0; - - ret = sys_select(sock+1, &r_fds, NULL, NULL, &timeout); - if (ret == -1) { - DEBUG(10, ("select failed: %s\n", strerror(errno))); - data_blob_free(&blob); - return -1; - } - - if (ret == 0) { - DEBUG(1,("no reply received to cldap netlogon\n")); - data_blob_free(&blob); - return -1; - } - - ret = read(sock, blob.data, blob.length); - if (ret <= 0) { - DEBUG(1,("no reply received to cldap netlogon\n")); - data_blob_free(&blob); - return -1; - } - blob.length = ret; - - data = asn1_init(mem_ctx); - if (data == NULL) { - data_blob_free(&blob); - return -1; - } - - asn1_load(data, blob); - asn1_start_tag(data, ASN1_SEQUENCE(0)); - asn1_read_Integer(data, &i1); - asn1_start_tag(data, ASN1_APPLICATION(4)); - asn1_read_OctetString(data, NULL, &os1); - asn1_start_tag(data, ASN1_SEQUENCE(0)); - asn1_start_tag(data, ASN1_SEQUENCE(0)); - asn1_read_OctetString(data, NULL, &os2); - asn1_start_tag(data, ASN1_SET); - asn1_read_OctetString(data, NULL, &os3); - asn1_end_tag(data); - asn1_end_tag(data); - asn1_end_tag(data); - asn1_end_tag(data); - asn1_end_tag(data); - - if (data->has_error) { - data_blob_free(&blob); - data_blob_free(&os1); - data_blob_free(&os2); - data_blob_free(&os3); - asn1_free(data); - DEBUG(1,("Failed to parse cldap reply\n")); - return -1; - } - - r = TALLOC_ZERO_P(mem_ctx, struct netlogon_samlogon_response); - if (!r) { - errno = ENOMEM; - data_blob_free(&os1); - data_blob_free(&os2); - data_blob_free(&os3); - data_blob_free(&blob); - asn1_free(data); - return -1; - } - - status = pull_netlogon_samlogon_response(&os3, mem_ctx, NULL, r); - if (!NT_STATUS_IS_OK(status)) { - data_blob_free(&os1); - data_blob_free(&os2); - data_blob_free(&os3); - data_blob_free(&blob); - asn1_free(data); - TALLOC_FREE(r); - return -1; - } - - map_netlogon_samlogon_response(r); - - data_blob_free(&os1); - data_blob_free(&os2); - data_blob_free(&os3); - data_blob_free(&blob); - - asn1_free(data); - - if (reply) { - *reply = r; - } else { - TALLOC_FREE(r); - } - - return 0; -} +#include "../libcli/cldap/cldap.h" +#include "../lib/tsocket/tsocket.h" /******************************************************************* do a cldap netlogon query. Always 389/udp @@ -244,31 +32,81 @@ bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *server, const char *realm, uint32_t nt_version, - struct netlogon_samlogon_response **reply) + struct netlogon_samlogon_response **_reply) { - int sock; + struct cldap_socket *cldap; + struct cldap_netlogon io; + struct netlogon_samlogon_response *reply; + NTSTATUS status; + struct in_addr addr; + char addrstr[INET_ADDRSTRLEN]; + const char *dest_str; int ret; + struct tsocket_address *dest_addr; - sock = open_udp_socket(server, LDAP_PORT ); - if (sock == -1) { - DEBUG(2,("ads_cldap_netlogon: Failed to open udp socket to %s\n", + addr = interpret_addr2(server); + dest_str = inet_ntop(AF_INET, &addr, + addrstr, sizeof(addrstr)); + if (!dest_str) { + DEBUG(2,("Failed to resolve[%s] into an address for cldap\n", server)); - return False; + return false; } - ret = send_cldap_netlogon(mem_ctx, sock, realm, global_myname(), nt_version); + ret = tsocket_address_inet_from_strings(mem_ctx, "ipv4", + dest_str, LDAP_PORT, + &dest_addr); if (ret != 0) { - close(sock); - return False; + status = map_nt_error_from_unix(errno); + DEBUG(2,("Failed to create cldap tsocket_address for %s - %s\n", + dest_str, nt_errstr(status))); + return false; + } + + /* + * as we use a connected udp socket + */ + status = cldap_socket_init(mem_ctx, NULL, NULL, dest_addr, &cldap); + TALLOC_FREE(dest_addr); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(2,("Failed to create cldap socket to %s: %s\n", + dest_str, nt_errstr(status))); + return false; } - ret = recv_cldap_netlogon(mem_ctx, sock, nt_version, reply); - close(sock); - if (ret == -1) { - return False; + reply = talloc(cldap, struct netlogon_samlogon_response); + if (!reply) { + goto failed; } - return True; + /* + * as we use a connected socket, so we don't need to specify the + * destination + */ + io.in.dest_address = NULL; + io.in.dest_port = 0; + io.in.realm = realm; + io.in.host = NULL; + io.in.user = NULL; + io.in.domain_guid = NULL; + io.in.domain_sid = NULL; + io.in.acct_control = 0; + io.in.version = nt_version; + io.in.map_response = false; + + status = cldap_netlogon(cldap, NULL, reply, &io); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(2,("cldap_netlogon() failed: %s\n", nt_errstr(status))); + goto failed; + } + + *reply = io.out.netlogon; + *_reply = talloc_move(mem_ctx, &reply); + TALLOC_FREE(cldap); + return true; +failed: + TALLOC_FREE(cldap); + return false; } /******************************************************************* -- cgit From f603903cb01f0c1e8bba66ab8c5229c3e7724ae3 Mon Sep 17 00:00:00 2001 From: Dan Sledz Date: Thu, 19 Mar 2009 21:53:34 +0000 Subject: s3: Fix a free of an uninitialized variable in winbind_get_sid_aliases --- source3/lib/winbind_util.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3') diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 64f5fb421a..df095b9e91 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -322,7 +322,6 @@ bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx, &rids, &num_rids); if (ret != WBC_ERR_SUCCESS) { - wbcFreeMemory(rids); return false; } -- cgit From d813a90d1887958085adf92c88359dc866c656ad Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 19 Mar 2009 23:55:21 +0100 Subject: version: fix handling of SAMBA_VERSION_VENDOR_PATCH. We need a string version of this, or else version.c does not compile. Michael --- source3/script/mkversion.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/script/mkversion.sh b/source3/script/mkversion.sh index a55aafcd0c..ce9d2af4c0 100755 --- a/source3/script/mkversion.sh +++ b/source3/script/mkversion.sh @@ -112,6 +112,7 @@ if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_SUFFIX}" if test -n "${SAMBA_VERSION_VENDOR_PATCH}";then echo "#define SAMBA_VERSION_VENDOR_PATCH ${SAMBA_VERSION_VENDOR_PATCH}" >> $OUTPUT_FILE + echo "#define SAMBA_VERSION_VENDOR_PATCH_STRING \"${SAMBA_VERSION_VENDOR_PATCH}\"" >> $OUTPUT_FILE SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_PATCH}" fi fi @@ -130,7 +131,7 @@ cat >>$OUTPUT_FILE< Date: Thu, 19 Mar 2009 23:56:12 +0100 Subject: add a versiontest program to print samba_version_string(). This is to allow for testing samba_version_string() without the need to compile any of the larger binaries like smbd or net... Michael --- source3/Makefile.in | 4 ++++ source3/lib/version_test.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 source3/lib/version_test.c (limited to 'source3') diff --git a/source3/Makefile.in b/source3/Makefile.in index a7fc01de56..cf74182f27 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1641,6 +1641,10 @@ bin/ldbrename: $(BINARY_PREREQS) $(LDBRENAME_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED $(LIBS) $(POPT_LIBS) $(LDAP_LIBS) \ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) +bin/versiontest: $(BINARY_PREREQS) lib/version_test.o $(VERSION_OBJ) + @echo Linking $@ + @$(CC) $(FLAGS) -o $@ $(VERSION_OBJ) lib/version_test.o + ##################################################################### # diff --git a/source3/lib/version_test.c b/source3/lib/version_test.c new file mode 100644 index 0000000000..880cfeb084 --- /dev/null +++ b/source3/lib/version_test.c @@ -0,0 +1,26 @@ +/* + * Unix SMB/CIFS implementation. + * version_test - test program for samba_version_strion() + * Copyright (C) Michael Adam 2009 + * + * 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" + +int main(void) +{ + printf("%s\n", samba_version_string()); + return 0; +} -- cgit