From: Volker Lendecke Date: Tue, 18 Oct 2022 14:55:53 +0000 (+0200) Subject: pylibsmb: Add smb1_symlink() X-Git-Tag: talloc-2.4.0~503 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68a4be1edf77aef3589c8ab1bfcc291fc8e3a70c;p=thirdparty%2Fsamba.git pylibsmb: Add smb1_symlink() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c index 1f9efc29332..549c607224b 100644 --- a/source3/libsmb/pylibsmb.c +++ b/source3/libsmb/pylibsmb.c @@ -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 } };