From 8a7d535d925e050c4746426418dddc4554c5d947 Mon Sep 17 00:00:00 2001
From: Johan Wikman <johan.wikman@nokia.com>
Date: Fri, 7 Nov 2014 14:01:13 +0200
Subject: [PATCH] Added MONGOOSE_NO_USER configuration define.

Low-end systems, not running a proper OS, may not have the
concept of a user.
---
 docs/Embed.md | 2 ++
 mongoose.c    | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/docs/Embed.md b/docs/Embed.md
index 589ef561d..28274ac66 100644
--- a/docs/Embed.md
+++ b/docs/Embed.md
@@ -151,6 +151,8 @@ all Net Skeleton functions will be available too.
     -DMONGOOSE_NO_LOGGING       Disable access/error logging
     -DMONGOOSE_NO_THREADS
     -DMONGOOSE_NO_WEBSOCKET     Disable WebSocket support
+    -DMONGOOSE_NO_USER          No concept of a user on used platform.
+                                (Platform does not provide getpwnam, setgid or setuid)
 
     -DMONGOOSE_USE_IDLE_TIMEOUT_SECONDS=X Idle connection timeout, default is 30
     -DMONGOOSE_USE_LUA          Enable Lua scripting
diff --git a/mongoose.c b/mongoose.c
index bf13c0e14..38db701f9 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -5026,7 +5026,7 @@ const char *mg_set_option(struct mg_server *server, const char *name,
   } else if (ind == HEXDUMP_FILE) {
     server->ns_mgr.hexdump_file = *v;
 #endif
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(MONGOOSE_NO_USER)
   } else if (ind == RUN_AS_USER) {
     struct passwd *pw;
     if ((pw = getpwnam(value)) == NULL) {
-- 
GitLab