From c8e1904da80600c08880a3180d4439e36f455aa7 Mon Sep 17 00:00:00 2001 From: Marc Stern Date: Fri, 5 Apr 2024 18:21:02 +0200 Subject: [PATCH] Missing function --- apache2/msc_util.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apache2/msc_util.c b/apache2/msc_util.c index c4d49841..fd318a08 100644 --- a/apache2/msc_util.c +++ b/apache2/msc_util.c @@ -2850,3 +2850,14 @@ char* strtok_r( } #endif +// we cannot log an error message as this happens much too often +char* get_username(apr_pool_t* mp) { + char* username; + apr_uid_t uid; + apr_gid_t gid; + int rc = apr_uid_current(&uid, &gid, mp); + if (rc != APR_SUCCESS) return "apache"; + rc = apr_uid_name_get(&username, uid, mp); + if (rc != APR_SUCCESS) return "apache"; + return username; +}