* string.
*/
-static char *template = "~/.pam_cr/auth";
+static const char *template = "~/.pam_cr/auth";
-void authfile_template(char *str)
+void authfile_template(const char *str)
{
template = str;
}
static int path_size(const char *tokenid, const char *userid)
{
const char *usub;
- char *p, *q;
+ const char *p, *q;
struct passwd *pw;
if ((p = strchr(template, '~')) != strrchr(template, '~')) return 0;
make_path(char * const path, const char *tokenid, const char *userid)
{
const char *usub;
- char *p, *q;
+ const char *p;
+ char *q;
struct passwd *pw;
path[0] = '\0';
}
if (!ret.err) {
- int bufsize = (w.userid?strlen(w.userid)+1:0) + ao.paylsize;
+ int bufsize = (w.userid?strlen(w.userid)+1:0) + ao.paylsize + 1;
if (bufsize) {
if ((ret.buffer = malloc(bufsize)) == NULL) {
ret.err = "authfile malloc failed";
}
if (ao.payload) {
memcpy(p, ao.payload, ao.paylsize);
+ p[ao.paylsize] = '\0';
ret.payload = p;
- ret.paylsize = ao.paylsize;
+ ret.paylsize = ao.paylsize+1;
}
}
}