diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/Makefile.in | 31 | ||||
-rw-r--r-- | src/config.h | 2 | ||||
-rw-r--r-- | src/main.c | 12 | ||||
-rw-r--r-- | src/status.c | 2 | ||||
-rw-r--r-- | src/ui.c | 1 | ||||
-rw-r--r-- | src/ui_ani.c | 6 | ||||
-rw-r--r-- | src/ui_nask.c | 16 | ||||
-rw-r--r-- | src/ui_statusbar.c | 3 |
9 files changed, 53 insertions, 21 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 5538be2..bf59589 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,5 @@ bin_PROGRAMS=naskpass naskshell naskpass_check naskpass_SOURCES=main.c log.c opt.c utils.c status.c ui_ani.c ui.c ui_input.c ui_ipc.c ui_txtwindow.c ui_statusbar.c ui_nask.c -naskpass_LDFLAGS= naskpass_check_SOURCES=check/check.c naskshell_SOURCES=shell/shell.c if DEBUG diff --git a/src/Makefile.in b/src/Makefile.in index ab0543b..30f39be 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,17 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -83,12 +93,11 @@ bin_PROGRAMS = naskpass$(EXEEXT) naskshell$(EXEEXT) \ @RESOLVE_TRUE@am__append_1 = -DHAVE_RESOLVE @UNAME_TRUE@am__append_2 = -DHAVE_UNAME subdir = src -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/aconfig.h.in $(top_srcdir)/build/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = aconfig.h CONFIG_CLEAN_FILES = @@ -103,8 +112,8 @@ am_naskpass_OBJECTS = naskpass-main.$(OBJEXT) naskpass-log.$(OBJEXT) \ naskpass-ui_statusbar.$(OBJEXT) naskpass-ui_nask.$(OBJEXT) naskpass_OBJECTS = $(am_naskpass_OBJECTS) naskpass_LDADD = $(LDADD) -naskpass_LINK = $(CCLD) $(naskpass_CFLAGS) $(CFLAGS) \ - $(naskpass_LDFLAGS) $(LDFLAGS) -o $@ +naskpass_LINK = $(CCLD) $(naskpass_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ am__dirstamp = $(am__leading_dot)dirstamp am_naskpass_check_OBJECTS = check/check.$(OBJEXT) naskpass_check_OBJECTS = $(am_naskpass_check_OBJECTS) @@ -173,10 +182,13 @@ am__define_uniq_tagged_files = \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/aconfig.h.in \ + $(top_srcdir)/build/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ +AM_CPPFLAGS = @AM_CPPFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ @@ -267,6 +279,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -276,7 +289,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ naskpass_SOURCES = main.c log.c opt.c utils.c status.c ui_ani.c ui.c ui_input.c ui_ipc.c ui_txtwindow.c ui_statusbar.c ui_nask.c -naskpass_LDFLAGS = naskpass_check_SOURCES = check/check.c naskshell_SOURCES = shell/shell.c @DEBUG_FALSE@naskpass_CFLAGS = -fPIC -fomit-frame-pointer \ @@ -301,7 +313,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -820,6 +831,8 @@ uninstall-am: uninstall-binPROGRAMS mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-binPROGRAMS +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/config.h b/src/config.h index 1a7dafc..d355e5d 100644 --- a/src/config.h +++ b/src/config.h @@ -10,7 +10,7 @@ #define MSQ_PWD "/naskpass-passwd" #define MSQ_INF "/naskpass-info" -#ifdef HAVE_CONFIG_H +#if defined(HAVE_CONFIG_H) || defined(_HAVE_CONFIG_H) #include "aconfig.h" #include "version.h" #endif @@ -1,4 +1,7 @@ +#include "config.h" + #include <stdio.h> +#include <unistd.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> @@ -7,7 +10,6 @@ #include <sys/wait.h> #include <fcntl.h> -#include "config.h" #include "opt.h" #include "log.h" @@ -16,6 +18,7 @@ #include "ui_ani.h" #include "ui_input.h" #include "ui_statusbar.h" +#include "ui_nask.h" #define MSG(msg_idx) msg_arr[msg_idx] @@ -67,8 +70,9 @@ run_cryptcreate(char *pass, char *crypt_cmd) int retval; char *cmd; - if (crypt_cmd == NULL || pass == NULL) return (-1); - asprintf(&cmd, "echo '%s' | %s >/dev/null 2>/dev/null", pass, crypt_cmd); + if (crypt_cmd == NULL || pass == NULL) return -1; + if (asprintf(&cmd, "echo '%s' | %s >/dev/null 2>/dev/null", pass, crypt_cmd) < 0) + return -2; retval = system(cmd); free(cmd); return (retval); @@ -167,7 +171,7 @@ main(int argc, char **argv) } usleep(100000); waitpid(child, &c_status, WNOHANG); - if ( WIFEXITED(&c_status) != 0 ) { + if ( WIFEXITED(c_status) != 0 ) { logs("%s\n", "child exited"); ui_ipc_semtrywait(SEM_UI); } diff --git a/src/status.c b/src/status.c index 5286ddf..e545339 100644 --- a/src/status.c +++ b/src/status.c @@ -1,3 +1,5 @@ +#include "config.h" + #include <stdio.h> #include <stdlib.h> #include <errno.h> @@ -1,5 +1,6 @@ #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include <errno.h> #include <pthread.h> #include <string.h> diff --git a/src/ui_ani.c b/src/ui_ani.c index d1f1073..890ae83 100644 --- a/src/ui_ani.c +++ b/src/ui_ani.c @@ -1,3 +1,6 @@ +#include "config.h" + +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -77,7 +80,8 @@ anic_cb(WINDOW *win, void *data, bool timed_out) retval = UICB_ERR_BUF; } } else { - asprintf(&tmp, "%c", b->state); + if (asprintf(&tmp, "%c", b->state) < 0) + retval = UICB_ERR_BUF; } if (win != NULL) { mvwprintw(win, a->y, a->x, tmp); diff --git a/src/ui_nask.c b/src/ui_nask.c index aae9536..429e404 100644 --- a/src/ui_nask.c +++ b/src/ui_nask.c @@ -1,7 +1,10 @@ +#include "config.h" + #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> +#include <assert.h> #include "ui.h" #include "ui_ipc.h" @@ -14,8 +17,6 @@ #include "utils.h" #include "status.h" -#include "config.h" - #define APP_TIMEOUT 60 #define APP_TIMEOUT_FMT "%02d" #define NETUPD_INTERVAL 5 @@ -105,13 +106,18 @@ uninfo_statusbar_update(WINDOW *win, struct statusbar *bar, bool ui_timeout) char *sysmachine; if (utGetUnameInfo(&sysop, &sysrelease, &sysmachine) == 0) { - asprintf(&untext, "%s v%s (%s)", sysop, sysrelease, sysmachine); + int ret = asprintf(&untext, "%s v%s (%s)", sysop, sysrelease, sysmachine); free(sysop); free(sysrelease); free(sysmachine); + if (ret < 0) { + return UICB_ERR_BUF; + } } else #endif - asprintf(&untext, "%s", "[unknown kernel]"); + if (asprintf(&untext, "%s", "[unknown kernel]") < 0) { + return UICB_ERR_BUF; + } set_statusbar_text(bar, untext); } @@ -208,7 +214,7 @@ passwd_input_cb(WINDOW *wnd, void *data, int key) static void init_ui_elements(unsigned int max_x, unsigned int max_y) { - asprintf(&title, "/* %s-%s */", PKGNAME, VERSION); + assert(asprintf(&title, "/* %s-%s */", PKGNAME, VERSION) > 0); pw_input = init_input((unsigned int)(max_x / 2)-PASSWD_XRELPOS, (unsigned int)(max_y / 2)-PASSWD_YRELPOS, PASSWD_WIDTH, "PASSWORD: ", diff --git a/src/ui_statusbar.c b/src/ui_statusbar.c index fbb5387..8e183c6 100644 --- a/src/ui_statusbar.c +++ b/src/ui_statusbar.c @@ -1,3 +1,6 @@ +#include "config.h" + +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <alloca.h> |