summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/composite/composite.c6
-rw-r--r--source4/libcli/dgram/dgramsocket.c2
-rw-r--r--source4/libcli/raw/clisocket.c5
-rw-r--r--source4/libcli/raw/interfaces.h19
-rw-r--r--source4/libcli/raw/raweas.c1
-rw-r--r--source4/libcli/raw/rawfile.c1
-rw-r--r--source4/libcli/raw/rawlpq.c1
-rw-r--r--source4/libcli/raw/smb_signing.c1
-rw-r--r--source4/libcli/smb2/smb2_calls.h12
-rw-r--r--source4/libcli/smb2/smb2_constants.h22
-rw-r--r--source4/libcli/smb2/util.c78
-rw-r--r--source4/libcli/smb_composite/connect.c2
-rw-r--r--source4/libcli/wrepl/winsrepl.c4
13 files changed, 73 insertions, 81 deletions
diff --git a/source4/libcli/composite/composite.c b/source4/libcli/composite/composite.c
index ab32175d00..7262ebce54 100644
--- a/source4/libcli/composite/composite.c
+++ b/source4/libcli/composite/composite.c
@@ -42,11 +42,7 @@ _PUBLIC_ struct composite_context *composite_create(TALLOC_CTX *mem_ctx,
c = talloc_zero(mem_ctx, struct composite_context);
if (!c) return NULL;
c->state = COMPOSITE_STATE_IN_PROGRESS;
- c->event_ctx = talloc_reference(c, ev);
- if (!c->event_ctx) {
- talloc_free(c);
- return NULL;
- }
+ c->event_ctx = ev;
return c;
}
diff --git a/source4/libcli/dgram/dgramsocket.c b/source4/libcli/dgram/dgramsocket.c
index 751706d2c5..365960edb6 100644
--- a/source4/libcli/dgram/dgramsocket.c
+++ b/source4/libcli/dgram/dgramsocket.c
@@ -166,7 +166,7 @@ struct nbt_dgram_socket *nbt_dgram_socket_init(TALLOC_CTX *mem_ctx,
dgmsock = talloc(mem_ctx, struct nbt_dgram_socket);
if (dgmsock == NULL) goto failed;
- dgmsock->event_ctx = talloc_reference(dgmsock, event_ctx);
+ dgmsock->event_ctx = event_ctx;
if (dgmsock->event_ctx == NULL) goto failed;
status = socket_create("ip", SOCKET_TYPE_DGRAM, &dgmsock->sock, 0);
diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c
index b9e83218dd..02da4917e3 100644
--- a/source4/libcli/raw/clisocket.c
+++ b/source4/libcli/raw/clisocket.c
@@ -61,7 +61,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
if (result == NULL) goto failed;
result->state = COMPOSITE_STATE_IN_PROGRESS;
- result->event_ctx = talloc_reference(result, event_ctx);
+ result->event_ctx = event_ctx;
if (result->event_ctx == NULL) goto failed;
state = talloc(result, struct sock_connect_state);
@@ -118,8 +118,7 @@ static void smbcli_sock_connect_recv_conn(struct composite_context *ctx)
state->result->port = port;
state->result->hostname = talloc_steal(sock, state->host_name);
- state->result->event.ctx =
- talloc_reference(state->result, state->ctx->event_ctx);
+ state->result->event.ctx = state->ctx->event_ctx;
if (composite_nomem(state->result->event.ctx, state->ctx)) return;
composite_done(state->ctx);
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
index 478b6585d4..75b7175ac3 100644
--- a/source4/libcli/raw/interfaces.h
+++ b/source4/libcli/raw/interfaces.h
@@ -22,7 +22,8 @@
#ifndef __LIBCLI_RAW_INTERFACES_H__
#define __LIBCLI_RAW_INTERFACES_H__
-#include "smb.h"
+#include "libcli/raw/smb.h"
+#include "libcli/smb2/smb2_constants.h"
#include "librpc/gen_ndr/misc.h" /* for struct GUID */
/* this structure is just a wrapper for a string, the only reason we
@@ -2447,22 +2448,6 @@ union smb_search_first {
} out;
} t2ffirst;
-/*
- SMB2 uses different level numbers for the same old SMB trans2 search levels
-*/
-#define SMB2_FIND_DIRECTORY_INFO 0x01
-#define SMB2_FIND_FULL_DIRECTORY_INFO 0x02
-#define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03
-#define SMB2_FIND_NAME_INFO 0x0C
-#define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
-#define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
-
-/* flags for SMB2 find */
-#define SMB2_CONTINUE_FLAG_RESTART 0x01
-#define SMB2_CONTINUE_FLAG_SINGLE 0x02
-#define SMB2_CONTINUE_FLAG_INDEX 0x04
-#define SMB2_CONTINUE_FLAG_REOPEN 0x10
-
/* SMB2 Find */
struct smb2_find {
enum smb_search_level level;
diff --git a/source4/libcli/raw/raweas.c b/source4/libcli/raw/raweas.c
index 09fd4aa412..ae3d4ce50a 100644
--- a/source4/libcli/raw/raweas.c
+++ b/source4/libcli/raw/raweas.c
@@ -18,7 +18,6 @@
*/
#include "includes.h"
-#include "smb.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/raw/raw_proto.h"
diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c
index 6fac7b8605..35d6b75c4d 100644
--- a/source4/libcli/raw/rawfile.c
+++ b/source4/libcli/raw/rawfile.c
@@ -20,7 +20,6 @@
*/
#include "includes.h"
-#include "smb.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/raw/raw_proto.h"
#include "librpc/gen_ndr/ndr_security.h"
diff --git a/source4/libcli/raw/rawlpq.c b/source4/libcli/raw/rawlpq.c
index eddb3e0843..5c44772e03 100644
--- a/source4/libcli/raw/rawlpq.c
+++ b/source4/libcli/raw/rawlpq.c
@@ -18,7 +18,6 @@
*/
#include "includes.h"
-#include "smb.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/raw/raw_proto.h"
diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c
index 9f94039078..84e0ad62a4 100644
--- a/source4/libcli/raw/smb_signing.c
+++ b/source4/libcli/raw/smb_signing.c
@@ -20,7 +20,6 @@
*/
#include "includes.h"
-#include "smb.h"
#include "libcli/raw/libcliraw.h"
#include "libcli/raw/raw_proto.h"
#include "../lib/crypto/crypto.h"
diff --git a/source4/libcli/smb2/smb2_calls.h b/source4/libcli/smb2/smb2_calls.h
index b89770fbe6..bea0573c26 100644
--- a/source4/libcli/smb2/smb2_calls.h
+++ b/source4/libcli/smb2/smb2_calls.h
@@ -52,18 +52,6 @@ struct smb2_negprot {
} out;
};
-/* getinfo classes */
-#define SMB2_GETINFO_FILE 0x01
-#define SMB2_GETINFO_FS 0x02
-#define SMB2_GETINFO_SECURITY 0x03
-#define SMB2_GETINFO_QUOTA 0x04
-
-#define SMB2_GETINFO_ADD_OWNER_SECURITY 0x01
-#define SMB2_GETINFO_ADD_GROUP_SECURITY 0x02
-#define SMB2_GETINFO_ADD_DACL_SECURITY 0x04
-#define SMB2_GETINFO_ADD_SACL_SECURITY 0x08
-#define SMB2_GETINFO_ADD_LABEL_SECURITY 0x10
-
/* NOTE! the getinfo fs and file levels exactly match up with the
'passthru' SMB levels, which are levels >= 1000. The SMB2 client
lib uses the names from the libcli/raw/ library */
diff --git a/source4/libcli/smb2/smb2_constants.h b/source4/libcli/smb2/smb2_constants.h
index f1681a3076..3047809b74 100644
--- a/source4/libcli/smb2/smb2_constants.h
+++ b/source4/libcli/smb2/smb2_constants.h
@@ -150,4 +150,26 @@
#define SMB2_CREATE_OPTIONS_NOT_SUPPORTED_MASK (NTCREATEX_OPTIONS_TREE_CONNECTION | \
NTCREATEX_OPTIONS_OPFILTER)
+/*
+ SMB2 uses different level numbers for the same old SMB trans2 search levels
+*/
+#define SMB2_FIND_DIRECTORY_INFO 0x01
+#define SMB2_FIND_FULL_DIRECTORY_INFO 0x02
+#define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03
+#define SMB2_FIND_NAME_INFO 0x0C
+#define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
+#define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
+
+/* flags for SMB2 find */
+#define SMB2_CONTINUE_FLAG_RESTART 0x01
+#define SMB2_CONTINUE_FLAG_SINGLE 0x02
+#define SMB2_CONTINUE_FLAG_INDEX 0x04
+#define SMB2_CONTINUE_FLAG_REOPEN 0x10
+
+/* getinfo classes */
+#define SMB2_GETINFO_FILE 0x01
+#define SMB2_GETINFO_FS 0x02
+#define SMB2_GETINFO_SECURITY 0x03
+#define SMB2_GETINFO_QUOTA 0x04
+
#endif
diff --git a/source4/libcli/smb2/util.c b/source4/libcli/smb2/util.c
index a360d8fbdf..8602c91a9f 100644
--- a/source4/libcli/smb2/util.c
+++ b/source4/libcli/smb2/util.c
@@ -113,6 +113,7 @@ int smb2_deltree(struct smb2_tree *tree, const char *dname)
TALLOC_CTX *tmp_ctx = talloc_new(tree);
struct smb2_find f;
struct smb2_create create_parm;
+ bool did_delete;
/* it might be a file */
status = smb2_util_unlink(tree, dname);
@@ -154,45 +155,50 @@ int smb2_deltree(struct smb2_tree *tree, const char *dname)
}
- ZERO_STRUCT(f);
- f.in.file.handle = create_parm.out.file.handle;
- f.in.max_response_size = 0x10000;
- f.in.level = SMB2_FIND_NAME_INFO;
- f.in.pattern = "*";
-
- status = smb2_find_level(tree, tmp_ctx, &f, &count, &list);
- if (NT_STATUS_IS_ERR(status)) {
- DEBUG(2,("Failed to list %s - %s\n",
- dname, nt_errstr(status)));
- smb2_util_close(tree, create_parm.out.file.handle);
- talloc_free(tmp_ctx);
- return -1;
- }
-
- for (i=0;i<count;i++) {
- char *name;
- if (strcmp(".", list[i].name_info.name.s) == 0 ||
- strcmp("..", list[i].name_info.name.s) == 0) {
- continue;
+ do {
+ did_delete = false;
+
+ ZERO_STRUCT(f);
+ f.in.file.handle = create_parm.out.file.handle;
+ f.in.max_response_size = 0x10000;
+ f.in.level = SMB2_FIND_NAME_INFO;
+ f.in.pattern = "*";
+
+ status = smb2_find_level(tree, tmp_ctx, &f, &count, &list);
+ if (NT_STATUS_IS_ERR(status)) {
+ DEBUG(2,("Failed to list %s - %s\n",
+ dname, nt_errstr(status)));
+ smb2_util_close(tree, create_parm.out.file.handle);
+ talloc_free(tmp_ctx);
+ return -1;
}
- name = talloc_asprintf(tmp_ctx, "%s\\%s", dname, list[i].name_info.name.s);
- status = smb2_util_unlink(tree, name);
- if (NT_STATUS_EQUAL(status, NT_STATUS_CANNOT_DELETE)) {
- /* it could be read-only */
- status = smb2_util_setatr(tree, name, FILE_ATTRIBUTE_NORMAL);
+
+ for (i=0;i<count;i++) {
+ char *name;
+ if (strcmp(".", list[i].name_info.name.s) == 0 ||
+ strcmp("..", list[i].name_info.name.s) == 0) {
+ continue;
+ }
+ name = talloc_asprintf(tmp_ctx, "%s\\%s", dname, list[i].name_info.name.s);
status = smb2_util_unlink(tree, name);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_CANNOT_DELETE)) {
+ /* it could be read-only */
+ status = smb2_util_setatr(tree, name, FILE_ATTRIBUTE_NORMAL);
+ status = smb2_util_unlink(tree, name);
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) {
+ int ret;
+ ret = smb2_deltree(tree, name);
+ if (ret > 0) total_deleted += ret;
+ }
+ talloc_free(name);
+ if (NT_STATUS_IS_OK(status)) {
+ total_deleted++;
+ did_delete = true;
+ }
}
-
- if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) {
- int ret;
- ret = smb2_deltree(tree, name);
- if (ret > 0) total_deleted += ret;
- }
- talloc_free(name);
- if (NT_STATUS_IS_OK(status)) {
- total_deleted++;
- }
- }
+ } while (did_delete);
smb2_util_close(tree, create_parm.out.file.handle);
diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c
index a5d05b7af1..9a19771bc0 100644
--- a/source4/libcli/smb_composite/connect.c
+++ b/source4/libcli/smb_composite/connect.c
@@ -466,7 +466,7 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec
c = talloc_zero(mem_ctx, struct composite_context);
if (c == NULL) goto failed;
- c->event_ctx = talloc_reference(c, event_ctx);
+ c->event_ctx = event_ctx;
if (c->event_ctx == NULL) goto failed;
state = talloc_zero(c, struct connect_state);
diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c
index 48a6abba9d..849511b606 100644
--- a/source4/libcli/wrepl/winsrepl.c
+++ b/source4/libcli/wrepl/winsrepl.c
@@ -171,7 +171,7 @@ struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx,
wrepl_socket = talloc_zero(mem_ctx, struct wrepl_socket);
if (!wrepl_socket) return NULL;
- wrepl_socket->event.ctx = talloc_reference(wrepl_socket, event_ctx);
+ wrepl_socket->event.ctx = event_ctx;
if (!wrepl_socket->event.ctx) goto failed;
wrepl_socket->iconv_convenience = iconv_convenience;
@@ -205,7 +205,7 @@ struct wrepl_socket *wrepl_socket_merge(TALLOC_CTX *mem_ctx,
wrepl_socket = talloc_zero(mem_ctx, struct wrepl_socket);
if (wrepl_socket == NULL) goto failed;
- wrepl_socket->event.ctx = talloc_reference(wrepl_socket, event_ctx);
+ wrepl_socket->event.ctx = event_ctx;
if (wrepl_socket->event.ctx == NULL) goto failed;
wrepl_socket->sock = sock;