summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Roskin <plroskin@gmail.com>2016-10-16 23:14:06 -0700
committerPavel Roskin <plroskin@gmail.com>2016-10-17 08:54:07 -0700
commit6fef1e4eb53877d41f52f2b4d93ea11eb680b6b3 (patch)
tree6d1c34a0f0b598b802af3fdcf31c40d0ad1b64c4
parentbc868b96b1a88085cf141428ef8c72f5cd496c2e (diff)
downloadxrdp-proprietary-6fef1e4eb53877d41f52f2b4d93ea11eb680b6b3.tar.gz
xrdp-proprietary-6fef1e4eb53877d41f52f2b4d93ea11eb680b6b3.zip
Use const pointers in function arguments when possible
-rw-r--r--common/list.c2
-rw-r--r--common/list.h2
-rw-r--r--common/log.c2
-rw-r--r--common/log.h2
-rw-r--r--common/os_calls.c4
-rw-r--r--common/os_calls.h4
-rw-r--r--sesman/access.c4
-rw-r--r--sesman/access.h4
-rw-r--r--sesman/auth.h6
-rw-r--r--sesman/env.c6
-rw-r--r--sesman/env.h6
-rw-r--r--sesman/session.c5
-rw-r--r--sesman/session.h5
-rw-r--r--sesman/verify_user.c6
-rw-r--r--sesman/verify_user_bsd.c6
-rw-r--r--sesman/verify_user_kerberos.c2
-rw-r--r--sesman/verify_user_pam.c2
-rw-r--r--sesman/verify_user_pam_userpass.c2
18 files changed, 36 insertions, 34 deletions
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 7706fa4c..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
diff --git a/common/os_calls.c b/common/os_calls.c
index c101ad74..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;
@@ -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/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 643d361f..68e677ef 100644
--- a/sesman/auth.h
+++ b/sesman/auth.h
@@ -36,7 +36,7 @@
*
*/
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/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/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/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;