s3: Add cli_setpathinfo
authorVolker Lendecke <vl@samba.org>
Sun, 16 Jan 2011 11:49:59 +0000 (12:49 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 17 Jan 2011 07:03:42 +0000 (08:03 +0100)
source3/include/proto.h
source3/libsmb/clifile.c

index d8a13bb2aa7e22f485a8767336c21993d4dc56a5..b710d713b023612985715b89f290c2284e7b2b9f 100644 (file)
@@ -1786,6 +1786,11 @@ struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
                                        uint8_t *data,
                                        size_t data_len);
 NTSTATUS cli_setpathinfo_recv(struct tevent_req *req);
+NTSTATUS cli_setpathinfo(struct cli_state *cli,
+                        uint16_t level,
+                        const char *path,
+                        uint8_t *data,
+                        size_t data_len);
 
 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
                                        struct event_context *ev,
index 394968f506143f963836c33ddddb71facac6de20..f68c99fc7144375a0da2feb60ed28a8dfb8c62d4 100644 (file)
@@ -205,6 +205,41 @@ NTSTATUS cli_setpathinfo_recv(struct tevent_req *req)
        return tevent_req_simple_recv_ntstatus(req);
 }
 
+NTSTATUS cli_setpathinfo(struct cli_state *cli,
+                        uint16_t level,
+                        const char *path,
+                        uint8_t *data,
+                        size_t data_len)
+{
+       TALLOC_CTX *frame = talloc_stackframe();
+       struct tevent_context *ev;
+       struct tevent_req *req;
+       NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+       if (cli_has_async_calls(cli)) {
+               /*
+                * Can't use sync call while an async call is in flight
+                */
+               status = NT_STATUS_INVALID_PARAMETER;
+               goto fail;
+       }
+       ev = tevent_context_init(frame);
+       if (ev == NULL) {
+               goto fail;
+       }
+       req = cli_setpathinfo_send(ev, ev, cli, level, path, data, data_len);
+       if (req == NULL) {
+               goto fail;
+       }
+       if (!tevent_req_poll_ntstatus(req, ev, &status)) {
+               goto fail;
+       }
+       status = cli_setpathinfo_recv(req);
+ fail:
+       TALLOC_FREE(frame);
+       return status;
+}
+
 /****************************************************************************
  Hard/Symlink a file (UNIX extensions).
  Creates new name (sym)linked to oldname.