summaryrefslogtreecommitdiff
blob: 344807533ad1644907351983e6bb8c9541bf7342 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
--- include/selinux/get_context_list.h
+++ include/selinux/get_context_list.h	2003/10/03 06:17:18
@@ -13,7 +13,7 @@
    customizable preferences.  Returns number of entries in *conary.
    If 'fromcon' is NULL, defaults to current context.
    Caller must free via freeconary. */
-extern int get_ordered_context_list(char *user, 
+extern int get_ordered_context_list(const char *user, 
 				    security_context_t fromcon,
 				    security_context_t **list);
 
@@ -24,7 +24,7 @@
    If 'fromcon' is NULL, defaults to current context.
    Returns 0 on success or -1 otherwise.
    Caller must free via freecon. */
-extern int get_default_context(char* user, 
+extern int get_default_context(const char* user, 
 			       security_context_t fromcon,
 			       security_context_t *newcon);
 
@@ -39,6 +39,7 @@
    if a list of authorized contexts could not be obtained. 
    Caller must free via freecon.
    Returns 0 on success or -1 otherwise. */
-extern int manual_user_enter_context(char *user, security_context_t *newcon);
+extern int manual_user_enter_context(const char *user,
+				     security_context_t *newcon);
 
 #endif
--- include/selinux/selinux.h
+++ include/selinux/selinux.h	2003/10/03 06:19:39
@@ -98,7 +98,7 @@
 /* Compute the set of reachable user contexts and set *con to refer to 
    the NULL-terminated array of contexts.  Caller must free via freeconary. */
 extern int security_compute_user(security_context_t scon,
-				 char *username,
+				 const char *username,
 				 security_context_t **con);
 
 /* Load a policy configuration. */
--- src/compute_user.c
+++ src/compute_user.c	2003/10/03 06:19:00
@@ -10,7 +10,7 @@
 #include "policy.h"
 
 int security_compute_user(security_context_t scon,
-			  char *user,
+			  const char *user,
 			  security_context_t **con)
 {
 	char **ary;
--- src/get_context_list.c
+++ src/get_context_list.c	2003/10/03 06:17:18
@@ -10,7 +10,7 @@
 #define USERPRIORITY 1
 #define SYSTEMPRIORITY 2
 
-int get_default_context(char* user, 
+int get_default_context(const char* user, 
 			security_context_t fromcon,
 			security_context_t *newcon)
 {
@@ -112,7 +112,7 @@
 		      pri_list.  The number of elements stored in pri_list 
 		      is returned.
 */
-static int list_from_string (char *instr, char *user, 
+static int list_from_string (char *instr, const char *user, 
                              security_context_t *pri_list, 
                              int pri_length)
 {
@@ -170,7 +170,7 @@
                       in pri_list or -1 on error.
 */
 static int get_context_list (FILE *infile, security_context_t fromcon, 
-                             char *user, security_context_t *pri_list, 
+                             const char *user, security_context_t *pri_list, 
                              int pri_length)
 {
     int ret_val = 0;        /* Used for return values                    */
@@ -197,7 +197,7 @@
                          system configuration file.  The number of contexts placed
                          in pri_list is returned.
  */
-static int get_config_priority (security_context_t fromcon, char *user, 
+static int get_config_priority (security_context_t fromcon, const char *user, 
                          security_context_t *pri_list, int pri_length, int which,
                          int default_user_flag)
 {
@@ -346,7 +346,7 @@
     return ret_val;
 }
 
-int get_ordered_context_list (char *user, 
+int get_ordered_context_list (const char *user, 
 			      security_context_t fromcon, 
 			      security_context_t **list)
 {
@@ -376,7 +376,7 @@
 	    freefrom = 1;
     }
 
-    rc = security_compute_user(fromcon, (char*)user, &init_list);
+    rc = security_compute_user(fromcon, user, &init_list);
     if (rc < 0) {
 	    /* Retry with the default SELinux user identity. */
 	    rc = security_compute_user(fromcon, 
--- src/query_user_context.c
+++ src/query_user_context.c	2003/10/03 06:17:18
@@ -109,7 +109,7 @@
  *                     context chosen by the user into usercon.  Returns 0
  *                     on success.
  */
-int manual_user_enter_context (char *user, security_context_t *newcon)
+int manual_user_enter_context (const char *user, security_context_t *newcon)
 {
     char response[10];     /* Used to get yes or no answers from user */
     char role[100];        /* The role requested by the user          */
@@ -120,9 +120,9 @@
     int  levellen = 100;
     int mls_enabled = 0;
 
-    context_t new_context; /* The new context chosen by the user      */
-    char *user_context;    /* String value of the user's context      */
-    int done = 0;          /* true if a valid sid has been obtained   */
+    context_t new_context;     /* The new context chosen by the user     */
+    char *user_context = NULL; /* String value of the user's context     */
+    int done = 0;              /* true if a valid sid has been obtained  */
 
     /* Initialize the context.  How this is done depends on whether
        or not MLS is enabled                                        */