diff --git a/Makefile.am b/Makefile.am index 84a6eb47..e664bdbb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4 AM_DISTCHECK_CONFIGURE_FLAGS = --without-systemdsystemunitdir EXTRA_DIST = bootstrap COPYING coding_style.md design.txt faq-compile.txt \ - faq-general.txt file-loc.txt install.txt m4 prog_std.txt readme.txt + faq-general.txt file-loc.txt install.txt m4 readme.txt if XRDP_NEUTRINORDP NEUTRINORDPDIR = neutrinordp diff --git a/coding_style.md b/coding_style.md index 584dac78..cf096ac8 100644 --- a/coding_style.md +++ b/coding_style.md @@ -15,6 +15,13 @@ Here is how we run the astyle command: This coding style is a work in progress and is still evolving. +Language Standard +----------------- + +Try to make all code compile with both C and C++ compiler. C++ is more +strict, which makes the code safer. + + Indentation ----------- @@ -32,7 +39,7 @@ Indentation Line wrapping ------------- -* Keep lines shorter than 80 chars +* Keep lines not longer than 80 chars * Align wrapped argument to the first argument ☞ @@ -46,9 +53,11 @@ Variable names * Use lowercase with underscores as needed * Don't use camelCase +* Preprocessor constants should be uppercase ☞ + #define BUF_SIZE 1024 int fd; int bytes_in_stream; @@ -193,3 +202,9 @@ Braces default: printf("bad cmd\n"); } + +Comments +-------- + +Use /* */ for comments +Don't use // diff --git a/common/list.c b/common/list.c index 5873d41d..47b15737 100644 --- a/common/list.c +++ b/common/list.c @@ -82,7 +82,7 @@ list_add_item(struct list *self, tbus item) /*****************************************************************************/ tbus APP_CC -list_get_item(struct list *self, int index) +list_get_item(const struct list *self, int index) { if (index < 0 || index >= self->count) { diff --git a/common/list.h b/common/list.h index cdc545a0..146aab11 100644 --- a/common/list.h +++ b/common/list.h @@ -40,7 +40,7 @@ list_delete(struct list* self); void APP_CC list_add_item(struct list* self, tintptr item); tintptr APP_CC -list_get_item(struct list* self, int index); +list_get_item(const struct list *self, int index); void APP_CC list_clear(struct list* self); int APP_CC diff --git a/common/log.c b/common/log.c index 77bcc6d6..86935acd 100644 --- a/common/log.c +++ b/common/log.c @@ -222,7 +222,7 @@ internal_log_end(struct log_config *l_cfg) * @return */ enum logLevels DEFAULT_CC -internal_log_text2level(char *buf) +internal_log_text2level(const char *buf) { if (0 == g_strcasecmp(buf, "0") || 0 == g_strcasecmp(buf, "core")) diff --git a/common/log.h b/common/log.h index 61a05d9c..33bb41fd 100644 --- a/common/log.h +++ b/common/log.h @@ -113,7 +113,7 @@ internal_log_lvl2str(const enum logLevels lvl, char *str); * */ enum logLevels DEFAULT_CC -internal_log_text2level(char *s); +internal_log_text2level(const char *s); /** * A function that init our struct that holds all state and @@ -173,16 +173,6 @@ log_end(void); enum logReturns DEFAULT_CC log_message(const enum logLevels lvl, const char *msg, ...) printflike(2, 3); -/** - * - * @brief Reads configuration - * @param s translates the strings "1", "true" and "yes" in 1 (true) and - * other strings in 0 - * @return 0 on success, 1 on failure - * - */ -int APP_CC text2bool(char *s); - /** * This function returns the configured file name for the logfile * @param replybuf the buffer where the reply is stored diff --git a/common/os_calls.c b/common/os_calls.c index 9ba6dfc6..0ba4fd98 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -264,7 +264,7 @@ g_write(const char *format, ...) /*****************************************************************************/ /* produce a hex dump */ void APP_CC -g_hexdump(char *p, int len) +g_hexdump(const char *p, int len) { unsigned char *line; int i; @@ -439,7 +439,7 @@ g_tcp_socket(void) if (setsockopt(rv, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&option_value, option_len) < 0) { - log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed\n"); + log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed"); } } } @@ -455,7 +455,7 @@ g_tcp_socket(void) if (setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char *)&option_value, option_len) < 0) { - log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed\n"); + log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed"); } } } @@ -472,7 +472,7 @@ g_tcp_socket(void) if (setsockopt(rv, SOL_SOCKET, SO_SNDBUF, (char *)&option_value, option_len) < 0) { - log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed\n"); + log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed"); } } } @@ -846,7 +846,7 @@ g_sck_set_non_blocking(int sck) i = i | O_NONBLOCK; if (fcntl(sck, F_SETFL, i) < 0) { - log_message(LOG_LEVEL_ERROR, "g_sck_set_non_blocking: fcntl() failed\n"); + log_message(LOG_LEVEL_ERROR, "g_sck_set_non_blocking: fcntl() failed"); } #endif return 0; @@ -1342,7 +1342,7 @@ g_set_nonblock(int fd) /*****************************************************************************/ /* returns 0 on error */ tintptr APP_CC -g_create_wait_obj(char *name) +g_create_wait_obj(const char *name) { #ifdef _WIN32 tintptr obj; diff --git a/common/os_calls.h b/common/os_calls.h index c103e144..00e91a1d 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -55,7 +55,7 @@ int DEFAULT_CC g_snprintf(char* dest, int len, const char* format, ...) \ printflike(3, 4); void DEFAULT_CC g_writeln(const char* format, ...) printflike(1, 2); void DEFAULT_CC g_write(const char* format, ...) printflike(1, 2); -void APP_CC g_hexdump(char* p, int len); +void APP_CC g_hexdump(const char *p, int len); void APP_CC g_memset(void* ptr, int val, int size); void APP_CC g_memcpy(void* d_ptr, const void* s_ptr, int size); int APP_CC g_getchar(void); @@ -88,7 +88,7 @@ int APP_CC g_sck_can_recv(int sck, int millis); int APP_CC g_sck_select(int sck1, int sck2); void APP_CC g_write_ip_address(int rcv_sck, char* ip_address, int bytes); void APP_CC g_sleep(int msecs); -tintptr APP_CC g_create_wait_obj(char* name); +tintptr APP_CC g_create_wait_obj(const char *name); tintptr APP_CC g_create_wait_obj_from_socket(tintptr socket, int write); void APP_CC g_delete_wait_obj_from_socket(tintptr wait_obj); int APP_CC g_set_wait_obj(tintptr obj); diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 3cb075b3..6aff5830 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -197,8 +197,8 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info) /* default certificate path */ g_snprintf(client_info->certificate, 1023, "%s/cert.pem", XRDP_CFG_PATH); log_message(LOG_LEVEL_INFO, - "Missing definition of X.509 certificate, use " - "default instead: %s", client_info->certificate); + "Using default X.509 certificate: %s", + client_info->certificate); } else if (value[0] != '/') @@ -206,7 +206,7 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info) /* default certificate path */ g_snprintf(client_info->certificate, 1023, "%s/cert.pem", XRDP_CFG_PATH); log_message(LOG_LEVEL_WARNING, - "No absolute path to X.509 certificate, use " + "X.509 certificate should use absolute path, using " "default instead: %s", client_info->certificate); } else @@ -222,16 +222,15 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info) { /* default key_file path */ g_snprintf(client_info->key_file, 1023, "%s/key.pem", XRDP_CFG_PATH); - log_message(LOG_LEVEL_INFO, - "Missing definition of X.509 key file, use " - "default instead: %s", client_info->key_file); + log_message(LOG_LEVEL_INFO, "Using default X.509 key file: %s", + client_info->key_file); } else if (value[0] != '/') { /* default key_file path */ g_snprintf(client_info->key_file, 1023, "%s/key.pem", XRDP_CFG_PATH); log_message(LOG_LEVEL_WARNING, - "No absolute path to X.509 key file, use" + "X.509 key file should use absolute path, using " "default instead: %s", client_info->key_file); } else diff --git a/prog_std.txt b/prog_std.txt deleted file mode 100644 index 761006a5..00000000 --- a/prog_std.txt +++ /dev/null @@ -1,41 +0,0 @@ - -This is an attempt to explain my odd programming standard used for this project. -Not to defend any of these but it's my default standard and it makes it easy -for me to read code. - -Some files break these rules, they will be updated eventually. - -try to make any file compile with c++ compilers - -always put one var on a line by itself - char* pvar; - char text[256]; -not - char *pvar, text[256]; - -function calls look like this - foo(a, b, c); -not - foo ( a, b, c ); - -while, if, and case statements look like - while (i != 0) -not - while(i != 0) - -for comments, always use /* */, not // - -defines should always be uppercase - -don't use tabs, use spaces - -no line should exceed 80 chars - -always use {} in if and while, even if it's only one line - while (p != 0) - { - p = p->next; - } -not - while (p != 0) - p = p->next; diff --git a/readme.txt b/readme.txt index b051ef02..df9d92f0 100644 --- a/readme.txt +++ b/readme.txt @@ -21,7 +21,7 @@ xup is a module used to connect to an rdp specific X11 server Xserver is the files needed to build an rdp specific X11 server COPYING is the license file design.txt is an attempt to explain the project design -prog_std.txt is an attempt to explain the programming standard used +coding_style.md describes the coding style for the project since version 0.5.0 we switch to autotools to build xrdp diff --git a/sesman/access.c b/sesman/access.c index b50f2caa..071c0ec3 100644 --- a/sesman/access.c +++ b/sesman/access.c @@ -30,7 +30,7 @@ extern struct config_sesman *g_cfg; /* in sesman.c */ /******************************************************************************/ int DEFAULT_CC -access_login_allowed(char *user) +access_login_allowed(const char *user) { int gid; int ok; @@ -79,7 +79,7 @@ access_login_allowed(char *user) /******************************************************************************/ int DEFAULT_CC -access_login_mng_allowed(char *user) +access_login_mng_allowed(const char *user) { int gid; int ok; diff --git a/sesman/access.h b/sesman/access.h index 2da6bb88..7705f8bb 100644 --- a/sesman/access.h +++ b/sesman/access.h @@ -35,7 +35,7 @@ * */ int DEFAULT_CC -access_login_allowed(char* user); +access_login_allowed(const char *user); /** * @@ -45,6 +45,6 @@ access_login_allowed(char* user); * */ int DEFAULT_CC -access_login_mng_allowed(char* user); +access_login_mng_allowed(const char *user); #endif diff --git a/sesman/auth.h b/sesman/auth.h index e06b9eb3..68e677ef 100644 --- a/sesman/auth.h +++ b/sesman/auth.h @@ -32,11 +32,11 @@ * @brief Validates user's password * @param user user's login name * @param pass user's password - * @return 0 on success, 1 on failure + * @return non-zero handle on success, 0 on failure * */ long DEFAULT_CC -auth_userpass(char* user, char* pass, int *errorcode); +auth_userpass(const char *user, const char *pass, int *errorcode); /** * @@ -94,7 +94,7 @@ auth_set_env(long in_val); * */ int DEFAULT_CC -auth_check_pwd_chg(char* user); +auth_check_pwd_chg(const char *user); /** * @@ -104,6 +104,6 @@ auth_check_pwd_chg(char* user); * */ int DEFAULT_CC -auth_change_pwd(char* user, char* newpwd); +auth_change_pwd(const char *user, const char *newpwd); #endif diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c index 194a2cf4..5724829f 100644 --- a/sesman/chansrv/clipboard_file.c +++ b/sesman/chansrv/clipboard_file.c @@ -453,7 +453,7 @@ clipboard_send_file_data(int streamId, int lindex, if (g_file_seek(fd, nPositionLow) < 0) { log_message(LOG_LEVEL_ERROR, "clipboard_send_file_data: seek error " - "in file: %s\n", full_fn); + "in file: %s", full_fn); g_file_close(fd); return 1; } diff --git a/sesman/chansrv/fifo.c b/sesman/chansrv/fifo.c index b212736a..595dbb29 100644 --- a/sesman/chansrv/fifo.c +++ b/sesman/chansrv/fifo.c @@ -235,21 +235,21 @@ fifo_remove(FIFO* fp) void* fifo_peek(FIFO* fp) { - log_debug_high("entered\n"); + log_debug_high("entered"); if (!fp) { - log_debug_high("FIFO is null\n"); + log_debug_high("FIFO is null"); return 0; } if (fp->rd_ptr == fp->wr_ptr) { - log_debug_high("FIFO is empty\n"); + log_debug_high("FIFO is empty"); return 0; } - log_debug_low("peeking data at index %d\n", fp->rd_ptr); + log_debug_low("peeking data at index %d", fp->rd_ptr); return (void *) fp->user_data[fp->rd_ptr]; } diff --git a/sesman/config.c b/sesman/config.c index c1160693..69ba1c18 100644 --- a/sesman/config.c +++ b/sesman/config.c @@ -382,7 +382,7 @@ config_read_rdp_params(int file, struct config_sesman *cs, struct list *param_n, list_add_item(cs->rdp_params, (long)g_strdup((char *)list_get_item(param_v, i))); } - /* printing security config */ + /* printing X11rdp parameters */ g_printf("X11rdp parameters:\r\n"); for (i = 0; i < cs->rdp_params->count; i++) @@ -413,7 +413,7 @@ config_read_xorg_params(int file, struct config_sesman *cs, (long) g_strdup((char *) list_get_item(param_v, i))); } - /* printing security config */ + /* printing XOrg parameters */ g_printf("XOrg parameters:\r\n"); for (i = 0; i < cs->xorg_params->count; i++) @@ -444,7 +444,7 @@ config_read_vnc_params(int file, struct config_sesman *cs, struct list *param_n, list_add_item(cs->vnc_params, (long)g_strdup((char *)list_get_item(param_v, i))); } - /* printing security config */ + /* printing Xvnc parameters */ g_printf("Xvnc parameters:\r\n"); for (i = 0; i < cs->vnc_params->count; i++) @@ -478,7 +478,7 @@ config_read_session_variables(int file, struct config_sesman *cs, (tintptr) g_strdup((char *) list_get_item(param_v, i))); } - /* printing security config */ + /* printing session variables */ g_writeln("%s parameters:", SESMAN_CFG_SESSION_VARIABLES); for (i = 0; i < cs->session_variables1->count; i++) diff --git a/sesman/env.c b/sesman/env.c index d8bb1e98..11c8e2bf 100644 --- a/sesman/env.c +++ b/sesman/env.c @@ -34,7 +34,7 @@ extern struct config_sesman *g_cfg; /* in sesman.c */ /******************************************************************************/ int DEFAULT_CC -env_check_password_file(char *filename, char *passwd) +env_check_password_file(const char *filename, const char *passwd) { char encryptedPasswd[16]; char key[24]; @@ -83,8 +83,8 @@ env_check_password_file(char *filename, char *passwd) /******************************************************************************/ /* its the responsibility of the caller to free passwd_file */ int DEFAULT_CC -env_set_user(char *username, char **passwd_file, int display, - struct list *env_names, struct list* env_values) +env_set_user(const char *username, char **passwd_file, int display, + const struct list *env_names, const struct list *env_values) { int error; int pw_uid; diff --git a/sesman/env.h b/sesman/env.h index 23828080..a7156508 100644 --- a/sesman/env.h +++ b/sesman/env.h @@ -38,7 +38,7 @@ * */ int DEFAULT_CC -env_check_password_file(char* filename, char* password); +env_check_password_file(const char *filename, const char *password); /** * @@ -50,7 +50,7 @@ env_check_password_file(char* filename, char* password); * */ int DEFAULT_CC -env_set_user(char* username, char** passwd_file, int display, - struct list *env_names, struct list* env_values); +env_set_user(const char *username, char **passwd_file, int display, + const struct list *env_names, const struct list *env_values); #endif diff --git a/sesman/libscp/libscp_connection.c b/sesman/libscp/libscp_connection.c index a04c4388..a5cfcb4a 100644 --- a/sesman/libscp/libscp_connection.c +++ b/sesman/libscp/libscp_connection.c @@ -37,7 +37,7 @@ scp_connection_create(int sck) if (0 == conn) { - log_message(LOG_LEVEL_WARNING, "[connection:%d] connection create: malloc error", __LINE__); + log_message(LOG_LEVEL_ERROR, "[connection:%d] connection create: malloc error", __LINE__); return 0; } diff --git a/sesman/libscp/libscp_session.c b/sesman/libscp/libscp_session.c index e6c77058..210414c3 100644 --- a/sesman/libscp/libscp_session.c +++ b/sesman/libscp/libscp_session.c @@ -42,7 +42,7 @@ scp_session_create() if (0 == s) { - log_message(LOG_LEVEL_WARNING, "[session:%d] session create: malloc error", __LINE__); + log_message(LOG_LEVEL_ERROR, "[session:%d] session create: malloc error", __LINE__); return 0; } diff --git a/sesman/scp.c b/sesman/scp.c index 6d7ea203..e4abe004 100644 --- a/sesman/scp.c +++ b/sesman/scp.c @@ -54,12 +54,12 @@ scp_process_start(void *sck) if (sdata->version == 0) { /* starts processing an scp v0 connection */ - LOG_DBG("accept ok, go on with scp v0\n", 0); + LOG_DBG("accept ok, go on with scp v0", 0); scp_v0_process(&scon, sdata); } else { - LOG_DBG("accept ok, go on with scp v1\n", 0); + LOG_DBG("accept ok, go on with scp v1", 0); /*LOG_DBG("user: %s\npass: %s",sdata->username, sdata->password);*/ scp_v1_process(&scon, sdata); } diff --git a/sesman/session.c b/sesman/session.c index 0e123607..031b27f6 100644 --- a/sesman/session.c +++ b/sesman/session.c @@ -77,7 +77,8 @@ dumpItemsToString(struct list *self, char *outstr, int len) /******************************************************************************/ struct session_item *DEFAULT_CC -session_get_bydata(char *name, int width, int height, int bpp, int type, char *client_ip) +session_get_bydata(const char *name, int width, int height, int bpp, int type, + const char *client_ip) { struct session_chain *tmp; enum SESMAN_CFG_SESS_POLICY policy = g_cfg->sess.policy; @@ -1016,7 +1017,7 @@ session_get_bypid(int pid) /******************************************************************************/ struct SCP_DISCONNECTED_SESSION * -session_get_byuser(char *user, int *cnt, unsigned char flags) +session_get_byuser(const char *user, int *cnt, unsigned char flags) { struct session_chain *tmp; struct SCP_DISCONNECTED_SESSION *sess; diff --git a/sesman/session.h b/sesman/session.h index 7bd8c8f8..80dbdaba 100644 --- a/sesman/session.h +++ b/sesman/session.h @@ -91,7 +91,8 @@ struct session_chain * */ struct session_item* DEFAULT_CC -session_get_bydata(char* name, int width, int height, int bpp, int type, char *client_ip); +session_get_bydata(const char *name, int width, int height, int bpp, int type, + const char *client_ip); #ifndef session_find_item #define session_find_item(a, b, c, d, e, f) session_get_bydata(a, b, c, d, e, f); #endif @@ -147,6 +148,6 @@ session_get_bypid(int pid); * */ struct SCP_DISCONNECTED_SESSION* -session_get_byuser(char* user, int* cnt, unsigned char flags); +session_get_byuser(const char *user, int *cnt, unsigned char flags); #endif diff --git a/sesman/tools/sesadmin.c b/sesman/tools/sesadmin.c index 98f727e6..648598da 100644 --- a/sesman/tools/sesadmin.c +++ b/sesman/tools/sesadmin.c @@ -129,18 +129,18 @@ int main(int argc, char **argv) sock = g_tcp_socket(); if (sock < 0) { - LOG_DBG("Socket open error, g_tcp_socket() failed\n"); + LOG_DBG("Socket open error, g_tcp_socket() failed"); return 1; } s = scp_session_create(); c = scp_connection_create(sock); - LOG_DBG("Connecting to %s:%s with user %s (%s)\n", serv, port, user, pass); + LOG_DBG("Connecting to %s:%s with user %s (%s)", serv, port, user, pass); if (0 != g_tcp_connect(sock, serv, port)) { - LOG_DBG("g_tcp_connect() error\n"); + LOG_DBG("g_tcp_connect() error"); return 1; } @@ -153,7 +153,7 @@ int main(int argc, char **argv) if (SCP_CLIENT_STATE_OK != e) { - LOG_DBG("libscp error connecting: %s %d\n", s->errstr, (int)e); + LOG_DBG("libscp error connecting: %s %d", s->errstr, (int)e); } if (0 == g_strncmp(cmnd, "list", 5)) diff --git a/sesman/verify_user.c b/sesman/verify_user.c index 0c7702b5..72830236 100644 --- a/sesman/verify_user.c +++ b/sesman/verify_user.c @@ -48,7 +48,7 @@ auth_account_disabled(struct spwd *stp); /******************************************************************************/ /* returns boolean */ long DEFAULT_CC -auth_userpass(char *user, char *pass, int *errorcode) +auth_userpass(const char *user, const char *pass, int *errorcode) { const char *encr; const char *epass; @@ -125,7 +125,7 @@ auth_set_env(long in_val) /******************************************************************************/ int DEFAULT_CC -auth_check_pwd_chg(char *user) +auth_check_pwd_chg(const char *user) { struct passwd *spw; struct spwd *stp; @@ -182,7 +182,7 @@ auth_check_pwd_chg(char *user) } int DEFAULT_CC -auth_change_pwd(char *user, char *newpwd) +auth_change_pwd(const char *user, const char *newpwd) { struct passwd *spw; struct spwd *stp; diff --git a/sesman/verify_user_bsd.c b/sesman/verify_user_bsd.c index 5d9d0e23..1d84c242 100644 --- a/sesman/verify_user_bsd.c +++ b/sesman/verify_user_bsd.c @@ -44,7 +44,7 @@ extern struct config_sesman* g_cfg; /* in sesman.c */ /******************************************************************************/ /* returns boolean */ long DEFAULT_CC -auth_userpass(char *user, char *pass, int *errorcode) +auth_userpass(const char *user, const char *pass, int *errorcode) { int ret = auth_userokay(user, NULL, "auth-xrdp", pass); return ret; @@ -74,13 +74,13 @@ auth_set_env(long in_val) /******************************************************************************/ int DEFAULT_CC -auth_check_pwd_chg(char* user) +auth_check_pwd_chg(const char *user) { return 0; } int DEFAULT_CC -auth_change_pwd(char* user, char* newpwd) +auth_change_pwd(const char *user, const char *newpwd) { return 0; } diff --git a/sesman/verify_user_kerberos.c b/sesman/verify_user_kerberos.c index bb7ba3d2..0d35b115 100644 --- a/sesman/verify_user_kerberos.c +++ b/sesman/verify_user_kerberos.c @@ -396,7 +396,7 @@ cleanup: /******************************************************************************/ /* returns boolean */ int DEFAULT_CC -auth_userpass(char *user, char *pass, int *errorcode) +auth_userpass(const char *user, const char *pass, int *errorcode) { struct k_opts opts; struct k5_data k5; diff --git a/sesman/verify_user_pam.c b/sesman/verify_user_pam.c index 43783211..73e0b63f 100644 --- a/sesman/verify_user_pam.c +++ b/sesman/verify_user_pam.c @@ -102,7 +102,7 @@ get_service_name(char *service_name) Stores the detailed error code in the errorcode variable*/ long DEFAULT_CC -auth_userpass(char *user, char *pass, int *errorcode) +auth_userpass(const char *user, const char *pass, int *errorcode) { int error; struct t_auth_info *auth_info; diff --git a/sesman/verify_user_pam_userpass.c b/sesman/verify_user_pam_userpass.c index b3d4de73..abc61e21 100644 --- a/sesman/verify_user_pam_userpass.c +++ b/sesman/verify_user_pam_userpass.c @@ -34,7 +34,7 @@ /******************************************************************************/ /* returns boolean */ int DEFAULT_CC -auth_userpass(char *user, char *pass, int *errorcode) +auth_userpass(const char *user, const char *pass, int *errorcode) { pam_handle_t *pamh; pam_userpass_t userpass; diff --git a/xrdp/xrdp.ini b/xrdp/xrdp.ini index b4967050..6f9936c4 100644 --- a/xrdp/xrdp.ini +++ b/xrdp/xrdp.ini @@ -48,13 +48,14 @@ grey=dedede #red=ff0000 #green=00ff00 #background=626c72 -#autorun=xrdp1 + #hidelogwindow=yes # when true, userid/password *must* be passed on cmd line # require_credentials=yes -# set a default entry for autorun if the client send login and pass directly +# Section name to use for automatic login if the client sends username +# and password autorun=xrdp1 bulk_compression=yes diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c index e99e2bfe..9ffc6284 100644 --- a/xrdp/xrdp_bitmap.c +++ b/xrdp/xrdp_bitmap.c @@ -471,7 +471,7 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) /* read bmp header */ if (g_file_seek(fd, 14) < 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s\n", + log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s", filename); free_stream(s); g_file_close(fd); @@ -505,7 +505,7 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) { if (g_file_seek(fd, 14 + header.size) < 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s\n", + log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s", filename); } xrdp_bitmap_resize(self, header.image_width, header.image_height); @@ -562,7 +562,7 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) /* read palette */ if (g_file_seek(fd, 14 + header.size) < 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s\n", + log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s", filename); } init_stream(s, 8192); @@ -623,7 +623,7 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) /* read palette */ if (g_file_seek(fd, 14 + header.size) < 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s\n", + log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s", filename); } init_stream(s, 8192);