[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-4458-ga968273
Günther Deschner
gd at samba.org
Thu Nov 20 18:42:13 GMT 2008
The branch, v3-3-test has been updated
via a9682737efb7bf931a7d54e671fa17b2c9dfac5e (commit)
via cae36caaaea944bf18a0d956da2d241c0fe563b5 (commit)
via 8ea883bfda3671009d37c94ca638e40cbfb94311 (commit)
via 47a25d1723cae31a8b5ad2a50f1a8fc98a270b5a (commit)
via 9f23e65bdd011ba0d632ef70dfa057af84c9cbe0 (commit)
via 9732c5e0f86c9c4c156a951dbfd26ddd43395088 (commit)
from 113c5d28edabdd17a2507e68aad612aa21c758f3 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit a9682737efb7bf931a7d54e671fa17b2c9dfac5e
Author: Günther Deschner <gd at samba.org>
Date: Wed Nov 19 17:20:44 2008 +0100
The IRIX compiler does not like embedded unnamed unions.
commit cae36caaaea944bf18a0d956da2d241c0fe563b5
Author: Günther Deschner <gd at samba.org>
Date: Wed Sep 24 09:05:37 2008 +0200
s3-nbt: remove double nbt netlogon opcodes.
Guenther
(cherry picked from commit 81fde585516957b6a7742e0168c68df33572ed74)
commit 8ea883bfda3671009d37c94ca638e40cbfb94311
Author: Günther Deschner <gd at samba.org>
Date: Tue Sep 23 21:08:25 2008 +0200
s3: fix all mailslot/nbt/cldap callers.
Guenther
commit 47a25d1723cae31a8b5ad2a50f1a8fc98a270b5a
Author: Günther Deschner <gd at samba.org>
Date: Wed Nov 19 15:40:50 2008 +0100
s3: copy nbt/netlogon helper from s4.
Guenther
commit 9f23e65bdd011ba0d632ef70dfa057af84c9cbe0
Author: Günther Deschner <gd at samba.org>
Date: Tue Sep 23 08:58:37 2008 +0200
s3: re-run make idl.
Guenther
commit 9732c5e0f86c9c4c156a951dbfd26ddd43395088
Author: Günther Deschner <gd at samba.org>
Date: Tue Sep 23 08:31:34 2008 +0200
s3-nbt: full merge of s4 nbt idl.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/Makefile.in | 2 +
source/include/includes.h | 1 +
source/include/nameserv.h | 11 -
source/include/proto.h | 100 +--
source/libads/cldap.c | 119 +--
source/libads/ldap.c | 2 +-
source/libcli/nbt/nbtname.c | 21 +
source/libcli/ndr_netlogon.c | 210 +++
source/libcli/ndr_netlogon_proto.h | 24 +
source/libcli/netlogon.c | 251 +++
source/libcli/netlogon.h | 54 +
source/libcli/netlogon_proto.h | 28 +
source/librpc/gen_ndr/nbt.h | 358 ++---
source/librpc/gen_ndr/ndr_nbt.c | 2599 +++++++------------------------
source/librpc/gen_ndr/ndr_nbt.h | 67 +-
source/librpc/idl/nbt.idl | 423 ++----
source/libsmb/clidgram.c | 91 +-
source/libsmb/dsgetdcname.c | 416 +----
source/nmbd/nmbd_processlogon.c | 30 +-
source/utils/net_ads.c | 16 +-
source/winbindd/idmap_adex/gc_util.c | 2 +-
source/winbindd/idmap_adex/idmap_adex.h | 2 +-
source/winbindd/winbindd_cm.c | 2 +-
23 files changed, 1618 insertions(+), 3211 deletions(-)
create mode 100644 source/libcli/ndr_netlogon.c
create mode 100644 source/libcli/ndr_netlogon_proto.h
create mode 100644 source/libcli/netlogon.c
create mode 100644 source/libcli/netlogon.h
create mode 100644 source/libcli/netlogon_proto.h
Changeset truncated at 500 lines:
diff --git a/source/Makefile.in b/source/Makefile.in
index 685c688..c77aea4 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -389,6 +389,8 @@ LIBADS_SERVER_OBJ = libads/kerberos_verify.o libads/authdata.o \
SECRETS_OBJ = passdb/secrets.o passdb/machine_sid.o
LIBNBT_OBJ = libcli/nbt/nbtname.o \
+ libcli/ndr_netlogon.o \
+ libcli/netlogon.o \
librpc/gen_ndr/ndr_nbt.o \
librpc/gen_ndr/ndr_svcctl.o
diff --git a/source/include/includes.h b/source/include/includes.h
index 958e7cb..ea0af9f 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -702,6 +702,7 @@ typedef char fstring[FSTRING_LEN];
#include "rpc_perfcount_defs.h"
#include "librpc/gen_ndr/notify.h"
#include "librpc/gen_ndr/xattr.h"
+#include "librpc/gen_ndr/ndr_nbt.h"
#include "librpc/rpc/dcerpc.h"
#include "nt_printing.h"
#include "idmap.h"
diff --git a/source/include/nameserv.h b/source/include/nameserv.h
index 4377e33..a7d46e7 100644
--- a/source/include/nameserv.h
+++ b/source/include/nameserv.h
@@ -539,17 +539,6 @@ struct packet_struct
} packet;
};
-/* NETLOGON opcodes */
-
-#define QUERYFORPDC 7 /* Query for PDC. */
-#define SAM_UAS_CHANGE 10 /* Announce change to UAS or SAM. */
-#define QUERYFORPDC_R 12 /* Response to Query for PDC. */
-#define SAMLOGON 18
-#define SAMLOGON_R 19
-#define SAMLOGON_UNK_R 21
-#define SAMLOGON_AD_UNK_R 23
-#define SAMLOGON_AD_R 25
-
/* Ids for netbios packet types. */
#define ANN_HostAnnouncement 1
diff --git a/source/include/proto.h b/source/include/proto.h
index a147ae5..508c96e 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -1938,20 +1938,15 @@ NTSTATUS kerberos_return_info3_from_pac(TALLOC_CTX *mem_ctx,
struct netr_SamInfo3 **info3);
/* The following definitions come from libads/cldap.c */
-
bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
const char *server,
const char *realm,
- uint32_t *nt_version,
- union nbt_cldap_netlogon **reply);
+ uint32_t nt_version,
+ struct netlogon_samlogon_response **reply);
bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx,
const char *server,
const char *realm,
- struct nbt_cldap_netlogon_5 *reply5);
-bool pull_mailslot_cldap_reply(TALLOC_CTX *mem_ctx,
- const DATA_BLOB *blob,
- union nbt_cldap_netlogon *r,
- uint32_t *nt_version);
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX *reply5);
/* The following definitions come from libads/disp_sec.c */
@@ -2882,93 +2877,6 @@ _PUBLIC_ enum ndr_err_code ndr_push_samr_RejectReason(struct ndr_push *ndr, int
_PUBLIC_ enum ndr_err_code ndr_pull_samr_RejectReason(struct ndr_pull *ndr, int ndr_flags, enum samr_RejectReason *r);
_PUBLIC_ void ndr_print_samr_RejectReason(struct ndr_print *ndr, const char *name, enum samr_RejectReason r);
-/* The following definitions come from librpc/gen_ndr/ndr_nbt.c */
-
-_PUBLIC_ void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r);
-_PUBLIC_ void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r);
-_PUBLIC_ void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r);
-_PUBLIC_ void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r);
-_PUBLIC_ void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r);
-_PUBLIC_ void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r);
-_PUBLIC_ void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r);
-_PUBLIC_ void ndr_print_nbt_rdata_address(struct ndr_print *ndr, const char *name, const struct nbt_rdata_address *r);
-_PUBLIC_ void ndr_print_nbt_rdata_netbios(struct ndr_print *ndr, const char *name, const struct nbt_rdata_netbios *r);
-_PUBLIC_ void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const struct nbt_statistics *r);
-_PUBLIC_ void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r);
-_PUBLIC_ void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r);
-_PUBLIC_ void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r);
-_PUBLIC_ void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r);
-_PUBLIC_ void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r);
-_PUBLIC_ void ndr_print_nbt_name_packet(struct ndr_print *ndr, const char *name, const struct nbt_name_packet *r);
-_PUBLIC_ void ndr_print_dgram_msg_type(struct ndr_print *ndr, const char *name, enum dgram_msg_type r);
-_PUBLIC_ void ndr_print_dgram_flags(struct ndr_print *ndr, const char *name, uint8_t r);
-_PUBLIC_ void ndr_print_smb_command(struct ndr_print *ndr, const char *name, enum smb_command r);
-_PUBLIC_ void ndr_print_smb_trans_body(struct ndr_print *ndr, const char *name, const struct smb_trans_body *r);
-_PUBLIC_ void ndr_print_smb_body(struct ndr_print *ndr, const char *name, const union smb_body *r);
-_PUBLIC_ enum ndr_err_code ndr_push_dgram_smb_packet(struct ndr_push *ndr, int ndr_flags, const struct dgram_smb_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_dgram_smb_packet(struct ndr_pull *ndr, int ndr_flags, struct dgram_smb_packet *r);
-_PUBLIC_ void ndr_print_dgram_smb_packet(struct ndr_print *ndr, const char *name, const struct dgram_smb_packet *r);
-_PUBLIC_ void ndr_print_dgram_message_body(struct ndr_print *ndr, const char *name, const union dgram_message_body *r);
-_PUBLIC_ void ndr_print_dgram_message(struct ndr_print *ndr, const char *name, const struct dgram_message *r);
-_PUBLIC_ void ndr_print_dgram_err_code(struct ndr_print *ndr, const char *name, enum dgram_err_code r);
-_PUBLIC_ void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union dgram_data *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r);
-_PUBLIC_ void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_command(struct ndr_print *ndr, const char *name, enum nbt_netlogon_command r);
-_PUBLIC_ void ndr_print_nbt_netlogon_version(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc2 *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r);
-_PUBLIC_ void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_nbt_dc_sock_addr(struct ndr_print *ndr, const char *name, const struct nbt_dc_sock_addr *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc2 *r);
-_PUBLIC_ void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, const struct nbt_db_change *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_announce_uas *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_1(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_1 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_3(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_3 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_5(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_5 *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_5(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_5 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_5(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_5 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_13(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_13 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_15(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_15 *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_15(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_15 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_15(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_15 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_29(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_29 *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_29(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_29 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_29(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_29 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon(struct ndr_push *ndr, int ndr_flags, const union nbt_cldap_netlogon *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon(struct ndr_pull *ndr, int ndr_flags, union nbt_cldap_netlogon *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon(struct ndr_print *ndr, const char *name, const union nbt_cldap_netlogon *r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_command(struct ndr_print *ndr, const char *name, enum nbt_ntlogon_command r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon *r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon_reply(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon_reply *r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_request(struct ndr_print *ndr, const char *name, const union nbt_ntlogon_request *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_ntlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_ntlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_packet *r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_packet *r);
-_PUBLIC_ void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r);
-_PUBLIC_ void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r);
-_PUBLIC_ void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r);
-_PUBLIC_ void ndr_print_nbt_browse_election_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_election_request *r);
-_PUBLIC_ void ndr_print_nbt_browse_backup_list_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_request *r);
-_PUBLIC_ void ndr_print_nbt_browse_backup_list_response(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_response *r);
-_PUBLIC_ void ndr_print_nbt_browse_become_backup(struct ndr_print *ndr, const char *name, const struct nbt_browse_become_backup *r);
-_PUBLIC_ void ndr_print_nbt_browse_domain_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_domain_announcement *r);
-_PUBLIC_ void ndr_print_nbt_browse_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_master_announcement *r);
-_PUBLIC_ void ndr_print_nbt_browse_reset_state(struct ndr_print *ndr, const char *name, const struct nbt_browse_reset_state *r);
-_PUBLIC_ void ndr_print_nbt_browse_local_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_local_master_announcement *r);
-_PUBLIC_ void ndr_print_nbt_browse_payload(struct ndr_print *ndr, const char *name, const union nbt_browse_payload *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_browse_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_browse_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_packet *r);
-_PUBLIC_ void ndr_print_nbt_browse_packet(struct ndr_print *ndr, const char *name, const struct nbt_browse_packet *r);
-
/* The following definitions come from librpc/gen_ndr/ndr_netlogon.c */
_PUBLIC_ void ndr_print_netr_UasInfo(struct ndr_print *ndr, const char *name, const struct netr_UasInfo *r);
@@ -4339,7 +4247,7 @@ bool receive_getdc_response(TALLOC_CTX *mem_ctx,
const char *domain_name,
uint32_t *nt_version,
const char **dc_name,
- union nbt_cldap_netlogon **reply);
+ struct netlogon_samlogon_response **reply);
/* The following definitions come from libsmb/clientgen.c */
diff --git a/source/libads/cldap.c b/source/libads/cldap.c
index 1156506..aa39531 100644
--- a/source/libads/cldap.c
+++ b/source/libads/cldap.c
@@ -119,8 +119,8 @@ static void gotalarm_sig(void)
*/
static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
int sock,
- uint32_t *nt_version,
- union nbt_cldap_netlogon **reply)
+ uint32_t nt_version,
+ struct netlogon_samlogon_response **reply)
{
int ret;
ASN1_DATA data;
@@ -131,7 +131,8 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
int i1;
/* half the time of a regular ldap timeout, not less than 3 seconds. */
unsigned int al_secs = MAX(3,lp_ldap_timeout()/2);
- union nbt_cldap_netlogon *r = NULL;
+ struct netlogon_samlogon_response *r = NULL;
+ NTSTATUS status;
blob = data_blob(NULL, 8192);
if (blob.data == NULL) {
@@ -185,7 +186,7 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
return -1;
}
- r = TALLOC_ZERO_P(mem_ctx, union nbt_cldap_netlogon);
+ r = TALLOC_ZERO_P(mem_ctx, struct netlogon_samlogon_response);
if (!r) {
errno = ENOMEM;
data_blob_free(&os1);
@@ -195,7 +196,8 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
return -1;
}
- if (!pull_mailslot_cldap_reply(mem_ctx, &os3, r, nt_version)) {
+ status = pull_netlogon_samlogon_response(&os3, mem_ctx, r);
+ if (!NT_STATUS_IS_OK(status)) {
data_blob_free(&os1);
data_blob_free(&os2);
data_blob_free(&os3);
@@ -204,6 +206,8 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
return -1;
}
+ map_netlogon_samlogon_response(r);
+
data_blob_free(&os1);
data_blob_free(&os2);
data_blob_free(&os3);
@@ -227,8 +231,8 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
const char *server,
const char *realm,
- uint32_t *nt_version,
- union nbt_cldap_netlogon **reply)
+ uint32_t nt_version,
+ struct netlogon_samlogon_response **reply)
{
int sock;
int ret;
@@ -240,7 +244,7 @@ bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
return False;
}
- ret = send_cldap_netlogon(sock, realm, global_myname(), *nt_version);
+ ret = send_cldap_netlogon(sock, realm, global_myname(), nt_version);
if (ret != 0) {
close(sock);
return False;
@@ -262,107 +266,24 @@ bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx,
const char *server,
const char *realm,
- struct nbt_cldap_netlogon_5 *reply5)
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX *reply5)
{
- uint32_t nt_version = NETLOGON_VERSION_5 | NETLOGON_VERSION_5EX;
- union nbt_cldap_netlogon *reply = NULL;
+ uint32_t nt_version = NETLOGON_NT_VERSION_5 | NETLOGON_NT_VERSION_5EX;
+ struct netlogon_samlogon_response *reply = NULL;
bool ret;
- ret = ads_cldap_netlogon(mem_ctx, server, realm, &nt_version, &reply);
+ ret = ads_cldap_netlogon(mem_ctx, server, realm, nt_version, &reply);
if (!ret) {
return false;
}
- if (nt_version != (NETLOGON_VERSION_5 | NETLOGON_VERSION_5EX)) {
+ if (reply->ntver != NETLOGON_NT_VERSION_5EX) {
+ DEBUG(0,("ads_cldap_netlogon_5: nt_version mismatch: 0x%08x\n",
+ reply->ntver));
return false;
}
- *reply5 = reply->logon5;
-
- return true;
-}
-
-/****************************************************************
-****************************************************************/
-
-bool pull_mailslot_cldap_reply(TALLOC_CTX *mem_ctx,
- const DATA_BLOB *blob,
- union nbt_cldap_netlogon *r,
- uint32_t *nt_version)
-{
- enum ndr_err_code ndr_err;
- uint32_t nt_version_query = ((*nt_version) & 0x0000001f);
- uint16_t command = 0;
-
- ndr_err = ndr_pull_struct_blob(blob, mem_ctx, &command,
- (ndr_pull_flags_fn_t)ndr_pull_uint16);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- return false;
- }
-
- switch (command) {
- case 0x13: /* 19 */
- case 0x15: /* 21 */
- case 0x17: /* 23 */
- case 0x19: /* 25 */
- break;
- default:
- DEBUG(1,("got unexpected command: %d (0x%08x)\n",
- command, command));
- return false;
- }
-
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
-
- /* when the caller requested just those nt_version bits that the server
- * was able to reply to, we are fine and all done. otherwise we need to
- * assume downgraded replies which are painfully parsed here - gd */
-
- if (nt_version_query & NETLOGON_VERSION_WITH_CLOSEST_SITE) {
- nt_version_query &= ~NETLOGON_VERSION_WITH_CLOSEST_SITE;
- }
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
- if (nt_version_query & NETLOGON_VERSION_5EX_WITH_IP) {
- nt_version_query &= ~NETLOGON_VERSION_5EX_WITH_IP;
- }
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
- if (nt_version_query & NETLOGON_VERSION_5EX) {
- nt_version_query &= ~NETLOGON_VERSION_5EX;
- }
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
- if (nt_version_query & NETLOGON_VERSION_5) {
- nt_version_query &= ~NETLOGON_VERSION_5;
- }
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
-
- return false;
-
- done:
- if (DEBUGLEVEL >= 10) {
- NDR_PRINT_UNION_DEBUG(nbt_cldap_netlogon, nt_version_query, r);
- }
-
- *nt_version = nt_version_query;
+ *reply5 = reply->data.nt5_ex;
return true;
}
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index 97e802a..095e5f9 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -176,7 +176,7 @@ bool ads_closest_dc(ADS_STRUCT *ads)
static bool ads_try_connect(ADS_STRUCT *ads, const char *server, bool gc)
{
char *srv;
- struct nbt_cldap_netlogon_5 cldap_reply;
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX cldap_reply;
TALLOC_CTX *mem_ctx = NULL;
bool ret = false;
diff --git a/source/libcli/nbt/nbtname.c b/source/libcli/nbt/nbtname.c
index fbb9550..1b0fcba 100644
--- a/source/libcli/nbt/nbtname.c
+++ b/source/libcli/nbt/nbtname.c
@@ -624,3 +624,24 @@ _PUBLIC_ void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name,
ndr_print_string(ndr, name, s);
talloc_free(s);
}
+
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_res_rec(struct ndr_push *ndr, int ndr_flags, const struct nbt_res_rec *r)
+{
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->name));
+ NDR_CHECK(ndr_push_nbt_qtype(ndr, NDR_SCALARS, r->rr_type));
+ NDR_CHECK(ndr_push_nbt_qclass(ndr, NDR_SCALARS, r->rr_class));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ttl));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && ((r->rdata).data.length == 2))?0:r->rr_type)));
+ NDR_CHECK(ndr_push_nbt_rdata(ndr, NDR_SCALARS, &r->rdata));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
diff --git a/source/libcli/ndr_netlogon.c b/source/libcli/ndr_netlogon.c
new file mode 100644
index 0000000..84829a3
--- /dev/null
+++ b/source/libcli/ndr_netlogon.c
@@ -0,0 +1,210 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ CLDAP server structures
+
+ Copyright (C) Andrew Bartlett <abartlet at samba.org> 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 <http://www.gnu.org/licenses/>.
+*/
+
+/* parser auto-generated by pidl, then hand-modified by abartlet */
+
+#include "includes.h"
+#include "libcli/netlogon.h"
+
+/* Manually modified to handle the dom_sid being optional based on if it is present or all zero */
+enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_REQUEST(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_REQUEST *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->request_count));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_control));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
+ if (ndr_size_dom_sid0(&r->sid, ndr->flags)) {
+ struct ndr_push *_ndr_sid;
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
+ NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
+ }
+ NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/* Manually modified to handle the dom_sid being optional based on if it is present (size is non-zero) or not */
+enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_REQUEST(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_REQUEST *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->request_count));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
--
Samba Shared Repository
More information about the samba-cvs
mailing list