summaryrefslogtreecommitdiff
path: root/modules/pam_filter/upperLOWER
diff options
context:
space:
mode:
authorThorsten Kukuk <kukuk@thkukuk.de>2004-09-22 09:37:46 +0000
committerThorsten Kukuk <kukuk@thkukuk.de>2004-09-22 09:37:46 +0000
commit6e99aa00d23a68650fdd4fae01aab812dcfe10eb (patch)
tree0b929b30fa38ed1d402515fbf9d7d8cf6dcb5284 /modules/pam_filter/upperLOWER
parente1f75a80821125170e23a9b920d138a4a952c708 (diff)
Relevant BUGIDs:
Purpose of commit: Commit summary: --------------- bugfix: Add rest of Steve Grubb's resource leak and other fixes
Diffstat (limited to 'modules/pam_filter/upperLOWER')
-rw-r--r--modules/pam_filter/upperLOWER/Makefile7
-rw-r--r--modules/pam_filter/upperLOWER/upperLOWER.c15
2 files changed, 14 insertions, 8 deletions
diff --git a/modules/pam_filter/upperLOWER/Makefile b/modules/pam_filter/upperLOWER/Makefile
index 77bc4102..60c6d08c 100644
--- a/modules/pam_filter/upperLOWER/Makefile
+++ b/modules/pam_filter/upperLOWER/Makefile
@@ -12,16 +12,19 @@ TITLE=upperLOWER
#
-CFLAGS += -I../include
+CFLAGS += -I../include -I../../pammodutil/include
OBJS = $(TITLE).o
+LIBS += $(GLIB_LIBS) -L../../pammodutil -lpammodutil
+LDFLAGS = $(LIBS)
+
####################### don't edit below #######################
all: $(TITLE)
$(TITLE): $(OBJS)
- $(CC) $(CFLAGS) -o $(TITLE) $(OBJS)
+ $(CC) $(CFLAGS) -o $(TITLE) $(OBJS) $(LDFLAGS)
$(STRIP) $(TITLE)
install:
diff --git a/modules/pam_filter/upperLOWER/upperLOWER.c b/modules/pam_filter/upperLOWER/upperLOWER.c
index e750e877..72f9dab5 100644
--- a/modules/pam_filter/upperLOWER/upperLOWER.c
+++ b/modules/pam_filter/upperLOWER/upperLOWER.c
@@ -21,6 +21,9 @@
#include <unistd.h>
#include <security/pam_filter.h>
+#include <security/pam_modules.h>
+#include <security/_pam_macros.h>
+#include <security/_pam_modutil.h>
/* ---------------------------------------------------------------- */
@@ -109,27 +112,27 @@ int main(int argc, char **argv)
/* application errors */
if ( FD_ISSET(APPERR_FILENO,&readers) ) {
- int got = read(APPERR_FILENO, buffer, BUFSIZ);
+ int got = _pammodutil_read(APPERR_FILENO, buffer, BUFSIZ);
if (got <= 0) {
break;
} else {
/* translate to give to real terminal */
if (before_user != NULL)
before_user(buffer, got);
- if ( write(STDERR_FILENO, buffer, got) != got ) {
+ if (_pammodutil_write(STDERR_FILENO, buffer, got) != got ) {
log_this(LOG_WARNING,"couldn't write %d bytes?!",got);
break;
}
}
} else if ( FD_ISSET(APPOUT_FILENO,&readers) ) { /* app output */
- int got = read(APPOUT_FILENO, buffer, BUFSIZ);
+ int got = _pammodutil_read(APPOUT_FILENO, buffer, BUFSIZ);
if (got <= 0) {
break;
} else {
/* translate to give to real terminal */
if (before_user != NULL)
before_user(buffer, got);
- if ( write(STDOUT_FILENO, buffer, got) != got ) {
+ if (_pammodutil_write(STDOUT_FILENO, buffer, got) != got ) {
log_this(LOG_WARNING,"couldn't write %d bytes!?",got);
break;
}
@@ -137,7 +140,7 @@ int main(int argc, char **argv)
}
if ( FD_ISSET(STDIN_FILENO, &readers) ) { /* user input */
- int got = read(STDIN_FILENO, buffer, BUFSIZ);
+ int got = _pammodutil_read(STDIN_FILENO, buffer, BUFSIZ);
if (got < 0) {
log_this(LOG_WARNING,"user input junked");
break;
@@ -145,7 +148,7 @@ int main(int argc, char **argv)
/* translate to give to application */
if (before_app != NULL)
before_app(buffer, got);
- if ( write(APPIN_FILENO, buffer, got) != got ) {
+ if (_pammodutil_write(APPIN_FILENO, buffer, got) != got ) {
log_this(LOG_WARNING,"couldn't pass %d bytes!?",got);
break;
}