- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Equivalent C API for getpassphrase on HPUX
Operating System - HP-UX
1752808
Members
6916
Online
108789
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2004 02:38 AM
тАО12-14-2004 02:38 AM
Hi,
I am trying to port a Solaris application to HPUX.This application uses a C API "getpassphrase" for reading a user password.The getpassphrase() API is not available for HPUX.On HPUX we have a C API namely getpass().But the limitation of this API is that it can accept password only upto a maximum of 8 characters whereas I want a C API that is capable of accepting passwords upto a length of 256 characters.
Is there any C API on HPUX which could address this requirement ?
Thanking you,
Moiz Khambaty.
I am trying to port a Solaris application to HPUX.This application uses a C API "getpassphrase" for reading a user password.The getpassphrase() API is not available for HPUX.On HPUX we have a C API namely getpass().But the limitation of this API is that it can accept password only upto a maximum of 8 characters whereas I want a C API that is capable of accepting passwords upto a length of 256 characters.
Is there any C API on HPUX which could address this requirement ?
Thanking you,
Moiz Khambaty.
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2004 02:53 AM
тАО12-14-2004 02:53 AM
Re: Equivalent C API for getpassphrase on HPUX
No. AFAIK there is only a getpass() function at best.
http://www.tresselt.eu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2004 02:55 AM
тАО12-14-2004 02:55 AM
Solution
Getpass() is due to be obsoleted so you should avoid it in any case. This is a rather easy function to write. All you need to do is open /dev/tty; send that file descriptor to an ioctl using TCGETA to load a termios struct, copy that struct into a new struct and then you set c_lflag to disable ECHO. Use another ioctl using TCSETA to actually instantiate your changes. Read in your password and then make a final ioctl(TCSETA) to restore the original attributes.
You should also use a signal handler to restore the attributes because the ioctl() affects the tty device -- not just the current process. If you exit with ECHO disabled, it remains disabled. You can also choose to set the interrupt, kill, etc. control characters to impossible values (0377) as you disable echo.
This is really one of those functions that you should code yourself to avoid platform dependencies. Man both termio and termios to determine which one you really want to use.
You should also use a signal handler to restore the attributes because the ioctl() affects the tty device -- not just the current process. If you exit with ECHO disabled, it remains disabled. You can also choose to set the interrupt, kill, etc. control characters to impossible values (0377) as you disable echo.
This is really one of those functions that you should code yourself to avoid platform dependencies. Man both termio and termios to determine which one you really want to use.
If it ain't broke, I can fix that.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP