Files
matt335672 ae6b1ed8a8 xrdp-droppriv erroneous includes
xrdp-droppriv.c is erroneously including os_calls.c rather than
os_calls.h

This leads to a link failure on Ubuntu 20.04:-

/usr/bin/ld: xrdp-droppriv.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'

The error does not happen with later glibc versions, as libdl is
included in libc for these versions.

(cherry picked from commit b914d3e997ee70544db5fd2e28509bbcae32ddc6)
2024-12-23 11:19:30 +00:00

50 lines
1.3 KiB
C

/*
*
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg and contributors 2004-2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Shell around the g_drop_privileges() call
*/
#if defined(HAVE_CONFIG_H)
#include "config_ac.h"
#endif
#include "os_calls.h"
#include "log.h"
int main(int argc, char *argv[])
{
struct log_config *logging;
int status = 1;
logging = log_config_init_for_console(LOG_LEVEL_WARNING,
g_getenv("DROPPRIV_LOG_LEVEL"));
log_start_from_param(logging);
log_config_free(logging);
if (argc < 4)
{
LOG(LOG_LEVEL_ERROR, "Usage : %s [user] [group] [cmd...]\n", argv[0]);
}
else if (g_drop_privileges(argv[1], argv[2]) == 0)
{
status = g_execvp(argv[3], &argv[3]);
}
log_end();
return status;
}