]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pylibsmb: Add smb1_symlink()
authorVolker Lendecke <vl@samba.org>
Tue, 18 Oct 2022 14:55:53 +0000 (16:55 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 22 Nov 2022 18:27:33 +0000 (18:27 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/pylibsmb.c

index 1f9efc29332335e240cabc56dc8b627f29ee3179..549c607224b634bcd48c4f4a782371243e702f94 100644 (file)
@@ -2394,6 +2394,32 @@ static PyObject *py_smb_smb1_readlink(
        return result;
 }
 
+static PyObject *py_smb_smb1_symlink(
+       struct py_cli_state *self, PyObject *args)
+{
+       NTSTATUS status;
+       const char *target = NULL, *newname = NULL;
+       struct tevent_req *req = NULL;
+
+       if (!PyArg_ParseTuple(args, "ss:smb1_symlink", &target, &newname)) {
+               return NULL;
+       }
+
+       req = cli_posix_symlink_send(
+               NULL, self->ev, self->cli, target, newname);
+       if (!py_tevent_req_wait_exc(self, req)) {
+               return NULL;
+       }
+       status = cli_posix_symlink_recv(req);
+       TALLOC_FREE(req);
+       if (!NT_STATUS_IS_OK(status)) {
+               PyErr_SetNTSTATUS(status);
+               return NULL;
+       }
+
+       Py_RETURN_NONE;
+}
+
 static PyMethodDef py_cli_state_methods[] = {
        { "settimeout", (PyCFunction)py_cli_settimeout, METH_VARARGS,
          "settimeout(new_timeout_msecs) => return old_timeout_msecs" },
@@ -2485,6 +2511,11 @@ static PyMethodDef py_cli_state_methods[] = {
          METH_VARARGS,
          "smb1_readlink(path) -> link target",
        },
+       { "smb1_symlink",
+         (PyCFunction)py_smb_smb1_symlink,
+         METH_VARARGS,
+         "smb1_symlink(target, newname) -> None",
+       },
        { NULL, NULL, 0, NULL }
 };