1 /****************************************************************************** 2 (c) 2002 Christine Caulfield christine.caulfield@googlemail.com 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 ******************************************************************************/ 14 15 16 void add_string(unsigned char *packet, int *ptr, 17 const unsigned char *string); 18 19 void get_string(unsigned char *packet, int *ptr, 20 unsigned char *string); 21 22 23 int expand_issue(const char *original, int len, 24 char *newstring, int maxlen, 25 const char *servicename); 26 27 #ifndef HAVE_OPENPTY 28 #define INTERNAL_OPENPTY 29 #else 30 #ifdef HAVE_PTY_H 31 #include <pty.h> 32 #endif /* HAVE_PTY_H */ 33 #ifdef HAVE_TERMIOS_H 34 #include <termios.h> 35 #endif /* HAVE_TERMIOS_H */ 36 #ifdef HAVE_LIBUTIL_H 37 #include <libutil.h> 38 #endif /* HAVE_LIBUTIL_H */ 39 #ifdef HAVE_UTIL_H 40 #include <util.h> 41 #endif /* HAVE_UTIL_H */ 42 #endif 43 44 // RedHat 5 has a broken openpty() 45 #ifdef INTERNAL_OPENPTY 46 int chrissie_openpty(int*,int*, char*,char*,char*); 47 #define openpty chrissie_openpty 48 #endif 49 50 #if defined(VERBOSE_DEBUG) 51 #include <stdarg.h> 52 extern void chrissie_debuglog(char *,...); 53 #endif 54 55 #ifdef VERBOSE_DEBUG 56 #define debuglog(x) chrissie_debuglog x 57 58 //#include <stdarg.h> 59 //extern void chrissie_debuglog(char *,...); 60 #else 61 #define debuglog(x) 62 #endif 63 64 #include <signal.h> 65 66 class sig_blk_t { 67 public: sig_blk_t(int sig_num)68 sig_blk_t(int sig_num) 69 { 70 sigset_t new_set; 71 72 sigemptyset(&new_set); 73 sigaddset(&new_set, sig_num); 74 sigprocmask(SIG_BLOCK, &new_set, &saved_set); 75 } ~sig_blk_t()76 virtual ~sig_blk_t() 77 { 78 sigprocmask(SIG_SETMASK, &saved_set, NULL); 79 } 80 81 private: 82 sigset_t saved_set; 83 }; 84