mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-27 03:44:06 +08:00
[winpr,utils] use sam file relative to config home
This commit is contained in:
parent
276e3d67e0
commit
934cf668a2
@ -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:<file with path>\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:<value> (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
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <winpr/config.h>
|
||||
#include <winpr/path.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -35,11 +36,6 @@
|
||||
#include <unistd.h>
|
||||
#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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user