diff --git a/server/shadow/shadow_server.c b/server/shadow/shadow_server.c index bc72637fd..063c72f85 100644 --- a/server/shadow/shadow_server.c +++ b/server/shadow/shadow_server.c @@ -66,12 +66,13 @@ static int shadow_server_print_command_line_help(int argc, char** argv, if ((argc < 1) || !largs || !argv) return -1; + char* path = winpr_GetConfigFilePath(TRUE, "SAM"); printf("Usage: %s [options]\n", argv[0]); printf("\n"); printf("Notes: By default NLA security is active.\n"); printf("\tIn this mode a SAM database is required.\n"); printf("\tProvide one with /sam-file:\n"); - printf("\telse the default path /etc/winpr/SAM is used.\n"); + printf("\telse the default path %s is used.\n", path); printf("\tIf there is no existing SAM file authentication for all users will fail.\n"); printf( "\n\tIf authentication against PAM is desired, start with -sec-nla (requires compiled in " @@ -81,6 +82,8 @@ static int shadow_server_print_command_line_help(int argc, char** argv, printf(" /option: (specifies option with value)\n"); printf(" +toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')\n"); printf("\n"); + free(path); + arg = largs; do diff --git a/winpr/libwinpr/utils/sam.c b/winpr/libwinpr/utils/sam.c index f737dcd85..825fb9258 100644 --- a/winpr/libwinpr/utils/sam.c +++ b/winpr/libwinpr/utils/sam.c @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -35,11 +36,6 @@ #include #endif -#ifdef _WIN32 -#define WINPR_SAM_FILE "C:\\SAM" -#else -#define WINPR_SAM_FILE "/etc/winpr/SAM" -#endif #define TAG WINPR_TAG("utils") struct winpr_sam @@ -95,9 +91,13 @@ WINPR_SAM* SamOpen(const char* filename, BOOL readOnly) { FILE* fp = NULL; WINPR_SAM* sam = NULL; + char* allocatedFileName = NULL; if (!filename) - filename = WINPR_SAM_FILE; + { + allocatedFileName = winpr_GetConfigFilePath(TRUE, "SAM"); + filename = allocatedFileName; + } if (readOnly) fp = winpr_fopen(filename, "r"); @@ -108,6 +108,7 @@ WINPR_SAM* SamOpen(const char* filename, BOOL readOnly) if (!fp) fp = winpr_fopen(filename, "w+"); } + free(allocatedFileName); if (fp) {