(file) Return to SystemUnix.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/SystemUnix.cpp between version 1.85 and 1.86

version 1.85, 2004/06/28 18:21:51 version 1.86, 2004/06/28 23:12:51
Line 86 
Line 86 
 #include "DynamicLibraryzOS_inline.h" #include "DynamicLibraryzOS_inline.h"
 #endif #endif
  
   #if defined(PEGASUS_OS_LSB)
   #include <netinet/in.h>
   #include <termios.h>
   #include <stdio.h>
   #include <stdlib.h>
   #endif
   
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 #ifdef PEGASUS_OS_OS400 #ifdef PEGASUS_OS_OS400
Line 635 
Line 642 
  
     return localPort;     return localPort;
 } }
   #if defined(PEGASUS_OS_LSB)
   /*
      getpass equivalent.
      Adapted from example implementation described in GLIBC documentation
      (http://www.dusek.ch/manual/glibc/libc_32.html) and
      "Advanced Programming in the UNIX Environment" by Richard Stevens,
      pg. 350.
   
   */
   #define MAX_PASS_LEN 1024
   char *getpassword(const char *prompt)
   {
     static char buf[MAX_PASS_LEN];
     struct termios old, new_val;
     char *ptr;
     int c;
   
     buf[0] = 0;
   
     /* Turn echoing off and fail if we can't. */
     if (tcgetattr (fileno (stdin), &old) != 0)
       return buf;
     new_val = old;
     new_val.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
     if (tcsetattr (fileno (stdin), TCSAFLUSH, &new_val) != 0)
       return buf;
   
     /* Read the password. */
     fputs (prompt, stdin);
     ptr = buf;
     while ( (c = getc(stdin)) != EOF && c != '\n') {
       if (ptr < &buf[MAX_PASS_LEN])
         *ptr++ = c;
     }
     *ptr = 0;
     putc('\n', stdin);
   
     /* Restore terminal. */
     (void) tcsetattr (fileno (stdin), TCSAFLUSH, &old);
     fclose(stdin);
     return buf;
   }
   #endif
  
 String System::getPassword(const char* prompt) String System::getPassword(const char* prompt)
 { {
Line 643 
Line 693 
  
 #if !defined(PEGASUS_OS_OS400) #if !defined(PEGASUS_OS_OS400)
     // Not supported on OS/400, and we don't need it.     // Not supported on OS/400, and we don't need it.
       // 'getpass' is DEPRECATED
     #if !defined(PEGASUS_OS_LSB)
     password = String(getpass( prompt ));     password = String(getpass( prompt ));
     #else
       password = String(getpassword( prompt ));
     #endif
   
 #endif #endif
  
     return password;     return password;
Line 914 
Line 970 
     // Search supplemental groups.     // Search supplemental groups.
     // Get a user group entry     // Get a user group entry
     //     //
   #if defined(PEGASUS_OS_LSB)
       if ( getgrnam_r((char *)groupName, &grp,
                 grpBuffer, GRP_BUFF_SIZE, &grpresult) != 0 )
   #else
     if ( getgrnam_r(groupName, &grp,     if ( getgrnam_r(groupName, &grp,
               grpBuffer, GRP_BUFF_SIZE, &grpresult) != 0 )               grpBuffer, GRP_BUFF_SIZE, &grpresult) != 0 )
   
   #endif
     {     {
         String errorMsg = String("getgrnam_r failure : ") +         String errorMsg = String("getgrnam_r failure : ") +
                             String(strerror(errno));                             String(strerror(errno));


Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2