dgc committed 8ab6a51

some portability cleanup

Comments (0)

Files changed (3)

-CFLAGS = -Wall -shared -fPIC
+CFLAGS = -Wall -shared -fPIC -DPAM_CONST=const
 LIBS = 
-CFLAGS = -Wall -shared
+CFLAGS = -Wall -shared -DPAM_CONST=
 LIBS = -lsocket -lnsl
 #include <syslog.h>
 #include <security/pam_appl.h>
+#include <security/pam_modules.h>
 #include <sys/utsname.h>
 #define NAME "pam_provision"
 /* The context structure accumulates information about the context of
  * the PAM event so that logging and other utility code can cite it.  */
 struct context {
-	char *user;
-	char *svc;
-	char *rhost;
-	char *module;
+	PAM_CONST char *user;
+	PAM_CONST char *svc;
+	PAM_CONST char *rhost;
+	PAM_CONST char *module;
 	struct utsname uts;
 	int log;
 	syslog(LOG_AUTH|LOG_DEBUG, "pam_get_user");
 	pam_get_user(pamh, &ctx->user, NULL);
 	syslog(LOG_AUTH|LOG_DEBUG, "pam_get_item(PAM_SERVICE)");
-	pam_get_item(pamh, PAM_SERVICE, (void **)&ctx->svc);
+	pam_get_item(pamh, PAM_SERVICE, (PAM_CONST void **)&ctx->svc);
 	syslog(LOG_AUTH|LOG_DEBUG, "pam_get_item(PAM_RHOST)");
-	pam_get_item(pamh, PAM_RHOST, (void **)&ctx->rhost);
+	pam_get_item(pamh, PAM_RHOST, (PAM_CONST void **)&ctx->rhost);
 	syslog(LOG_AUTH|LOG_DEBUG, "strdup");
 	ctx->module = strdup(module);
 	ctx->log = LOG_AUTH;
 free_context(struct context *ctx)
 	if (ctx->module)
-		free(ctx->module);
+		free((void *)ctx->module);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.