]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
eventlog: Use create_conn_struct_chdir()
authorVolker Lendecke <vl@samba.org>
Mon, 16 Feb 2026 12:57:08 +0000 (13:57 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 1 Mar 2026 20:19:35 +0000 (20:19 +0000)
I did not find any use of cwd-dependent calls in this code, the
eventlog tdb's are all relative to state_path(), which is absolute. As
this is in a rpc server we don't have to preserve any cwd.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/rpc_server/eventlog/srv_eventlog_nt.c

index a946c5731437bb5a70f5bb02ae1b10cbe07a1086..0cd619883b3b28d756b047ed9d25ae7e07b853f1 100644 (file)
@@ -103,7 +103,8 @@ static NTSTATUS get_nt_acl_no_snum(TALLOC_CTX *ctx,
                                struct security_descriptor **sd)
 {
        TALLOC_CTX *frame = talloc_stackframe();
-       struct conn_struct_tos *c = NULL;
+       struct conn_wrap *w = NULL;
+       struct connection_struct *conn = NULL;
        NTSTATUS status = NT_STATUS_OK;
        struct smb_filename *pathref_fname = NULL;
 
@@ -112,31 +113,31 @@ static NTSTATUS get_nt_acl_no_snum(TALLOC_CTX *ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = create_conn_struct_tos(global_messaging_context(),
-                                       -1,
-                                       "/",
-                                       session_info,
-                                       &c);
+       status = create_conn_struct_chdir(talloc_tos(),
+                                         global_messaging_context(),
+                                         -1,
+                                         "/",
+                                         session_info,
+                                         &w);
        if (!NT_STATUS_IS_OK(status)) {
-               DBG_ERR("create_conn_struct_tos() returned %s.\n",
+               DBG_ERR("create_conn_struct_chdir() returned %s.\n",
                        nt_errstr(status));
-               TALLOC_FREE(frame);
-               return status;
+               goto done;
        }
+       conn = conn_wrap_connection(w);
 
        status = synthetic_pathref(talloc_tos(),
-                               c->conn->cwd_fsp,
-                               fname,
-                               NULL,
-                               NULL,
-                               0,
-                               0,
-                               &pathref_fname);
+                                  conn->cwd_fsp,
+                                  fname,
+                                  NULL,
+                                  NULL,
+                                  0,
+                                  0,
+                                  &pathref_fname);
        if (!NT_STATUS_IS_OK(status)) {
                DBG_ERR("synthetic_pathref for file %s returned %s.\n",
                          fname, nt_errstr(status));
-               TALLOC_FREE(frame);
-               return status;
+               goto done;
        }
        status = SMB_VFS_FGET_NT_ACL(pathref_fname->fsp,
                                security_info_wanted,
@@ -147,8 +148,8 @@ static NTSTATUS get_nt_acl_no_snum(TALLOC_CTX *ctx,
                          fname, nt_errstr(status));
        }
 
+done:
        TALLOC_FREE(frame);
-
        return status;
 }