aboutsummaryrefslogtreecommitdiff
path: root/Linux-PAM/libpam/pam_start.c
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@ubuntu.com>2019-01-03 12:47:05 -0800
committerSteve Langasek <steve.langasek@ubuntu.com>2019-01-03 12:47:05 -0800
commit4c51da22e068907adb7857d50f5109a467c94d7c (patch)
treebecf5fbae5dfcbe8896355f59042dc8eaefa7f37 /Linux-PAM/libpam/pam_start.c
parentefd31890b5ed496a5a00c08a262da240e66a4ddc (diff)
parentab9e8ba11f464fc083fc65a0bc695d60ebc86f3e (diff)
downloadpam-4c51da22e068907adb7857d50f5109a467c94d7c.tar.gz
pam-4c51da22e068907adb7857d50f5109a467c94d7c.tar.bz2
pam-4c51da22e068907adb7857d50f5109a467c94d7c.zip
New upstream version 0.79
Diffstat (limited to 'Linux-PAM/libpam/pam_start.c')
-rw-r--r--Linux-PAM/libpam/pam_start.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/Linux-PAM/libpam/pam_start.c b/Linux-PAM/libpam/pam_start.c
index 53517fe0..5d6e066a 100644
--- a/Linux-PAM/libpam/pam_start.c
+++ b/Linux-PAM/libpam/pam_start.c
@@ -3,18 +3,18 @@
/* Creator Marc Ewing
* Maintained by AGM
*
- * $Id: pam_start.c,v 1.1.1.1 2001/04/29 04:17:09 hartmans Exp $
+ * $Id: pam_start.c,v 1.5 2004/09/14 13:48:41 kukuk Exp $
*
*/
+#include "pam_private.h"
+
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <syslog.h>
-#include "pam_private.h"
-
int pam_start (
const char *service_name,
const char *user,
@@ -24,11 +24,21 @@ int pam_start (
D(("called pam_start: [%s] [%s] [%p] [%p]"
,service_name, user, pam_conversation, pamh));
+ if (pamh == NULL) {
+ _pam_system_log(LOG_CRIT, "pam_start: invalid argument: pamh == NULL");
+ return (PAM_BUF_ERR);
+ }
+
if ((*pamh = calloc(1, sizeof(**pamh))) == NULL) {
_pam_system_log(LOG_CRIT, "pam_start: calloc failed for *pamh");
return (PAM_BUF_ERR);
}
+ /* All service names should be files below /etc/pam.d and nothing
+ else. Forbid paths. */
+ if (strrchr(service_name, '/') != NULL)
+ service_name = strrchr(service_name, '/') + 1;
+
/* Mark the caller as the application - permission to do certain
things is limited to a module or an application */