summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-04-08 11:04:56 +0000
committerru <ru@FreeBSD.org>2002-04-08 11:04:56 +0000
commit07997437f04ae67df52e5cf27edd45fc45b7b3a7 (patch)
tree43239812dcfdcb11364d9f2833b861bce4338e8b /lib/libutil
parent655eb3fb4f1633dec19cc1fae84cdbbefd47b2cf (diff)
downloadFreeBSD-src-07997437f04ae67df52e5cf27edd45fc45b7b3a7.zip
FreeBSD-src-07997437f04ae67df52e5cf27edd45fc45b7b3a7.tar.gz
Const poisoning.
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/login_auth.c2
-rw-r--r--lib/libutil/login_cap.312
-rw-r--r--lib/libutil/login_cap.c20
-rw-r--r--lib/libutil/login_cap.h6
-rw-r--r--lib/libutil/login_class.c12
-rw-r--r--lib/libutil/login_crypt.c2
6 files changed, 26 insertions, 28 deletions
diff --git a/lib/libutil/login_auth.c b/lib/libutil/login_auth.c
index 70227a9..a6778cb 100644
--- a/lib/libutil/login_auth.c
+++ b/lib/libutil/login_auth.c
@@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
void
auth_checknologin(login_cap_t *lc)
{
- char *file;
+ const char *file;
/* Do we ignore a nologin file? */
if (login_getcapbool(lc, "ignorenologin", 0))
diff --git a/lib/libutil/login_cap.3 b/lib/libutil/login_cap.3
index d05426c..385916c 100644
--- a/lib/libutil/login_cap.3
+++ b/lib/libutil/login_cap.3
@@ -52,12 +52,12 @@
.Fn login_getpwclass "const struct passwd *pwd"
.Ft login_cap_t *
.Fn login_getuserclass "const struct passwd *pwd"
-.Ft char *
-.Fn login_getcapstr "login_cap_t *lc" "const char *cap" "char *def" "char *error"
+.Ft "const char *"
+.Fn login_getcapstr "login_cap_t *lc" "const char *cap" "const char *def" "const char *error"
.Ft char **
.Fn login_getcaplist "login_cap_t *lc" "const char *cap" "const char *chars"
-.Ft char *
-.Fn login_getpath "login_cap_t *lc" "const char *cap" "char *error"
+.Ft "const char *"
+.Fn login_getpath "login_cap_t *lc" "const char *cap" "const char *error"
.Ft rlim_t
.Fn login_getcaptime "login_cap_t *lc" "const char *cap" "rlim_t def" "rlim_t error"
.Ft rlim_t
@@ -66,8 +66,8 @@
.Fn login_getcapsize "login_cap_t *lc" "const char *cap" "rlim_t def" "rlim_t error"
.Ft int
.Fn login_getcapbool "login_cap_t *lc" "const char *cap" "int def"
-.Ft char *
-.Fn login_getstyle "login_cap_t *lc" "char *style" "const char *auth"
+.Ft "const char *"
+.Fn login_getstyle "login_cap_t *lc" "const char *style" "const char *auth"
.Ft const char *
.Fn login_setcryptfmt "login_cap_t *lc" "const char *def" "const char *error"
.Sh DESCRIPTION
diff --git a/lib/libutil/login_cap.c b/lib/libutil/login_cap.c
index 9797c8b..55784d7 100644
--- a/lib/libutil/login_cap.c
+++ b/lib/libutil/login_cap.c
@@ -344,8 +344,8 @@ login_getuserclass(const struct passwd *pwd)
* an error string on error.
*/
-char *
-login_getcapstr(login_cap_t *lc, const char *cap, char *def, char *error)
+const char *
+login_getcapstr(login_cap_t *lc, const char *cap, const char *def, const char *error)
{
char *res;
int ret;
@@ -373,7 +373,7 @@ login_getcaplist(login_cap_t *lc, const char *cap, const char *chars)
if (chars == NULL)
chars = ", \t";
- if ((lstring = login_getcapstr(lc, cap, NULL, NULL)) != NULL)
+ if ((lstring = (char *)login_getcapstr(lc, cap, NULL, NULL)) != NULL)
return arrayize(lstring, chars, NULL);
return NULL;
}
@@ -387,15 +387,15 @@ login_getcaplist(login_cap_t *lc, const char *cap, const char *chars)
* If there is an error of any kind, return <error>.
*/
-char *
-login_getpath(login_cap_t *lc, const char *cap, char * error)
+const char *
+login_getpath(login_cap_t *lc, const char *cap, const char *error)
{
- char *str;
+ const char *str;
- if ((str = login_getcapstr(lc, (char*)cap, NULL, NULL)) == NULL)
+ if ((str = login_getcapstr(lc, cap, NULL, NULL)) == NULL)
str = error;
else {
- char *ptr = str;
+ char *ptr = (char *)str;
while (*ptr) {
int count = strcspn(ptr, ", \t");
@@ -764,8 +764,8 @@ login_getcapbool(login_cap_t *lc, const char *cap, int def)
* login_getstyle(lc, "skey", "network");
*/
-char *
-login_getstyle(login_cap_t *lc, char *style, const char *auth)
+const char *
+login_getstyle(login_cap_t *lc, const char *style, const char *auth)
{
int i;
char **authtypes = NULL;
diff --git a/lib/libutil/login_cap.h b/lib/libutil/login_cap.h
index 81983da..1b3f0a8 100644
--- a/lib/libutil/login_cap.h
+++ b/lib/libutil/login_cap.h
@@ -102,13 +102,13 @@ login_cap_t *login_getclass(const char *);
login_cap_t *login_getpwclass(const struct passwd *);
login_cap_t *login_getuserclass(const struct passwd *);
-char *login_getcapstr(login_cap_t*, const char *, char *, char *);
+const char *login_getcapstr(login_cap_t*, const char *, const char *, const char *);
char **login_getcaplist(login_cap_t *, const char *, const char *);
-char *login_getstyle(login_cap_t *, char *, const char *);
+const char *login_getstyle(login_cap_t *, const char *, const char *);
rlim_t login_getcaptime(login_cap_t *, const char *, rlim_t, rlim_t);
rlim_t login_getcapnum(login_cap_t *, const char *, rlim_t, rlim_t);
rlim_t login_getcapsize(login_cap_t *, const char *, rlim_t, rlim_t);
-char *login_getpath(login_cap_t *, const char *, char *);
+const char *login_getpath(login_cap_t *, const char *, const char *);
int login_getcapbool(login_cap_t *, const char *, int);
const char *login_setcryptfmt(login_cap_t *, const char *, const char *);
diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c
index b8b956b..dfd2d2c 100644
--- a/lib/libutil/login_class.c
+++ b/lib/libutil/login_class.c
@@ -126,7 +126,7 @@ static struct login_vars {
};
static char *
-substvar(char * var, const struct passwd * pwd, int hlen, int pch, int nlen)
+substvar(const char * var, const struct passwd * pwd, int hlen, int pch, int nlen)
{
char *np = NULL;
@@ -137,12 +137,10 @@ substvar(char * var, const struct passwd * pwd, int hlen, int pch, int nlen)
if (pwd != NULL) {
/* Count the number of ~'s in var to substitute */
- p = var;
- for (p = var; (p = strchr(p, '~')) != NULL; p++)
+ for (p = (char *)var; (p = strchr(p, '~')) != NULL; p++)
++tildes;
/* Count the number of $'s in var to substitute */
- p = var;
- for (p = var; (p = strchr(p, '$')) != NULL; p++)
+ for (p = (char *)var; (p = strchr(p, '$')) != NULL; p++)
++dollas;
}
@@ -197,8 +195,8 @@ setclassenvironment(login_cap_t *lc, const struct passwd * pwd, int paths)
++pch;
while (vars->tag != NULL) {
- char * var = paths ? login_getpath(lc, vars->tag, NULL)
- : login_getcapstr(lc, vars->tag, NULL, NULL);
+ const char * var = paths ? login_getpath(lc, vars->tag, NULL)
+ : login_getcapstr(lc, vars->tag, NULL, NULL);
char * np = substvar(var, pwd, hlen, pch, nlen);
diff --git a/lib/libutil/login_crypt.c b/lib/libutil/login_crypt.c
index f3d83a8..c65fc9b 100644
--- a/lib/libutil/login_crypt.c
+++ b/lib/libutil/login_crypt.c
@@ -38,7 +38,7 @@ const char *
login_setcryptfmt(login_cap_t *lc, const char *def, const char *error) {
const char *cipher;
- cipher = login_getcapstr(lc, "passwd_format", (char *)def, NULL);
+ cipher = login_getcapstr(lc, "passwd_format", def, NULL);
if (getenv("CRYPT_DEBUG") != NULL)
fprintf(stderr, "login_setcryptfmt: "
"passwd_format = %s\n", cipher);
OpenPOWER on IntegriCloud