Changeset 2538 for neercs


Ignore:
Timestamp:
Jul 16, 2008, 3:36:51 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • lock.c: do not build PTY locking mechanism if PAM isn't present.
Location:
neercs/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/configure.ac

    r2510 r2538  
    3838AC_CHECK_HEADERS(stdio.h pty.h sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h sys/wait.h linux/kdev_t.h linux/major.h security/pam_appl.h security/pam_misc.h)
    3939
    40 AC_CHECK_LIB(pam, pam_authenticate, PAM_LIBS="${PAM_LIBS} -lpam")
     40lock=no
     41AC_CHECK_LIB(pam, pam_authenticate,
     42 [PAM_LIBS="${PAM_LIBS} -lpam"
     43  lock=yes])
     44AC_DEFINE(USE_LOCK, 1, [Locking the PTY is supported])
    4145AC_SUBST(PAM_LIBS)
    42 
    4346
    4447AC_CHECK_LIB(util, forkpty, UTIL_LIBS="${UTIL_LIBS} -lutil")
     
    4851case $target in
    4952  i?86-*-linux-*|amd64-*-linux-*|x86_64-*-linux-*)
     53    AC_DEFINE(USE_GRAB, 1, [Grabbing processes is supported])
    5054    grab=yes ;;
    5155  *)
    52     grab=no;;
     56    grab=no ;;
    5357esac
    5458AC_MSG_RESULT($grab)
    55 if test "$grab" = "yes"; then
    56   AC_DEFINE(USE_GRAB, 1, [Grabbing processes is supported])
    57 fi
    5859
    5960if test "${enable_debug}" = "yes"; then
  • neercs/trunk/src/lock.c

    r2495 r2538  
    2323#include <sys/wait.h>
    2424#include <sys/types.h>
    25 #include <security/pam_appl.h>
    26 #include <security/pam_misc.h>
    27 #include <pwd.h>
     25
     26#if defined USE_LOCK
     27#   include <security/pam_appl.h>
     28#   include <security/pam_misc.h>
     29#   include <pwd.h>
     30#endif
    2831
    2932#include "neercs.h"
    3033
     34#if defined USE_LOCK
    3135static int convpam(int num_msg, const struct pam_message **msg,
    3236                   struct pam_response **resp, void *appdata_ptr);
     37#endif
    3338
    3439int update_lock(int c, struct screen_list *screen_list)
    3540{
    3641    int refresh = 0;
     42
     43#if defined USE_LOCK
    3744    if(!screen_list->locked) return 0;
    3845
     
    7077        }
    7178    }
     79#endif
     80
    7281    return refresh;
    7382}
     
    7584void draw_lock(struct screen_list *screen_list)
    7685{
     86#if defined USE_LOCK
    7787    unsigned int i;
    7888    char buffer[1024];
     
    122132        cucul_printf(cv, x, y, "Error : %s", screen_list->lockmsg);
    123133    }
    124 }
    125 
    126 
     134#endif
     135}
     136
     137
     138#if defined USE_LOCK
    127139
    128140/* FIXME, handle this without assuming this is a password auth */
     
    155167    return (PAM_SUCCESS);
    156168}
    157 
     169#endif
    158170
    159171int validate_lock(struct screen_list *screen_list, char *user, char *pass)
    160172{
     173#if USE_LOCK
    161174    int ret;
    162175    pam_handle_t *pamh=NULL;
     
    200213
    201214    ret = pam_end(pamh, PAM_SUCCESS);
     215#endif
     216
    202217    return 1;
    203218}
Note: See TracChangeset for help on using the changeset viewer.