From 1cae2ac905cc3e4b6e4c92ec4d64c582cfad8fea Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 27 Aug 2008 15:06:14 -0700 Subject: Add st_birthtime and friends for accurate create times on systems that support it (*BSD and MacOSX). Should have done this ages ago, sorry. Jeremy. (This used to be commit 4c3a9558906f213948c3bdc081be73f8fed148cb) --- source3/include/proto.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index d3a8dbbc7f..2145a892c6 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1185,7 +1185,6 @@ void srv_put_dos_date2(char *buf,int offset, time_t unixdate); void srv_put_dos_date3(char *buf,int offset,time_t unixdate); void put_long_date_timespec(char *p, struct timespec ts); void put_long_date(char *p, time_t t); -time_t get_create_time(const SMB_STRUCT_STAT *st,bool fake_dirs); struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,bool fake_dirs); struct timespec get_atimespec(const SMB_STRUCT_STAT *pst); void set_atimespec(SMB_STRUCT_STAT *pst, struct timespec ts); -- cgit From 29af730964e567a8391ee381aae3b9aaa7e5e7e1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 27 Aug 2008 17:29:10 -0700 Subject: Fix the wcache_invalidate_samlogon calls. Jeremy. (This used to be commit 7c820899ed1364fdaeb7b49e8ddd839e67397ec0) --- source3/include/proto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 2145a892c6..d5e942a6d7 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5002,7 +5002,7 @@ void pwd_get_cleartext(struct pwd_info *pwd, fstring clr); bool netsamlogon_cache_init(void); bool netsamlogon_cache_shutdown(void); -void netsamlogon_clear_cached_user(TDB_CONTEXT *tdb, struct netr_SamInfo3 *info3); +void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3); bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3); struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const DOM_SID *user_sid); bool netsamlogon_cache_have(const DOM_SID *user_sid); -- cgit From 58aa97c0d9db06588d1aba4f06a3c98ed2098d8f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 1 Aug 2008 23:14:51 +0200 Subject: Refactoring: Add the routine cli_request_send() cli_request_send() is supposed to bundle all generic SMB-header handling. This makes cli_request_new static to async_smb.c. (This used to be commit 7e73dd4e7622db64d30d48ba106892e0895fc188) --- source3/include/async_smb.h | 12 ++++++------ source3/include/proto.h | 15 --------------- 2 files changed, 6 insertions(+), 21 deletions(-) (limited to 'source3/include') diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index 19408be74b..5ec6b12050 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -20,14 +20,14 @@ #include "includes.h" /* - * Create a fresh async smb request + * Ship a new smb request to the server */ -struct async_req *cli_request_new(TALLOC_CTX *mem_ctx, - struct event_context *ev, - struct cli_state *cli, - uint8_t num_words, size_t num_bytes, - struct cli_request **preq); +struct async_req *cli_request_send(TALLOC_CTX *mem_ctx, struct cli_state *cli, + uint8_t smb_command, + uint8_t additional_flags, + uint8_t wct, const uint16_t *vwv, + uint16_t num_bytes, const uint8_t *bytes); /* * Convenience function to get the SMB part out of an async_req diff --git a/source3/include/proto.h b/source3/include/proto.h index d5e942a6d7..0e691d9062 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4201,21 +4201,6 @@ bool asn1_write_enumerated(ASN1_DATA *data, uint8 v); bool ber_write_OID_String(DATA_BLOB *blob, const char *OID); bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID); -/* The following definitions come from libsmb/async_smb.c */ - -NTSTATUS cli_pull_error(char *buf); -void cli_set_error(struct cli_state *cli, NTSTATUS status); -struct async_req *cli_request_new(TALLOC_CTX *mem_ctx, - struct event_context *ev, - struct cli_state *cli, - uint8_t num_words, size_t num_bytes, - struct cli_request **preq); -struct cli_request *cli_request_get(struct async_req *req); -struct cli_tmp_event *cli_tmp_event_ctx(TALLOC_CTX *mem_ctx, - struct cli_state *cli); -NTSTATUS cli_add_event_ctx(struct cli_state *cli, - struct event_context *event_ctx); - /* The following definitions come from libsmb/cliconnect.c */ ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user, -- cgit From 8f408a676eb1d2bac665d8212d727dafeecd386e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 1 Aug 2008 23:18:15 +0200 Subject: Add async cli_close (This used to be commit f84a2b5dbf8a072a9e356fa39523f65d042a2643) --- source3/include/proto.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 0e691d9062..41185a63b9 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4379,6 +4379,9 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint8 SecuityFlags); int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess); int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode); +struct async_req *cli_close_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct cli_state *cli, int fnum); +NTSTATUS cli_close_recv(struct async_req *req); bool cli_close(struct cli_state *cli, int fnum); bool cli_ftruncate(struct cli_state *cli, int fnum, uint64_t size); NTSTATUS cli_locktype(struct cli_state *cli, int fnum, -- cgit From de9fcfc79504fbca0350a99269b4a3423e5f2561 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 2 Aug 2008 18:44:39 +0200 Subject: Add async open&x (This used to be commit faf353edd60967efac4d5c222db14fa730866273) --- source3/include/proto.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 41185a63b9..ac91b144de 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4378,6 +4378,9 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 CreateDisposition, uint32 CreateOptions, uint8 SecuityFlags); int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess); +struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct cli_state *cli, + const char *fname, int flags, int share_mode); +NTSTATUS cli_open_recv(struct async_req *req, int *fnum); int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode); struct async_req *cli_close_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct cli_state *cli, int fnum); -- cgit From 2650207d4adbfd68974fc2b342dd2af079a2552c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 24 Aug 2008 14:17:43 +0200 Subject: Remove cli->event_ctx, pass it explicitly Storing the event_context as permanent state in struct cli_state creates more complex code than necessary IMO. (This used to be commit debb37f703075008e5ea7d34d214cfa4d0f8f916) --- source3/include/async_smb.h | 18 +++--------------- source3/include/client.h | 10 +++++++++- source3/include/proto.h | 8 ++++++-- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'source3/include') diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index 5ec6b12050..40a8d3476e 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -23,7 +23,9 @@ * Ship a new smb request to the server */ -struct async_req *cli_request_send(TALLOC_CTX *mem_ctx, struct cli_state *cli, +struct async_req *cli_request_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, uint8_t smb_command, uint8_t additional_flags, uint8_t wct, const uint16_t *vwv, @@ -46,17 +48,3 @@ NTSTATUS cli_pull_error(char *buf); */ void cli_set_error(struct cli_state *cli, NTSTATUS status); - -/* - * Create a temporary event context for use in the sync helper functions - */ - -struct cli_tmp_event *cli_tmp_event_ctx(TALLOC_CTX *mem_ctx, - struct cli_state *cli); - -/* - * Attach an event context permanently to a cli_struct - */ - -NTSTATUS cli_add_event_ctx(struct cli_state *cli, - struct event_context *event_ctx); diff --git a/source3/include/client.h b/source3/include/client.h index 51ced9907f..be12288f28 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -204,7 +204,15 @@ struct cli_state { bool force_dos_errors; bool case_sensitive; /* False by default. */ - struct event_context *event_ctx; + /** + * fd_event is around while we have async requests outstanding or are + * building a chained request. + * + * (fd_event!=NULL) && (outstanding_request!=NULL) + * + * should always be true, as well as the reverse: If both cli_request + * pointers are NULL, no fd_event is around. + */ struct fd_event *fd_event; char *evt_inbuf; diff --git a/source3/include/proto.h b/source3/include/proto.h index ac91b144de..f21cc2b17f 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4378,7 +4378,8 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 CreateDisposition, uint32 CreateOptions, uint8 SecuityFlags); int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess); -struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct cli_state *cli, +struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct cli_state *cli, const char *fname, int flags, int share_mode); NTSTATUS cli_open_recv(struct async_req *req, int *fnum); int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode); @@ -4618,11 +4619,14 @@ int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier, /* The following definitions come from libsmb/clireadwrite.c */ struct async_req *cli_read_andx_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, struct cli_state *cli, int fnum, off_t offset, size_t size); NTSTATUS cli_read_andx_recv(struct async_req *req, ssize_t *received, uint8_t **rcvbuf); -struct async_req *cli_pull_send(TALLOC_CTX *mem_ctx, struct cli_state *cli, +struct async_req *cli_pull_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, uint16_t fnum, off_t start_offset, SMB_OFF_T size, size_t window_size, NTSTATUS (*sink)(char *buf, size_t n, -- cgit From 128524930d490fb5ea637d99bffb36157c80869b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 25 Aug 2008 13:33:41 +0200 Subject: Add cli_pull_reply Along the lines of cli_request_send this abstracts away the smb-level buffer handling when parsing replies we got from the server. (This used to be commit 253134d3aaa359fdfb665709dd5686f69af7f8fd) --- source3/include/async_smb.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/include') diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index 40a8d3476e..93d2273239 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -37,6 +37,10 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx, struct cli_request *cli_request_get(struct async_req *req); +NTSTATUS cli_pull_reply(struct async_req *req, + uint8_t *pwct, uint16_t **pvwv, + uint16_t *pnum_bytes, uint8_t **pbytes); + /* * Fetch an error out of a NBT packet */ -- cgit From 77d1b29e25512982a1f912adac46bb954ee3d19f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 25 Aug 2008 14:40:15 +0200 Subject: Move "struct cli_request" from client.h to async_smb.h Also add some comments (This used to be commit 2ecc311f785317caf5b60051147dcd085c80d64f) --- source3/include/async_smb.h | 63 +++++++++++++++++++++++++++++++++++++++++++++ source3/include/client.h | 27 +++---------------- 2 files changed, 66 insertions(+), 24 deletions(-) (limited to 'source3/include') diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index 93d2273239..031ab233dd 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -17,8 +17,69 @@ along with this program. If not, see . */ +#ifndef __ASYNC_SMB_H__ +#define __ASYNC_SMB_H__ + #include "includes.h" +struct cli_request { + /** + * "prev" and "next" form the doubly linked list in + * cli_state->outstanding_requests + */ + struct cli_request *prev, *next; + + /** + * "our" struct async_req; + */ + struct async_req *async; + + /** + * The client connection for this request + */ + struct cli_state *cli; + + /** + * The enc_state to decrypt the reply + */ + struct smb_trans_enc_state *enc_state; + + /** + * The mid we used for this request. Mainly used to demultiplex on + * receiving replies. + */ + uint16_t mid; + + /** + * The bytes we have to ship to the server + */ + char *outbuf; + + /** + * How much from "outbuf" did we already send + */ + size_t sent; + + /** + * The reply comes in here. Its intended size is implicit by + * smb_len(), its current size can be read via talloc_get_size() + */ + char *inbuf; + + /** + * Specific requests might add stuff here. Maybe convert this to a + * private_pointer at some point. + */ + union { + struct { + off_t ofs; + size_t size; + ssize_t received; + uint8_t *rcvbuf; + } read; + } data; +}; + /* * Ship a new smb request to the server */ @@ -52,3 +113,5 @@ NTSTATUS cli_pull_error(char *buf); */ void cli_set_error(struct cli_state *cli, NTSTATUS status); + +#endif diff --git a/source3/include/client.h b/source3/include/client.h index be12288f28..6a6e1a2faa 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -216,33 +216,12 @@ struct cli_state { struct fd_event *fd_event; char *evt_inbuf; + /** + * A linked list of requests that are waiting for a reply + */ struct cli_request *outstanding_requests; }; -struct cli_request { - struct cli_request *prev, *next; - struct async_req *async; - - struct cli_state *cli; - - struct smb_trans_enc_state *enc_state; - - uint16_t mid; - - char *outbuf; - size_t sent; - char *inbuf; - - union { - struct { - off_t ofs; - size_t size; - ssize_t received; - uint8_t *rcvbuf; - } read; - } data; -}; - typedef struct file_info { struct cli_state *cli; SMB_BIG_UINT size; -- cgit From b054f14111337c826548d7728dc2b0a66ab5beae Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 25 Aug 2008 15:59:36 +0200 Subject: Activate code to enable chained requests Add the CHAIN1 torture test (This used to be commit 82992d74a99b056bbfe90e1b79190e0b7c0bf2bd) --- source3/include/async_smb.h | 21 +++++++++++++++++++-- source3/include/client.h | 8 +++++++- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'source3/include') diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index 031ab233dd..1053de2942 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -22,6 +22,13 @@ #include "includes.h" +/** + * struct cli_request is the state holder for an async client request we sent + * to the server. It can consist of more than one struct async_req that we + * have to server if the application did a cli_chain_cork() and + * cli_chain_uncork() + */ + struct cli_request { /** * "prev" and "next" form the doubly linked list in @@ -30,9 +37,15 @@ struct cli_request { struct cli_request *prev, *next; /** - * "our" struct async_req; + * num_async: How many chained requests do we serve? + */ + int num_async; + + /** + * async: This is the list of chained requests that were queued up by + * cli_request_chain before we sent out this request */ - struct async_req *async; + struct async_req **async; /** * The client connection for this request @@ -92,6 +105,10 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx, uint8_t wct, const uint16_t *vwv, uint16_t num_bytes, const uint8_t *bytes); +bool cli_chain_cork(struct cli_state *cli, struct event_context *ev, + size_t size_hint); +void cli_chain_uncork(struct cli_state *cli); + /* * Convenience function to get the SMB part out of an async_req */ diff --git a/source3/include/client.h b/source3/include/client.h index 6a6e1a2faa..9b564fc48e 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -208,7 +208,8 @@ struct cli_state { * fd_event is around while we have async requests outstanding or are * building a chained request. * - * (fd_event!=NULL) && (outstanding_request!=NULL) + * (fd_event!=NULL) && + * ((outstanding_request!=NULL)||(chain_accumulator!=NULL)) * * should always be true, as well as the reverse: If both cli_request * pointers are NULL, no fd_event is around. @@ -220,6 +221,11 @@ struct cli_state { * A linked list of requests that are waiting for a reply */ struct cli_request *outstanding_requests; + + /** + * The place to build up the list of chained requests. + */ + struct cli_request *chain_accumulator; }; typedef struct file_info { -- cgit From bb0fc9cfceab7e961eaa9049d111121609ff8174 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 27 Aug 2008 19:26:40 +0200 Subject: Add cli_request->recv_helper Necessary for requests with multiple replies (This used to be commit cb2e338eb33dfb4627f9b43456af0c86d7d268c6) --- source3/include/async_smb.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source3/include') diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index 1053de2942..6a09bb6001 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -91,6 +91,18 @@ struct cli_request { uint8_t *rcvbuf; } read; } data; + + /** + * For requests that don't follow the strict request/reply pattern + * such as the transaction request family and echo requests it is + * necessary to break the standard procedure in + * handle_incoming_pdu(). For a simple example look at + * cli_echo_recv_helper(). + */ + struct { + void (*fn)(struct async_req *req); + void *priv; + } recv_helper; }; /* -- cgit From 228a12681bc7e6eb5bddb75b3b97a74c5eef1c3a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 27 Aug 2008 19:30:57 +0200 Subject: Add async smbecho client support (This used to be commit c1d645fbe39433541d8bfe6b818c855cee318dc5) --- source3/include/async_smb.h | 4 ++++ source3/include/proto.h | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'source3/include') diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index 6a09bb6001..ed42baef0d 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -90,6 +90,10 @@ struct cli_request { ssize_t received; uint8_t *rcvbuf; } read; + struct { + DATA_BLOB data; + uint16_t num_echos; + } echo; } data; /** diff --git a/source3/include/proto.h b/source3/include/proto.h index f21cc2b17f..abfc79024a 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4338,8 +4338,11 @@ void cli_sockopt(struct cli_state *cli, const char *options); uint16 cli_setpid(struct cli_state *cli, uint16 pid); bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive); bool cli_send_keepalive(struct cli_state *cli); -bool cli_echo(struct cli_state *cli, uint16 num_echos, - unsigned char *data, size_t length); +struct async_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct cli_state *cli, uint16_t num_echos, + DATA_BLOB data); +NTSTATUS cli_echo_recv(struct async_req *req); +NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data); /* The following definitions come from libsmb/clierror.c */ -- cgit From f294f51bf0d136208fee1be343684ea890a499d0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 28 Aug 2008 15:44:14 +0200 Subject: Remove cli_request_get() req->private_data==NULL at this point is definitely a bug. (This used to be commit ce3dc9f616cafc1289a94ac7cae0beca967d836e) --- source3/include/async_smb.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'source3/include') diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index ed42baef0d..e9e10023e3 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -125,12 +125,6 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev, size_t size_hint); void cli_chain_uncork(struct cli_state *cli); -/* - * Convenience function to get the SMB part out of an async_req - */ - -struct cli_request *cli_request_get(struct async_req *req); - NTSTATUS cli_pull_reply(struct async_req *req, uint8_t *pwct, uint16_t **pvwv, uint16_t *pnum_bytes, uint8_t **pbytes); -- cgit From 0380fe9d823d6219441050a9b7298bf039b20742 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 22 Aug 2008 16:08:00 +0200 Subject: kerberos: move the KRB5_KEY* macros to header file. Guenther (This used to be commit c28fa17ffffee3e6fd4897c9c6b4937388a19600) --- source3/include/ads.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source3/include') diff --git a/source3/include/ads.h b/source3/include/ads.h index 0d464b2d81..a31141cb25 100644 --- a/source3/include/ads.h +++ b/source3/include/ads.h @@ -376,6 +376,18 @@ typedef struct { } smb_krb5_addresses; #endif +#ifdef HAVE_KRB5_KEYBLOCK_KEYVALUE /* Heimdal */ +#define KRB5_KEY_TYPE(k) ((k)->keytype) +#define KRB5_KEY_LENGTH(k) ((k)->keyvalue.length) +#define KRB5_KEY_DATA(k) ((k)->keyvalue.data) +#define KRB5_KEY_DATA_CAST void +#else /* MIT */ +#define KRB5_KEY_TYPE(k) ((k)->enctype) +#define KRB5_KEY_LENGTH(k) ((k)->length) +#define KRB5_KEY_DATA(k) ((k)->contents) +#define KRB5_KEY_DATA_CAST krb5_octet +#endif /* HAVE_KRB5_KEYBLOCK_KEYVALUE */ + enum ads_extended_dn_flags { ADS_EXTENDED_DN_HEX_STRING = 0, ADS_EXTENDED_DN_STRING = 1 /* not supported on win2k */ -- cgit From 87ea8f3fae44b5442f1e5303bf1d5326f1bfd5ae Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 22 Aug 2008 14:52:10 +0200 Subject: kerberos: add KRB5_KT_KEY abstraction macro. Guenther (This used to be commit be846d5383ef31136cca6b11eb6181736fb2e29d) --- source3/include/ads.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/ads.h b/source3/include/ads.h index a31141cb25..ebe8be08b6 100644 --- a/source3/include/ads.h +++ b/source3/include/ads.h @@ -382,12 +382,20 @@ typedef struct { #define KRB5_KEY_DATA(k) ((k)->keyvalue.data) #define KRB5_KEY_DATA_CAST void #else /* MIT */ -#define KRB5_KEY_TYPE(k) ((k)->enctype) +#define KRB5_KEY_TYPE(k) ((k)->enctype) #define KRB5_KEY_LENGTH(k) ((k)->length) #define KRB5_KEY_DATA(k) ((k)->contents) #define KRB5_KEY_DATA_CAST krb5_octet #endif /* HAVE_KRB5_KEYBLOCK_KEYVALUE */ +#ifdef HAVE_KRB5_KEYTAB_ENTRY_KEY /* MIT */ +#define KRB5_KT_KEY(k) (&(k)->key) +#elif HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK /* Heimdal */ +#define KRB5_KT_KEY(k) (&(k)->keyblock) +#else +#error krb5_keytab_entry has no key or keyblock member +#endif + enum ads_extended_dn_flags { ADS_EXTENDED_DN_HEX_STRING = 0, ADS_EXTENDED_DN_STRING = 1 /* not supported on win2k */ -- cgit From bff20e14c38d7139033127182b76aa24e471b581 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 22 Aug 2008 14:58:01 +0200 Subject: kerberos: use KRB5_KT_KEY macro where appropriate. Guenther (This used to be commit a042dffd7121bda3dbc9509f69fcfae06ed4cc22) --- source3/include/includes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index fa385cba2a..958e7cba1f 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1234,7 +1234,7 @@ krb5_error_code smb_krb5_mk_error(krb5_context context, krb5_error_code error_code, const krb5_principal server, krb5_data *reply); -krb5_enctype smb_get_enctype_from_kt_entry(const krb5_keytab_entry *kt_entry); +krb5_enctype smb_get_enctype_from_kt_entry(krb5_keytab_entry *kt_entry); krb5_error_code smb_krb5_enctype_to_string(krb5_context context, krb5_enctype enctype, char **etype_s); -- cgit From ea0686e64a1d8079386ee9fac406ba06d1e6825f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 29 Aug 2008 11:38:02 +0200 Subject: kerberos: fix HAVE_KRB5 related build issue. Guenther (This used to be commit 7d7ba8397743af52a74d00fd717bdeb5e3e12a28) --- source3/include/ads.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/include') diff --git a/source3/include/ads.h b/source3/include/ads.h index ebe8be08b6..97faf0b6eb 100644 --- a/source3/include/ads.h +++ b/source3/include/ads.h @@ -372,9 +372,8 @@ typedef struct { krb5_addresses *addrs; #else #error UNKNOWN_KRB5_ADDRESS_TYPE -#endif +#endif /* defined(HAVE_MAGIC_IN_KRB5_ADDRESS) && defined(HAVE_ADDRTYPE_IN_KRB5_ADDRESS) */ } smb_krb5_addresses; -#endif #ifdef HAVE_KRB5_KEYBLOCK_KEYVALUE /* Heimdal */ #define KRB5_KEY_TYPE(k) ((k)->keytype) @@ -394,7 +393,9 @@ typedef struct { #define KRB5_KT_KEY(k) (&(k)->keyblock) #else #error krb5_keytab_entry has no key or keyblock member -#endif +#endif /* HAVE_KRB5_KEYTAB_ENTRY_KEY */ + +#endif /* HAVE_KRB5 */ enum ads_extended_dn_flags { ADS_EXTENDED_DN_HEX_STRING = 0, -- cgit From 087a992b973466079f033c55bc5a1f522dc235fd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 1 Sep 2008 17:07:33 +0200 Subject: doserr: add WERR_WRONG_PASSWORD. Guenther (This used to be commit 977fec76b77639403ba9ab7bb00c57601e23493d) --- source3/include/doserr.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include') diff --git a/source3/include/doserr.h b/source3/include/doserr.h index 9dd20e87e7..c901df28e4 100644 --- a/source3/include/doserr.h +++ b/source3/include/doserr.h @@ -214,6 +214,7 @@ #define WERR_GROUP_EXISTS W_ERROR(1318) #define WERR_MEMBER_IN_GROUP W_ERROR(1320) #define WERR_USER_NOT_IN_GROUP W_ERROR(1321) +#define WERR_WRONG_PASSWORD W_ERROR(1323) #define WERR_PASSWORD_RESTRICTION W_ERROR(1325) #define WERR_LOGON_FAILURE W_ERROR(1326) #define WERR_NO_SUCH_DOMAIN W_ERROR(1355) -- cgit From c97880e979d49e0afca8ad0d2e2362e24ca0cfde Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 2 Sep 2008 09:44:39 +0200 Subject: Remove unused CLI_DO_RPC macros (This used to be commit f5212c64d23a28fa40a14b45a8d1c0181f01a6da) --- source3/include/rpc_client.h | 48 -------------------------------------------- 1 file changed, 48 deletions(-) (limited to 'source3/include') diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h index d1af6f958d..684044b871 100644 --- a/source3/include/rpc_client.h +++ b/source3/include/rpc_client.h @@ -42,54 +42,6 @@ /* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */ -#define CLI_DO_RPC_INTERNAL( pcli, ctx, interface, opnum, q_in, r_out, \ - q_ps, r_ps, q_io_fn, r_io_fn, default_error, copy_sess_key ) \ -{\ - SMB_ASSERT(ndr_syntax_id_equal(&pcli->abstract_syntax, interface)); \ - if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \ - return NT_STATUS_NO_MEMORY;\ - }\ - prs_init_empty( &r_ps, ctx, UNMARSHALL );\ - if ( copy_sess_key) prs_set_session_key(&q_ps, (const char *)pcli->dc->sess_key);\ - if ( q_io_fn("", &q_in, &q_ps, 0) ) {\ - NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \ - if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\ - prs_mem_free( &q_ps );\ - prs_mem_free( &r_ps );\ - return _smb_pipe_stat_;\ - }\ - if ( copy_sess_key ) prs_set_session_key(&r_ps, (const char *)pcli->dc->sess_key);\ - if (!r_io_fn("", &r_out, &r_ps, 0)) {\ - prs_mem_free( &q_ps );\ - prs_mem_free( &r_ps );\ - return default_error;\ - }\ - } else {\ - prs_mem_free( &q_ps );\ - prs_mem_free( &r_ps );\ - return default_error;\ - }\ - prs_mem_free( &q_ps );\ - prs_mem_free( &r_ps );\ -} - -#define CLI_DO_RPC_COPY_SESS_KEY( pcli, ctx, p_idx, opnum, q_in, r_out, \ - q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ -{\ - CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \ - q_ps, r_ps, q_io_fn, r_io_fn, default_error, True ); \ -} - -#define CLI_DO_RPC( pcli, ctx, p_idx, opnum, q_in, r_out, \ - q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ -{\ - CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \ - q_ps, r_ps, q_io_fn, r_io_fn, default_error, False ); \ -} - - -/* Arrrgg. Same but with WERRORS. Needed for registry code. */ - #define CLI_DO_RPC_WERR( pcli, ctx, interface, opnum, q_in, r_out, \ q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ {\ -- cgit From 84fca380f2040c53d20fff41972d2f4102183766 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 3 Sep 2008 14:22:48 +0200 Subject: factor prs_append_some_data out of prs_append_some_prs_data (This used to be commit 32cb45c962c822bd79a7d0f666f2f6037060b324) --- source3/include/proto.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index abfc79024a..291afac44d 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -7822,6 +7822,8 @@ uint32 prs_data_size(prs_struct *ps); uint32 prs_offset(prs_struct *ps); bool prs_set_offset(prs_struct *ps, uint32 offset); bool prs_append_prs_data(prs_struct *dst, prs_struct *src); +bool prs_append_some_data(prs_struct *dst, void *src_base, uint32_t start, + uint32_t len); bool prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len); bool prs_copy_data_in(prs_struct *dst, const char *src, uint32 len); bool prs_copy_data_out(char *dst, prs_struct *src, uint32 len); -- cgit